Apollo
Developers
Modules
TNT Countdown

TNT Countdown Module

Overview

The TNT Countdown module allows you to interact with and set custom TNT timers for the TNT Countdown mod on Lunar Client.

  • Adds the ability to set per TNT timers to be displayed for players using the TNT Countdown mod.

This module will change the actual TNT fuse time on the server, not just the countdown displayed on the client.

Integration

Sample Code

Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.

Set TNT Countdown Ticks Option

public void setTntCountdownExample() {
    this.tntCountdownModule.getOptions().set(TntCountdownModule.TNT_TICKS, 160);
}

Spawn TNT with Custom Tick amount

public void overrideTntCountdownExample(Player viewer) {
    Location location = viewer.getLocation();
    World world = viewer.getWorld();
    TNTPrimed entity = world.spawn(location, TNTPrimed.class);
 
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
 
    apolloPlayerOpt.ifPresent(apolloPlayer -> {
        ApolloEntity apolloEntity = new ApolloEntity(entity.getEntityId(), entity.getUniqueId());
        this.tntCountdownModule.setTntCountdown(apolloEntity, 200);
    });
}

Reset TNT Countdown Ticks Options

public void clearTntCountdownOptionExample() {
    this.tntCountdownModule.getOptions().remove(TntCountdownModule.TNT_TICKS, 80);
}

setTntCountdown Parameters

  1. ApolloEntity
    • The TNT entity you want the custom countdown to be displayed above.
  2. ticks
    • The amount of ticks the TNT entity has before exploding.

Available options

  • TNT_TICKS

    • Set the amount of ticks before the TNT explodes.
    • Values
      • Type: Integer
      • Default: 80
      • Minimum: 1
  • OVERRIDE_CUSTOM_TICKS

    • Whether to override custom TNT explosion ticks.
    • Values
      • Type: Boolean
      • Default: false