use of meteordevelopment.meteorclient.utils.player.PlayerUtils in project meteor-rejects by AntiCope.
the class AutoTNT method onPostTick.
@EventHandler
private void onPostTick(TickEvent.Post event) {
// Ignition
if (ignite.get() && blocksToIgnite.size() > 0) {
if (igniteTick > igniteDelay.get()) {
// Sort based on closest tnt
blocksToIgnite.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
// Ignition
FindItemResult itemResult = InvUtils.findInHotbar(item -> {
if (item.getItem() instanceof FlintAndSteelItem) {
return (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10);
} else if (item.getItem() instanceof FireChargeItem) {
return fireCharge.get();
}
return false;
});
if (!itemResult.found()) {
error("No flint and steel in hotbar");
toggle();
return;
}
ignite(blocksToIgnite.get(0), itemResult);
// Reset ticks
igniteTick = 0;
}
}
igniteTick++;
// Placement
if (place.get() && blocksToPlace.size() > 0) {
if (placeTick > placeDelay.get()) {
// Sort based on closest tnt
blocksToPlace.sort(Comparator.comparingInt(o -> o.score));
// Placement
FindItemResult itemResult = InvUtils.findInHotbar(item -> item.getItem() == Items.TNT);
if (!itemResult.found()) {
error("No tnt in hotbar");
toggle();
return;
}
place(blocksToPlace.get(0).blockPos, itemResult);
// Reset ticks
placeTick = 0;
}
}
placeTick++;
}
Aggregations