diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index 4937aa218..e50722681 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -33,7 +33,6 @@ import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractiveTag; @@ -66,7 +65,7 @@ public class CreeperEntity extends MonsterEntity { @Nonnull @Override protected InteractiveTag testMobInteraction(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) { - if (itemInHand.asItem() == Items.FLINT_AND_STEEL) { // TODO now uses item tag + if (session.getTagCache().isCreeperIgniter(itemInHand.asItem())) { return InteractiveTag.IGNITE_CREEPER; } else { return super.testMobInteraction(hand, itemInHand); @@ -76,8 +75,8 @@ public class CreeperEntity extends MonsterEntity { @Nonnull @Override protected InteractionResult mobInteract(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) { - if (itemInHand.asItem() == Items.FLINT_AND_STEEL) { - // Ignite creeper + if (session.getTagCache().isCreeperIgniter(itemInHand.asItem())) { + // Ignite creeper - as of 1.19.3 session.playSoundEvent(SoundEvent.IGNITE, position); return InteractionResult.SUCCESS; } else { diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java index 89a91ce46..851b8c20e 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java @@ -58,6 +58,7 @@ public class TagCache { /* Items */ private IntList axolotlTemptItems; + private IntList creeperIgniters; private IntList fishes; private IntList flowers; private IntList foxFood; @@ -94,6 +95,7 @@ public class TagCache { Map itemTags = packet.getTags().get("minecraft:item"); this.axolotlTemptItems = IntList.of(itemTags.get("minecraft:axolotl_tempt_items")); + this.creeperIgniters = load(itemTags.get("minecraft:creeper_igniters")); this.fishes = IntList.of(itemTags.get("minecraft:fishes")); this.flowers = IntList.of(itemTags.get("minecraft:flowers")); this.foxFood = IntList.of(itemTags.get("minecraft:fox_food")); @@ -108,6 +110,13 @@ public class TagCache { } } + private IntList load(int[] tags) { + if (tags == null) { + return IntLists.EMPTY_LIST; + } + return IntList.of(tags); + } + public void clear() { this.leaves = IntLists.emptyList(); this.wool = IntLists.emptyList(); @@ -122,6 +131,7 @@ public class TagCache { this.requiresDiamondTool = IntLists.emptyList(); this.axolotlTemptItems = IntLists.emptyList(); + this.creeperIgniters = IntLists.emptyList(); this.fishes = IntLists.emptyList(); this.flowers = IntLists.emptyList(); this.foxFood = IntLists.emptyList(); @@ -133,6 +143,10 @@ public class TagCache { return axolotlTemptItems.contains(item.javaId()); } + public boolean isCreeperIgniter(Item item) { + return creeperIgniters.contains(item.javaId()); + } + public boolean isFish(GeyserItemStack itemStack) { return fishes.contains(itemStack.getJavaId()); }