Skip to content

Commit 56423b7

Browse files
Wide-CatDesiCow
andcommitted
Update Flamethrower
- Can use fire charges - Ignore entities in water/rain/powder snow - Update fire extinguishing closes #3430 Co-authored-by: DesiCow <80271842+desicow@users.noreply.github.com>
1 parent 13e10f8 commit 56423b7

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import meteordevelopment.meteorclient.settings.*;
1010
import meteordevelopment.meteorclient.systems.modules.Categories;
1111
import meteordevelopment.meteorclient.systems.modules.Module;
12+
import meteordevelopment.meteorclient.utils.misc.HorizontalDirection;
1213
import meteordevelopment.meteorclient.utils.player.FindItemResult;
1314
import meteordevelopment.meteorclient.utils.player.InvUtils;
1415
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
@@ -104,14 +105,16 @@ private void onTick(TickEvent.Pre event) {
104105
ticks++;
105106
for (Entity entity : mc.world.getEntities()) {
106107
if (!entities.get().contains(entity.getType()) || !PlayerUtils.isWithin(entity, distance.get())) continue;
107-
if (entity.isFireImmune()) continue;
108108
if (entity == mc.player) continue;
109-
if (!targetBabies.get() && entity instanceof LivingEntity && ((LivingEntity)entity).isBaby()) continue;
109+
if (!entity.isAlive() || entity.inPowderSnow || entity.isTouchingWaterOrRain() || entity.isFireImmune()) continue;
110110

111-
FindItemResult findFlintAndSteel = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.FLINT_AND_STEEL && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1));
112-
if (!InvUtils.swap(findFlintAndSteel.slot(), true)) return;
111+
if (!targetBabies.get() && entity instanceof LivingEntity livingEntity && livingEntity.isBaby()) continue;
113112

114-
this.hand = findFlintAndSteel.getHand();
113+
FindItemResult item = InvUtils.findInHotbar(itemStack -> (itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.FIRE_CHARGE)) &&
114+
(!itemStack.isDamageable() || !antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1));
115+
if (!InvUtils.swap(item.slot(), true)) return;
116+
117+
this.hand = item.getHand();
115118
this.entity = entity;
116119

117120
if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity.getBlockPos()), Rotations.getPitch(entity.getBlockPos()), -100, this::interact);
@@ -127,12 +130,11 @@ private void interact() {
127130
if (block == Blocks.WATER || bottom == Blocks.WATER || bottom == Blocks.DIRT_PATH) return;
128131
if (block == Blocks.GRASS_BLOCK) mc.interactionManager.attackBlock(entity.getBlockPos(), Direction.DOWN);
129132

130-
if (putOutFire.get() && entity instanceof LivingEntity animal && animal.getHealth() < 1) {
133+
if (putOutFire.get() && entity instanceof LivingEntity animal && animal.getHealth() < 2) {
131134
mc.interactionManager.attackBlock(entity.getBlockPos(), Direction.DOWN);
132-
mc.interactionManager.attackBlock(entity.getBlockPos().west(), Direction.DOWN);
133-
mc.interactionManager.attackBlock(entity.getBlockPos().east(), Direction.DOWN);
134-
mc.interactionManager.attackBlock(entity.getBlockPos().north(), Direction.DOWN);
135-
mc.interactionManager.attackBlock(entity.getBlockPos().south(), Direction.DOWN);
135+
for (HorizontalDirection direction : HorizontalDirection.values()) {
136+
mc.interactionManager.attackBlock(entity.getBlockPos().add(direction.offsetX, 0, direction.offsetZ), Direction.DOWN);
137+
}
136138
} else {
137139
if (ticks >= tickInterval.get() && !entity.isOnFire()) {
138140
mc.interactionManager.interactBlock(mc.player, hand, new BlockHitResult(

0 commit comments

Comments
 (0)