From 2bf5eba2bb30eab6a49fb759f04ed2672ef48b7c Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 10 Feb 2025 01:06:10 -0500 Subject: [PATCH] yay --- .../entity/DisplayLanternBlockEntity.java | 2 +- .../wilderwild/entity/Butterfly.java | 41 +++++++++++-------- .../frozenblock/wilderwild/entity/Crab.java | 9 +++- .../wilderwild/entity/Firefly.java | 41 ++++++++++++------- .../wilderwild/entity/FlowerCow.java | 9 +++- .../wilderwild/entity/Jellyfish.java | 9 +++- .../{Bottleable.java => WWBottleable.java} | 28 ++++++------- .../wilderwild/item/MobBottleItem.java | 10 ++--- 8 files changed, 94 insertions(+), 55 deletions(-) rename src/main/java/net/frozenblock/wilderwild/entity/impl/{Bottleable.java => WWBottleable.java} (80%) diff --git a/src/main/java/net/frozenblock/wilderwild/block/entity/DisplayLanternBlockEntity.java b/src/main/java/net/frozenblock/wilderwild/block/entity/DisplayLanternBlockEntity.java index 71a92d4503..c359c4020d 100644 --- a/src/main/java/net/frozenblock/wilderwild/block/entity/DisplayLanternBlockEntity.java +++ b/src/main/java/net/frozenblock/wilderwild/block/entity/DisplayLanternBlockEntity.java @@ -215,7 +215,7 @@ private void doFireflySpawns(@NotNull Level level) { Firefly entity = WWEntityTypes.FIREFLY.create(level); if (entity != null) { entity.moveTo(worldPosition.getX() + firefly.pos.x, worldPosition.getY() + firefly.y + extraHeight + 0.07D, worldPosition.getZ() + firefly.pos.z, 0F, 0F); - entity.setFromBottle(true); + entity.wilderWild$setFromBottle(true); if (level.addFreshEntity(entity)) { FireflyAi.rememberHome(entity, entity.blockPosition()); entity.setColor(firefly.color); diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Butterfly.java b/src/main/java/net/frozenblock/wilderwild/entity/Butterfly.java index 06727e697c..f583ea26eb 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Butterfly.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Butterfly.java @@ -24,7 +24,7 @@ import net.frozenblock.lib.wind.api.WindManager; import net.frozenblock.wilderwild.config.WWEntityConfig; import net.frozenblock.wilderwild.entity.ai.butterfly.ButterflyAi; -import net.frozenblock.wilderwild.entity.impl.Bottleable; +import net.frozenblock.wilderwild.entity.impl.WWBottleable; import net.frozenblock.wilderwild.entity.variant.butterfly.ButterflyVariant; import net.frozenblock.wilderwild.entity.variant.butterfly.ButterflyVariants; import net.frozenblock.wilderwild.item.MobBottleItem; @@ -57,6 +57,7 @@ import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -82,7 +83,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class Butterfly extends PathfinderMob implements FlyingAnimal, Bottleable { +public class Butterfly extends PathfinderMob implements FlyingAnimal, WWBottleable, VariantHolder { public static final int TICKS_PER_FLAP = 3; public static final int SPAWN_CHANCE = 50; private static final double SPAWN_RADIUS_CHECK_DISTANCE = 20D; @@ -204,7 +205,7 @@ public void onSyncedDataUpdated(EntityDataAccessor entityDataAccessor) { @Override @NotNull protected InteractionResult mobInteract(@NotNull Player player, @NotNull InteractionHand hand) { - return Bottleable.bottleMobPickup(player, hand, this).orElse(super.mobInteract(player, hand)); + return WWBottleable.bottleMobPickup(player, hand, this).orElse(super.mobInteract(player, hand)); } @Override @@ -225,18 +226,18 @@ protected Brain makeBrain(@NotNull Dynamic dynamic) { } @Override - public boolean fromBottle() { + public boolean wilderWild$fromBottle() { return this.entityData.get(FROM_BOTTLE); } @Override - public void setFromBottle(boolean value) { + public void wilderWild$setFromBottle(boolean value) { this.entityData.set(FROM_BOTTLE, value); } @Override - public void saveToBottleTag(ItemStack itemStack) { - Bottleable.saveDefaultDataToBottleTag(this, itemStack); + public void wilderWild$saveToBottleTag(ItemStack itemStack) { + WWBottleable.saveDefaultDataToBottleTag(this, itemStack); CustomData.update( WWDataComponents.BOTTLE_ENTITY_DATA, @@ -246,8 +247,8 @@ public void saveToBottleTag(ItemStack itemStack) { } @Override - public void loadFromBottleTag(CompoundTag compoundTag) { - Bottleable.loadDefaultDataFromBottleTag(this, compoundTag); + public void wilderWild$loadFromBottleTag(CompoundTag compoundTag) { + WWBottleable.loadDefaultDataFromBottleTag(this, compoundTag); if (compoundTag.contains(MobBottleItem.BUTTERFLY_BOTTLE_VARIANT_FIELD)) { Optional.ofNullable(ResourceLocation.tryParse(compoundTag.getString(MobBottleItem.BUTTERFLY_BOTTLE_VARIANT_FIELD))) .map(resourceLocation -> ResourceKey.create(WilderWildRegistries.BUTTERFLY_VARIANT, resourceLocation)) @@ -257,21 +258,21 @@ public void loadFromBottleTag(CompoundTag compoundTag) { } @Override - public void onCapture() { + public void wilderWild$onCapture() { } @Override - public void onBottleRelease() { + public void wilderWild$onBottleRelease() { ButterflyAi.rememberHome(this, this.blockPosition()); } @Override - public ItemStack getBottleItemStack() { + public ItemStack wilderWild$getBottleItemStack() { return new ItemStack(WWItems.BUTTERFLY_BOTTLE); } @Override - public SoundEvent getBottleCatchSound() { + public SoundEvent wilderWild$getBottleCatchSound() { return WWSounds.ITEM_BOTTLE_CATCH_BUTTERFLY; } @@ -295,17 +296,23 @@ public ButterflyVariant getVariantForRendering() { return this.butterflyVariant.orElse(this.registryAccess().registryOrThrow(WilderWildRegistries.BUTTERFLY_VARIANT).get(ButterflyVariants.DEFAULT)); } + @Override public void setVariant(@NotNull ButterflyVariant variant) { this.entityData.set(VARIANT, Objects.requireNonNull(this.registryAccess().registryOrThrow(WilderWildRegistries.BUTTERFLY_VARIANT).getKey(variant)).toString()); } + @Override + public @NotNull ButterflyVariant getVariant() { + return this.getVariantByLocation(); + } + public void setVariant(@NotNull ResourceLocation variant) { this.entityData.set(VARIANT, variant.toString()); } @Override public boolean requiresCustomPersistence() { - return super.requiresCustomPersistence() || this.fromBottle(); + return super.requiresCustomPersistence() || this.wilderWild$fromBottle(); } @Override @@ -412,14 +419,14 @@ public boolean isFlapping() { @Override public boolean removeWhenFarAway(double distanceToClosestPlayer) { - return !this.fromBottle() && !this.hasCustomName(); + return !this.wilderWild$fromBottle() && !this.hasCustomName(); } @Override public void addAdditionalSaveData(@NotNull CompoundTag compoundTag) { super.addAdditionalSaveData(compoundTag); compoundTag.putString("variant", this.getVariantLocation().toString()); - compoundTag.putBoolean("fromBottle", this.fromBottle()); + compoundTag.putBoolean("fromBottle", this.wilderWild$fromBottle()); } @Override @@ -429,7 +436,7 @@ public void readAdditionalSaveData(@NotNull CompoundTag compoundTag) { .map(resourceLocation -> ResourceKey.create(WilderWildRegistries.BUTTERFLY_VARIANT, resourceLocation)) .flatMap(resourceKey -> this.registryAccess().registryOrThrow(WilderWildRegistries.BUTTERFLY_VARIANT).getHolder(resourceKey)) .ifPresent(reference -> this.setVariant(reference.value())); - if (compoundTag.contains("fromBottle")) this.setFromBottle(compoundTag.getBoolean("fromBottle")); + if (compoundTag.contains("fromBottle")) this.wilderWild$setFromBottle(compoundTag.getBoolean("fromBottle")); } @Override diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java index 858de05393..da85ba86d8 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Crab.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Crab.java @@ -85,6 +85,7 @@ import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; @@ -118,7 +119,7 @@ import org.jetbrains.annotations.Nullable; import org.joml.Math; -public class Crab extends Animal implements VibrationSystem, Bucketable { +public class Crab extends Animal implements VibrationSystem, Bucketable, VariantHolder { public static final float MAX_TARGET_DISTANCE = 16F; public static final double MOVEMENT_SPEED = 0.16; public static final float STEP_HEIGHT = 0.2F; @@ -821,10 +822,16 @@ public CrabVariant getVariantForRendering() { return this.crabVariant.orElse(this.registryAccess().registryOrThrow(WilderWildRegistries.CRAB_VARIANT).get(CrabVariants.DEFAULT)); } + @Override public void setVariant(@NotNull CrabVariant variant) { this.entityData.set(VARIANT, Objects.requireNonNull(this.registryAccess().registryOrThrow(WilderWildRegistries.CRAB_VARIANT).getKey(variant)).toString()); } + @Override + public @NotNull CrabVariant getVariant() { + return this.getVariantByLocation(); + } + public void setVariant(@NotNull ResourceLocation variant) { this.entityData.set(VARIANT, variant.toString()); } diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java b/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java index 680ebc29a0..8ef909292c 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java @@ -24,7 +24,7 @@ import net.frozenblock.lib.wind.api.WindManager; import net.frozenblock.wilderwild.config.WWEntityConfig; import net.frozenblock.wilderwild.entity.ai.firefly.FireflyAi; -import net.frozenblock.wilderwild.entity.impl.Bottleable; +import net.frozenblock.wilderwild.entity.impl.WWBottleable; import net.frozenblock.wilderwild.entity.variant.firefly.FireflyColor; import net.frozenblock.wilderwild.entity.variant.firefly.FireflyColors; import net.frozenblock.wilderwild.item.MobBottleItem; @@ -56,6 +56,7 @@ import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -79,7 +80,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class Firefly extends PathfinderMob implements FlyingAnimal, Bottleable { +public class Firefly extends PathfinderMob implements FlyingAnimal, WWBottleable, VariantHolder { public static final int RANDOM_FLICKER_AGE_MAX = 19; private static final EntityDataAccessor FROM_BOTTLE = SynchedEntityData.defineId(Firefly.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor AGE = SynchedEntityData.defineId(Firefly.class, EntityDataSerializers.INT); @@ -192,7 +193,7 @@ public boolean dampensVibrations() { @Override @NotNull protected InteractionResult mobInteract(@NotNull Player player, @NotNull InteractionHand hand) { - return Bottleable.bottleMobPickup(player, hand, this).orElse(super.mobInteract(player, hand)); + return WWBottleable.bottleMobPickup(player, hand, this).orElse(super.mobInteract(player, hand)); } @Override @@ -218,17 +219,17 @@ protected Brain makeBrain(@NotNull Dynamic dynamic) { } @Override - public boolean fromBottle() { + public boolean wilderWild$fromBottle() { return this.entityData.get(FROM_BOTTLE); } @Override - public void setFromBottle(boolean value) { + public void wilderWild$setFromBottle(boolean value) { this.entityData.set(FROM_BOTTLE, value); } @Override - public void saveToBottleTag(ItemStack itemStack) { + public void wilderWild$saveToBottleTag(ItemStack itemStack) { CompoundTag tag = new CompoundTag(); tag.putString(MobBottleItem.FIREFLY_BOTTLE_VARIANT_FIELD, this.getColorLocation().toString()); CustomData.set( @@ -239,7 +240,7 @@ public void saveToBottleTag(ItemStack itemStack) { } @Override - public void loadFromBottleTag(@NotNull CompoundTag compoundTag) { + public void wilderWild$loadFromBottleTag(@NotNull CompoundTag compoundTag) { if (compoundTag.contains(MobBottleItem.FIREFLY_BOTTLE_VARIANT_FIELD)) { Optional.ofNullable(ResourceLocation.tryParse(compoundTag.getString(MobBottleItem.FIREFLY_BOTTLE_VARIANT_FIELD))) .map(resourceLocation -> ResourceKey.create(WilderWildRegistries.FIREFLY_COLOR, resourceLocation)) @@ -249,24 +250,24 @@ public void loadFromBottleTag(@NotNull CompoundTag compoundTag) { } @Override - public void onCapture() { + public void wilderWild$onCapture() { if (this.isSwarmLeader()) { FireflyAi.transferLeadershipToRandomFirefly(this); } } @Override - public void onBottleRelease() { + public void wilderWild$onBottleRelease() { FireflyAi.rememberHome(this, this.blockPosition()); } @Override - public ItemStack getBottleItemStack() { + public ItemStack wilderWild$getBottleItemStack() { return new ItemStack(WWItems.FIREFLY_BOTTLE); } @Override - public SoundEvent getBottleCatchSound() { + public SoundEvent wilderWild$getBottleCatchSound() { return WWSounds.ITEM_BOTTLE_CATCH_FIREFLY; } @@ -324,7 +325,7 @@ public void setColor(@NotNull ResourceLocation color) { @Override public boolean requiresCustomPersistence() { - return super.requiresCustomPersistence() || this.fromBottle(); + return super.requiresCustomPersistence() || this.wilderWild$fromBottle(); } @Override @@ -453,7 +454,7 @@ public boolean isFlapping() { @Override public boolean removeWhenFarAway(double distanceToClosestPlayer) { - return !this.fromBottle() && !this.hasCustomName(); + return !this.wilderWild$fromBottle() && !this.hasCustomName(); } @Override @@ -472,7 +473,7 @@ public void addAdditionalSaveData(@NotNull CompoundTag compoundTag) { .unwrapKey() .ifPresent(resourceKey -> compoundTag.putString("color", resourceKey.location().toString())); - compoundTag.putBoolean("fromBottle", this.fromBottle()); + compoundTag.putBoolean("fromBottle", this.wilderWild$fromBottle()); compoundTag.putInt("flickerAge", this.getFlickerAge()); compoundTag.putFloat("scale", this.getAnimScale()); compoundTag.putFloat("prevScale", this.getPrevAnimScale()); @@ -487,7 +488,7 @@ public void readAdditionalSaveData(@NotNull CompoundTag compoundTag) { .flatMap(resourceKey -> this.registryAccess().registryOrThrow(WilderWildRegistries.FIREFLY_COLOR).getHolder(resourceKey)) .ifPresent(reference -> this.setColor(reference.value())); - if (compoundTag.contains("fromBottle")) this.setFromBottle(compoundTag.getBoolean("fromBottle")); + if (compoundTag.contains("fromBottle")) this.wilderWild$setFromBottle(compoundTag.getBoolean("fromBottle")); if (compoundTag.contains("flickerAge")) this.setFlickerAge(compoundTag.getInt("flickerAge")); if (compoundTag.contains("scale")) this.setAnimScale(compoundTag.getFloat("scale")); if (compoundTag.contains("prevScale")) this.setPrevAnimScale(compoundTag.getFloat("prevScale")); @@ -522,6 +523,16 @@ protected void doPush(@NotNull Entity entity) { protected void pushEntities() { } + @Override + public void setVariant(FireflyColor color) { + this.setColor(color); + } + + @Override + public @NotNull FireflyColor getVariant() { + return this.getColorByLocation(); + } + public static class FireflySpawnGroupData implements SpawnGroupData { public final Holder color; diff --git a/src/main/java/net/frozenblock/wilderwild/entity/FlowerCow.java b/src/main/java/net/frozenblock/wilderwild/entity/FlowerCow.java index dbc756a782..0cadbfee70 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/FlowerCow.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/FlowerCow.java @@ -51,6 +51,7 @@ import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.Shearable; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; @@ -71,7 +72,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class FlowerCow extends Cow implements Shearable { +public class FlowerCow extends Cow implements Shearable, VariantHolder { public static final int MAX_FLOWERS = 4; private static final byte GROW_FLOWER_EVENT_ID = 61; private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(FlowerCow.class, EntityDataSerializers.STRING); @@ -236,10 +237,16 @@ public MoobloomVariant getVariantForRendering() { return this.moobloomVariant.orElse(this.registryAccess().registryOrThrow(WilderWildRegistries.MOOBLOOM_VARIANT).get(MoobloomVariants.DEFAULT)); } + @Override public void setVariant(@NotNull MoobloomVariant variant) { this.entityData.set(VARIANT, Objects.requireNonNull(this.registryAccess().registryOrThrow(WilderWildRegistries.MOOBLOOM_VARIANT).getKey(variant)).toString()); } + @Override + public @NotNull MoobloomVariant getVariant() { + return this.getVariantByLocation(); + } + public void setVariant(@NotNull ResourceLocation variant) { this.entityData.set(VARIANT, variant.toString()); } diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Jellyfish.java b/src/main/java/net/frozenblock/wilderwild/entity/Jellyfish.java index 1171566c33..ac4ebf0fed 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Jellyfish.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Jellyfish.java @@ -74,6 +74,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.VariantHolder; import net.minecraft.world.entity.ai.Brain; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; @@ -102,7 +103,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class Jellyfish extends NoFlopAbstractFish { +public class Jellyfish extends NoFlopAbstractFish implements VariantHolder { private static final float MAX_TARGET_DISTANCE = 4F; public static final int POISON_DURATION_IN_SECONDS_BABY = 4; public static final int POISON_DURATION_IN_SECONDS = 10; @@ -650,10 +651,16 @@ public JellyfishVariant getVariantForRendering() { return this.jellyfishVariant.orElse(this.registryAccess().registryOrThrow(WilderWildRegistries.JELLYFISH_VARIANT).get(JellyfishVariants.DEFAULT)); } + @Override public void setVariant(@NotNull JellyfishVariant variant) { this.entityData.set(VARIANT, Objects.requireNonNull(this.registryAccess().registryOrThrow(WilderWildRegistries.JELLYFISH_VARIANT).getKey(variant)).toString()); } + @Override + public @NotNull JellyfishVariant getVariant() { + return this.getVariantByLocation(); + } + public void setVariant(@NotNull ResourceLocation variant) { this.entityData.set(VARIANT, variant.toString()); } diff --git a/src/main/java/net/frozenblock/wilderwild/entity/impl/Bottleable.java b/src/main/java/net/frozenblock/wilderwild/entity/impl/WWBottleable.java similarity index 80% rename from src/main/java/net/frozenblock/wilderwild/entity/impl/Bottleable.java rename to src/main/java/net/frozenblock/wilderwild/entity/impl/WWBottleable.java index 82aa6e82d7..4904f638fb 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/impl/Bottleable.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/impl/WWBottleable.java @@ -36,22 +36,22 @@ import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; -public interface Bottleable { - boolean fromBottle(); +public interface WWBottleable { + boolean wilderWild$fromBottle(); - void setFromBottle(boolean bl); + void wilderWild$setFromBottle(boolean bl); - void saveToBottleTag(ItemStack itemStack); + void wilderWild$saveToBottleTag(ItemStack itemStack); - void loadFromBottleTag(CompoundTag compoundTag); + void wilderWild$loadFromBottleTag(CompoundTag compoundTag); - void onCapture(); + void wilderWild$onCapture(); - void onBottleRelease(); + void wilderWild$onBottleRelease(); - ItemStack getBottleItemStack(); + ItemStack wilderWild$getBottleItemStack(); - SoundEvent getBottleCatchSound(); + SoundEvent wilderWild$getBottleCatchSound(); @Deprecated static void saveDefaultDataToBottleTag(@NotNull Mob mob, @NotNull ItemStack itemStack) { @@ -76,13 +76,13 @@ static void loadDefaultDataFromBottleTag(Mob mob, @NotNull CompoundTag compoundT if (compoundTag.contains("Health", 99)) mob.setHealth(compoundTag.getFloat("Health")); } - static Optional bottleMobPickup(@NotNull Player player, InteractionHand interactionHand, T livingEntity) { + static Optional bottleMobPickup(@NotNull Player player, InteractionHand interactionHand, T livingEntity) { ItemStack itemStack = player.getItemInHand(interactionHand); if (itemStack.getItem() == Items.GLASS_BOTTLE && livingEntity.isAlive()) { - livingEntity.onCapture(); - livingEntity.playSound(livingEntity.getBottleCatchSound(), 1F, player.getRandom().nextFloat() * 0.2F + 0.8F); - ItemStack bottleStack = livingEntity.getBottleItemStack(); - livingEntity.saveToBottleTag(bottleStack); + livingEntity.wilderWild$onCapture(); + livingEntity.playSound(livingEntity.wilderWild$getBottleCatchSound(), 1F, player.getRandom().nextFloat() * 0.2F + 0.8F); + ItemStack bottleStack = livingEntity.wilderWild$getBottleItemStack(); + livingEntity.wilderWild$saveToBottleTag(bottleStack); Level level = livingEntity.level(); if (!level.isClientSide) WWCriteria.MOB_BOTTLE.trigger((ServerPlayer)player, bottleStack); diff --git a/src/main/java/net/frozenblock/wilderwild/item/MobBottleItem.java b/src/main/java/net/frozenblock/wilderwild/item/MobBottleItem.java index 39479635b0..7afad1dddc 100644 --- a/src/main/java/net/frozenblock/wilderwild/item/MobBottleItem.java +++ b/src/main/java/net/frozenblock/wilderwild/item/MobBottleItem.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Optional; import net.frozenblock.wilderwild.WWConstants; -import net.frozenblock.wilderwild.entity.impl.Bottleable; +import net.frozenblock.wilderwild.entity.impl.WWBottleable; import net.frozenblock.wilderwild.entity.variant.firefly.FireflyColors; import net.frozenblock.wilderwild.registry.WWDataComponents; import net.frozenblock.wilderwild.registry.WWEntityTypes; @@ -82,11 +82,11 @@ public InteractionResultHolder use(@NotNull Level level, @NotNull Pla entity.moveTo(player.getX(), player.getEyeY(), player.getZ(), player.getXRot(), player.getYRot()); boolean spawned = server.addFreshEntity(entity); if (spawned) { - if (entity instanceof Bottleable bottleable) { + if (entity instanceof WWBottleable bottleable) { CustomData customData = stack.getOrDefault(WWDataComponents.BOTTLE_ENTITY_DATA, CustomData.EMPTY); - bottleable.loadFromBottleTag(customData.copyTag()); - bottleable.setFromBottle(true); - bottleable.onBottleRelease(); + bottleable.wilderWild$loadFromBottleTag(customData.copyTag()); + bottleable.wilderWild$setFromBottle(true); + bottleable.wilderWild$onBottleRelease(); } if (!player.getAbilities().instabuild) player.setItemInHand(interactionHand, ItemUtils.createFilledResult(stack, player, new ItemStack(Items.GLASS_BOTTLE)));