diff --git a/Fabric/src/main/java/vazkii/botania/fabric/block/FabricSpecialFlowerBlock.java b/Fabric/src/main/java/vazkii/botania/fabric/block/FabricSpecialFlowerBlock.java index 1916f7e06a..5e420e4602 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/block/FabricSpecialFlowerBlock.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/block/FabricSpecialFlowerBlock.java @@ -9,6 +9,7 @@ package vazkii.botania.fabric.block; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.util.RandomSource; import net.minecraft.world.effect.MobEffect; @@ -43,7 +44,7 @@ public class FabricSpecialFlowerBlock extends FlowerBlock implements EntityBlock private static final VoxelShape SHAPE = box(4.8, 0, 4.8, 12.8, 16, 12.8); private final Supplier> blockEntityType; - public FabricSpecialFlowerBlock(MobEffect stewEffect, int stewDuration, Properties props, Supplier> blockEntityType) { + public FabricSpecialFlowerBlock(Holder stewEffect, int stewDuration, Properties props, Supplier> blockEntityType) { super(stewEffect, stewDuration, props); this.blockEntityType = blockEntityType; } diff --git a/Fabric/src/main/java/vazkii/botania/fabric/xplat/FabricXplatImpl.java b/Fabric/src/main/java/vazkii/botania/fabric/xplat/FabricXplatImpl.java index 980399bc58..e95f73b660 100644 --- a/Fabric/src/main/java/vazkii/botania/fabric/xplat/FabricXplatImpl.java +++ b/Fabric/src/main/java/vazkii/botania/fabric/xplat/FabricXplatImpl.java @@ -29,6 +29,7 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.core.registries.Registries; import net.minecraft.network.FriendlyByteBuf; @@ -460,7 +461,7 @@ public boolean isSpecialFlowerBlock(Block b) { } @Override - public FlowerBlock createSpecialFlowerBlock(MobEffect effect, int effectDuration, BlockBehaviour.Properties props, Supplier> beType) { + public FlowerBlock createSpecialFlowerBlock(Holder effect, int effectDuration, BlockBehaviour.Properties props, Supplier> beType) { return new FabricSpecialFlowerBlock(effect, effectDuration, props, beType); } diff --git a/NeoForge/src/main/java/vazkii/botania/forge/block/ForgeSpecialFlowerBlock.java b/NeoForge/src/main/java/vazkii/botania/forge/block/ForgeSpecialFlowerBlock.java index b814486343..7ed5e88b78 100644 --- a/NeoForge/src/main/java/vazkii/botania/forge/block/ForgeSpecialFlowerBlock.java +++ b/NeoForge/src/main/java/vazkii/botania/forge/block/ForgeSpecialFlowerBlock.java @@ -1,6 +1,7 @@ package vazkii.botania.forge.block; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.util.RandomSource; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.LivingEntity; @@ -33,10 +34,11 @@ public class ForgeSpecialFlowerBlock extends FlowerBlock implements EntityBlock private static final VoxelShape SHAPE = box(4.8, 0, 4.8, 12.8, 16, 12.8); private final Supplier> blockEntityType; - public ForgeSpecialFlowerBlock(MobEffect stewEffect, int stewDuration, Properties props, Supplier> blockEntityType) { + public ForgeSpecialFlowerBlock(Holder stewEffect, int stewDuration, Properties props, Supplier> blockEntityType) { super(/* the only godforsaken reason why this class needs to be duplicated for each loader is so that we can add a "() ->" here. Amazing. */ - () -> stewEffect, stewDuration, props); + // TODO: I think we can remove this now, the superclass is no longer patched + stewEffect, stewDuration, props); this.blockEntityType = blockEntityType; } diff --git a/NeoForge/src/main/java/vazkii/botania/forge/xplat/ForgeXplatImpl.java b/NeoForge/src/main/java/vazkii/botania/forge/xplat/ForgeXplatImpl.java index e51d97884b..c100e2fb10 100644 --- a/NeoForge/src/main/java/vazkii/botania/forge/xplat/ForgeXplatImpl.java +++ b/NeoForge/src/main/java/vazkii/botania/forge/xplat/ForgeXplatImpl.java @@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; @@ -435,9 +436,9 @@ public boolean isSpecialFlowerBlock(Block b) { } @Override - public FlowerBlock createSpecialFlowerBlock(MobEffect effect, int effectDuration, - BlockBehaviour.Properties props, - Supplier> beType) { + public FlowerBlock createSpecialFlowerBlock(Holder effect, int effectDuration, + BlockBehaviour.Properties props, + Supplier> beType) { return new ForgeSpecialFlowerBlock(effect, effectDuration, props, beType); } diff --git a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumMobEffectToApply.java b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumMobEffectToApply.java index cc5e9c118f..f3b19e0741 100644 --- a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumMobEffectToApply.java +++ b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumMobEffectToApply.java @@ -3,6 +3,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.effect.MobEffect; @@ -15,7 +16,7 @@ public class LooniumMobEffectToApply { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - BuiltInRegistries.MOB_EFFECT.byNameCodec().fieldOf("effect").forGetter(me -> me.effect), + BuiltInRegistries.MOB_EFFECT.holderByNameCodec().fieldOf("effect").forGetter(me -> me.effect), ExtraCodecs.POSITIVE_INT.optionalFieldOf("duration", MobEffectInstance.INFINITE_DURATION) .forGetter(me -> me.duration), Codec.intRange(0, 255).optionalFieldOf("amplifier", 0) @@ -23,17 +24,17 @@ public class LooniumMobEffectToApply { ).apply(instance, LooniumMobEffectToApply::new) ); - private final MobEffect effect; + private final Holder effect; private final int duration; private final int amplifier; - private LooniumMobEffectToApply(MobEffect effect, int duration, int amplifier) { + private LooniumMobEffectToApply(Holder effect, int duration, int amplifier) { this.effect = effect; this.duration = duration; this.amplifier = amplifier; } - public static Builder effect(MobEffect effect) { + public static Builder effect(Holder effect) { return new Builder(effect); } @@ -51,7 +52,7 @@ public String toString() { '}'; } - public MobEffect getEffect() { + public Holder getEffect() { return effect; } @@ -78,11 +79,11 @@ public int hashCode() { } public static class Builder { - private final MobEffect effect; + private final Holder effect; private int duration = MobEffectInstance.INFINITE_DURATION; private int amplifier = 0; - private Builder(MobEffect effect) { + private Builder(Holder effect) { this.effect = effect; } diff --git a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java index 22235279ff..52439e50ff 100644 --- a/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java +++ b/Xplat/src/main/java/vazkii/botania/api/configdata/LooniumStructureConfiguration.java @@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.random.WeightedRandomList; +import net.minecraft.world.entity.animal.Cod; import net.minecraft.world.level.levelgen.structure.StructureSpawnOverride; import vazkii.botania.api.BotaniaAPI; @@ -16,45 +17,46 @@ import java.util.Optional; import java.util.function.Function; +import static vazkii.botania.common.lib.ResourceLocationHelper.prefix; + public class LooniumStructureConfiguration { public static final int DEFAULT_COST = 35000; public static final int DEFAULT_MAX_NEARBY_MOBS = 10; - public static final Codec CODEC = ExtraCodecs.validate( - RecordCodecBuilder.create( - instance -> instance.group( - ResourceLocation.CODEC.optionalFieldOf("parent") - .forGetter(lsc -> Optional.ofNullable(lsc.parent)), - ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("manaCost") - .forGetter(lsc -> Optional.ofNullable(lsc.manaCost)), - ExtraCodecs.POSITIVE_INT.optionalFieldOf("maxNearbyMobs") - .forGetter(lsc -> Optional.ofNullable(lsc.maxNearbyMobs)), - StructureSpawnOverride.BoundingBoxType.CODEC - .optionalFieldOf("boundingBoxType") - .forGetter(lsc -> Optional.ofNullable(lsc.boundingBoxType)), - WeightedRandomList.codec(LooniumMobSpawnData.CODEC) - .optionalFieldOf("spawnedMobs") - .forGetter(lsc -> Optional.ofNullable(lsc.spawnedMobs)), - Codec.list(LooniumMobAttributeModifier.CODEC) - .optionalFieldOf("attributeModifiers") - .forGetter(lsc -> Optional.ofNullable(lsc.attributeModifiers)), - Codec.list(LooniumMobEffectToApply.CODEC) - .optionalFieldOf("effectsToApply") - .forGetter(lsc -> Optional.ofNullable(lsc.effectsToApply)) - ).apply(instance, LooniumStructureConfiguration::create) - ), lsc -> { - if (lsc.parent == null && (lsc.manaCost == null || lsc.boundingBoxType == null || lsc.spawnedMobs == null)) { - return DataResult.error(() -> "Mana cost, bounding box type, and spawned mobs must be specified if there is no parent configuration"); - } - if (lsc.spawnedMobs != null && lsc.spawnedMobs.isEmpty()) { - return DataResult.error(() -> "Spawned mobs cannot be empty"); - } - if (lsc.manaCost != null && lsc.manaCost > DEFAULT_COST) { - return DataResult.error(() -> "Mana costs above %d are currently not supported" - .formatted(DEFAULT_COST)); - } - return DataResult.success(lsc); - }); - public static final ResourceLocation DEFAULT_CONFIG_ID = new ResourceLocation(BotaniaAPI.MODID, "default"); + public static final Codec CODEC = RecordCodecBuilder.create( + instance -> instance.group( + ResourceLocation.CODEC.optionalFieldOf("parent") + .forGetter(lsc -> Optional.ofNullable(lsc.parent)), + ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("manaCost") + .forGetter(lsc -> Optional.ofNullable(lsc.manaCost)), + ExtraCodecs.POSITIVE_INT.optionalFieldOf("maxNearbyMobs") + .forGetter(lsc -> Optional.ofNullable(lsc.maxNearbyMobs)), + StructureSpawnOverride.BoundingBoxType.CODEC + .optionalFieldOf("boundingBoxType") + .forGetter(lsc -> Optional.ofNullable(lsc.boundingBoxType)), + WeightedRandomList.codec(LooniumMobSpawnData.CODEC) + .optionalFieldOf("spawnedMobs") + .forGetter(lsc -> Optional.ofNullable(lsc.spawnedMobs)), + Codec.list(LooniumMobAttributeModifier.CODEC) + .optionalFieldOf("attributeModifiers") + .forGetter(lsc -> Optional.ofNullable(lsc.attributeModifiers)), + Codec.list(LooniumMobEffectToApply.CODEC) + .optionalFieldOf("effectsToApply") + .forGetter(lsc -> Optional.ofNullable(lsc.effectsToApply)) + ).apply(instance, LooniumStructureConfiguration::create) + ).validate(lsc -> { + if (lsc.parent == null && (lsc.manaCost == null || lsc.boundingBoxType == null || lsc.spawnedMobs == null)) { + return DataResult.error(() -> "Mana cost, bounding box type, and spawned mobs must be specified if there is no parent configuration"); + } + if (lsc.spawnedMobs != null && lsc.spawnedMobs.isEmpty()) { + return DataResult.error(() -> "Spawned mobs cannot be empty"); + } + if (lsc.manaCost != null && lsc.manaCost > DEFAULT_COST) { + return DataResult.error(() -> "Mana costs above %d are currently not supported" + .formatted(DEFAULT_COST)); + } + return DataResult.success(lsc); + }); + public static final ResourceLocation DEFAULT_CONFIG_ID = prefix("default"); public final Integer manaCost; public final Integer maxNearbyMobs; diff --git a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaBlocks.java b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaBlocks.java index da98234e60..f907789736 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaBlocks.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaBlocks.java @@ -1577,14 +1577,7 @@ protected ItemStack execute(@NotNull BlockSource source, @NotNull ItemStack stac DispenserBlock.registerBehavior(BotaniaItems.corporeaSpark, behavior); DispenserBlock.registerBehavior(BotaniaItems.corporeaSparkMaster, behavior); DispenserBlock.registerBehavior(BotaniaItems.corporeaSparkCreative, behavior); - DispenserBlock.registerBehavior(BotaniaItems.enderAirBottle, new AbstractProjectileDispenseBehavior() { - @NotNull - @Override - protected Projectile getProjectile(@NotNull Level world, @NotNull Position pos, @NotNull ItemStack stack) { - return new EnderAirBottleEntity(pos.x(), pos.y(), pos.z(), world); - } - }); - + DispenserBlock.registerBehavior(BotaniaItems.enderAirBottle, new ProjectileDispenseBehavior(BotaniaItems.enderAirBottle)); behavior = DispenserBlockAccessor.getDispenserRegistry().get(Items.GLASS_BOTTLE); DispenserBlock.registerBehavior(Items.GLASS_BOTTLE, new EnderAirBottlingBehavior(behavior)); @@ -1606,13 +1599,7 @@ protected Projectile getProjectile(@NotNull Level world, @NotNull Position pos, DispenserBlock.registerBehavior(BotaniaItems.manasteelShears, new ShearsDispenseItemBehavior()); DispenserBlock.registerBehavior(BotaniaItems.elementiumShears, new ShearsDispenseItemBehavior()); - DispenserBlock.registerBehavior(BotaniaItems.vineBall, new AbstractProjectileDispenseBehavior() { - @NotNull - @Override - protected Projectile getProjectile(@NotNull Level world, @NotNull Position pos, @NotNull ItemStack stack) { - return new VineBallEntity(pos.x(), pos.y(), pos.z(), world); - } - }); + DispenserBlock.registerBehavior(BotaniaItems.vineBall, new ProjectileDispenseBehavior(BotaniaItems.vineBall)); SeedBehaviors.init(); } diff --git a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlock.java b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlock.java index 5efec1d9f3..80e7368892 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlock.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlock.java @@ -9,6 +9,7 @@ package vazkii.botania.common.block; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.effect.MobEffect; @@ -37,7 +38,7 @@ protected BotaniaFlowerBlock(DyeColor color, Properties builder) { this.color = color; } - private static MobEffect effectForFlower(DyeColor color) { + private static Holder effectForFlower(DyeColor color) { return switch (color) { case WHITE -> MobEffects.MOVEMENT_SPEED; case ORANGE -> MobEffects.FIRE_RESISTANCE; diff --git a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlocks.java b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlocks.java index ab9b307968..0fcc7e1561 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlocks.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/BotaniaFlowerBlocks.java @@ -8,6 +8,7 @@ */ package vazkii.botania.common.block; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; @@ -311,7 +312,7 @@ private static ResourceLocation getId(Block b) { } private static FlowerBlock createSpecialFlowerBlock( - MobEffect effect, int effectDuration, + Holder effect, int effectDuration, BlockBehaviour.Properties props, Supplier> beType) { return XplatAbstractions.INSTANCE.createSpecialFlowerBlock( diff --git a/Xplat/src/main/java/vazkii/botania/common/block/decor/FlowerMotifBlock.java b/Xplat/src/main/java/vazkii/botania/common/block/decor/FlowerMotifBlock.java index 3dc43ba931..d8ef92c8cb 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/decor/FlowerMotifBlock.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/decor/FlowerMotifBlock.java @@ -9,6 +9,7 @@ package vazkii.botania.common.block.decor; import net.minecraft.ChatFormatting; +import net.minecraft.core.Holder; import net.minecraft.network.chat.Component; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.item.CreativeModeTab; @@ -27,7 +28,7 @@ public class FlowerMotifBlock extends FlowerBlock implements CustomCreativeTabContents { private final boolean hidden; - public FlowerMotifBlock(MobEffect effect, int effectDuration, Properties properties, boolean hidden) { + public FlowerMotifBlock(Holder effect, int effectDuration, Properties properties, boolean hidden) { super(effect, effectDuration, properties); this.hidden = hidden; } diff --git a/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java b/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java index e6ba74fd9f..f4f9fe3cce 100644 --- a/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/block/flower/functional/LooniumBlockEntity.java @@ -259,7 +259,7 @@ private void spawnMob(ServerLevel world, LooniumMobSpawnData pickedMobType, looniumComponent.setDrop(lootStack); } - mob.finalizeSpawn(world, world.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.SPAWNER, null, null); + mob.finalizeSpawn(world, world.getCurrentDifficultyAt(mob.blockPosition()), MobSpawnType.SPAWNER, null); if (Boolean.FALSE.equals(pickedMobType.spawnAsBaby) && mob.isBaby()) { // Note: might have already affected initial equipment/attribute selection, or even caused a special // mob configuration (such as chicken jockey) to spawn, which may look weird when reverting to adult. @@ -278,7 +278,7 @@ private void spawnMob(ServerLevel world, LooniumMobSpawnData pickedMobType, equipmentTable.getRandomItems(lootParams, equipmentStack -> { EquipmentSlot slot = equipmentStack.is(BotaniaTags.Items.LOONIUM_OFFHAND_EQUIPMENT) ? EquipmentSlot.OFFHAND - : LivingEntity.getEquipmentSlotForItem(equipmentStack); + : mob.getEquipmentSlotForItem(equipmentStack); if (equippedSlots.contains(slot)) { slot = equippedSlots.contains(EquipmentSlot.MAINHAND) && !(equipmentStack.getItem() instanceof TieredItem) diff --git a/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java b/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java index 8a1403b1c6..ca9674f6b7 100644 --- a/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java +++ b/Xplat/src/main/java/vazkii/botania/common/entity/GaiaGuardianEntity.java @@ -17,6 +17,7 @@ import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; import net.minecraft.client.resources.sounds.SoundInstance; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; @@ -267,7 +268,7 @@ public static boolean spawn(Player player, ItemStack stack, Level world, BlockPo } e.playSound(BotaniaSounds.gaiaSummon, 1F, 1F); - e.finalizeSpawn((ServerLevelAccessor) world, world.getCurrentDifficultyAt(e.blockPosition()), MobSpawnType.EVENT, null, null); + e.finalizeSpawn((ServerLevelAccessor) world, world.getCurrentDifficultyAt(e.blockPosition()), MobSpawnType.EVENT, null); world.addFreshEntity(e); for (Player nearbyPlayer : playersAround) { @@ -661,9 +662,9 @@ private void smashBlocksAround(int centerX, int centerY, int centerZ, int radius } private void clearPotions(Player player) { - Set effectsToRemove = new HashSet<>(); + Set> effectsToRemove = new HashSet<>(); for (var effectInstance : player.getActiveEffects()) { - if (effectInstance.getDuration() < 160 && effectInstance.isAmbient() && effectInstance.getEffect().getCategory() != MobEffectCategory.HARMFUL) { + if (effectInstance.getDuration() < 160 && effectInstance.isAmbient() && effectInstance.getEffect().value().getCategory() != MobEffectCategory.HARMFUL) { effectsToRemove.add(effectInstance.getEffect()); } } @@ -709,7 +710,7 @@ private void spawnMobs(List players) { pixie.setProps(players.get(random.nextInt(players.size())), this, 1, 8); pixie.setPos(getX() + getBbWidth() / 2, getY() + 2, getZ() + getBbWidth() / 2); pixie.finalizeSpawn((ServerLevelAccessor) level(), level().getCurrentDifficultyAt(pixie.blockPosition()), - MobSpawnType.MOB_SUMMONED, null, null); + MobSpawnType.MOB_SUMMONED, null); level().addFreshEntity(pixie); } } @@ -726,7 +727,7 @@ private void spawnMobs(List players) { entity.setPos(getX() + 0.5 + Math.random() * range - range / 2, getY() - 1, getZ() + 0.5 + Math.random() * range - range / 2); entity.finalizeSpawn((ServerLevelAccessor) level(), level().getCurrentDifficultyAt(entity.blockPosition()), - MobSpawnType.MOB_SUMMONED, null, null); + MobSpawnType.MOB_SUMMONED, null); if (entity instanceof WitherSkeleton && hardMode) { entity.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(BotaniaItems.elementiumSword)); } @@ -861,7 +862,7 @@ public void aiStep() { pixie.setProps(players.get(random.nextInt(players.size())), this, 1, 8); pixie.setPos(getX() + getBbWidth() / 2, getY() + 2, getZ() + getBbWidth() / 2); pixie.finalizeSpawn((ServerLevelAccessor) level(), level().getCurrentDifficultyAt(pixie.blockPosition()), - MobSpawnType.MOB_SUMMONED, null, null); + MobSpawnType.MOB_SUMMONED, null); level().addFreshEntity(pixie); } } diff --git a/Xplat/src/main/java/vazkii/botania/common/handler/PixieHandler.java b/Xplat/src/main/java/vazkii/botania/common/handler/PixieHandler.java index e04fbff310..4aa9dc4e51 100644 --- a/Xplat/src/main/java/vazkii/botania/common/handler/PixieHandler.java +++ b/Xplat/src/main/java/vazkii/botania/common/handler/PixieHandler.java @@ -89,7 +89,7 @@ public static void onDamageTaken(Player player, DamageSource source) { pixie.setProps(livingSource, player, 0, dmg); pixie.finalizeSpawn((ServerLevelAccessor) player.level(), player.level().getCurrentDifficultyAt(pixie.blockPosition()), - MobSpawnType.EVENT, null, null); + MobSpawnType.EVENT, null); player.level().addFreshEntity(pixie); } } diff --git a/Xplat/src/main/java/vazkii/botania/common/item/brew/BaseBrewItem.java b/Xplat/src/main/java/vazkii/botania/common/item/brew/BaseBrewItem.java index 596d96efbc..61feaed5c1 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/brew/BaseBrewItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/brew/BaseBrewItem.java @@ -76,8 +76,8 @@ public ItemStack finishUsingItem(@NotNull ItemStack stack, Level world, LivingEn if (!world.isClientSide) { for (MobEffectInstance effect : getBrew(stack).getPotionEffects(stack)) { MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), effect.getDuration(), effect.getAmplifier(), true, true); - if (effect.getEffect().isInstantenous()) { - effect.getEffect().applyInstantenousEffect(living, living, living, newEffect.getAmplifier(), 1F); + if (effect.getEffect().value().isInstantenous()) { + effect.getEffect().value().applyInstantenousEffect(living, living, living, newEffect.getAmplifier(), 1F); } else { living.addEffect(newEffect); } diff --git a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/RingOfChordataItem.java b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/RingOfChordataItem.java index 0983cfeafb..ab1d144e64 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/RingOfChordataItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/RingOfChordataItem.java @@ -8,6 +8,7 @@ */ package vazkii.botania.common.item.equipment.bauble; +import net.minecraft.core.Holder; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -49,7 +50,7 @@ public void onWornTick(ItemStack stack, LivingEntity living) { } } - private static void addEffect(LivingEntity living, MobEffect effect) { + private static void addEffect(LivingEntity living, Holder effect) { MobEffectInstance inst = living.getEffect(effect); if (inst == null || (inst.getAmplifier() == 0 && inst.getDuration() == 1)) { MobEffectInstance neweffect = new MobEffectInstance(effect, 100, 0, true, true); diff --git a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/TaintedBloodPendantItem.java b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/TaintedBloodPendantItem.java index af0aea5aab..be279c1adc 100644 --- a/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/TaintedBloodPendantItem.java +++ b/Xplat/src/main/java/vazkii/botania/common/item/equipment/bauble/TaintedBloodPendantItem.java @@ -81,7 +81,7 @@ public void appendHoverText(ItemStack stack, Level world, List toolti tooltip.add(Component.translatable("botaniamisc.brewOf", I18n.get(brew.getTranslationKey(stack))).withStyle(ChatFormatting.LIGHT_PURPLE)); for (MobEffectInstance effect : brew.getPotionEffects(stack)) { - ChatFormatting format = effect.getEffect().getCategory().getTooltipFormatting(); + ChatFormatting format = effect.getEffect().value().getCategory().getTooltipFormatting(); MutableComponent cmp = Component.translatable(effect.getDescriptionId()); if (effect.getAmplifier() > 0) { cmp.append(" "); @@ -152,7 +152,7 @@ public static void setBrew(ItemStack stack, ResourceLocation brew) { @Override public ItemStack getItemForBrew(Brew brew, ItemStack stack) { - if (!brew.canInfuseBloodPendant() || brew.getPotionEffects(stack).size() != 1 || brew.getPotionEffects(stack).get(0).getEffect().isInstantenous()) { + if (!brew.canInfuseBloodPendant() || brew.getPotionEffects(stack).size() != 1 || brew.getPotionEffects(stack).get(0).getEffect().value().isInstantenous()) { return ItemStack.EMPTY; } diff --git a/Xplat/src/main/java/vazkii/botania/xplat/XplatAbstractions.java b/Xplat/src/main/java/vazkii/botania/xplat/XplatAbstractions.java index 824143c141..fe0c92bea4 100644 --- a/Xplat/src/main/java/vazkii/botania/xplat/XplatAbstractions.java +++ b/Xplat/src/main/java/vazkii/botania/xplat/XplatAbstractions.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.Holder; import net.minecraft.core.NonNullList; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.Packet; @@ -164,9 +165,9 @@ default ManaReceiver findManaReceiver(Level level, BlockPos pos, @Nullable Direc // Registrations boolean isSpecialFlowerBlock(Block b); - FlowerBlock createSpecialFlowerBlock(MobEffect effect, int effectDuration, - BlockBehaviour.Properties props, - Supplier> beType); + FlowerBlock createSpecialFlowerBlock(Holder effect, int effectDuration, + BlockBehaviour.Properties props, + Supplier> beType); BlockEntityType createBlockEntityType(BiFunction func, Block... blocks); void registerReloadListener(PackType type, ResourceLocation id, PreparableReloadListener listener); Item.Properties defaultItemBuilder();