From 8cb37c6410f366c9cffddd61111811524e27a1b4 Mon Sep 17 00:00:00 2001 From: altrisi Date: Wed, 27 Sep 2023 18:35:24 +0200 Subject: [PATCH] Replace more magic numbers with constants --- .../dispenser/behaviors/BlazePowderDispenserBehavior.java | 3 ++- .../carpetextra/mixins/NetherWartBlock_fertilizerMixin.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java index 12c5e110..572a3c98 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/BlazePowderDispenserBehavior.java @@ -10,6 +10,7 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPointer; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldEvents; public class BlazePowderDispenserBehavior extends FallibleItemDispenserBehavior { @Override @@ -26,7 +27,7 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { // grow netherwart one stage world.setBlockState(frontBlockPos, frontBlockState.with(NetherWartBlock.AGE, age + 1), Block.NOTIFY_LISTENERS); // green sparkles - world.syncWorldEvent(2005, frontBlockPos, 0); + world.syncWorldEvent(WorldEvents.PLANT_FERTILIZED, frontBlockPos, 0); // decrement item and return stack.decrement(1); diff --git a/src/main/java/carpetextra/mixins/NetherWartBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/NetherWartBlock_fertilizerMixin.java index d883ef07..12cac847 100644 --- a/src/main/java/carpetextra/mixins/NetherWartBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/NetherWartBlock_fertilizerMixin.java @@ -12,6 +12,8 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.WorldEvents; + import org.spongepowered.asm.mixin.Mixin; @Mixin(NetherWartBlock.class) @@ -30,7 +32,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt if (CarpetExtraSettings.blazeMeal && stack.getItem() == Items.BLAZE_POWDER && age < 3) { world.setBlockState(pos, this.getDefaultState().with(NetherWartBlock.AGE, age + 1), 2); - world.syncWorldEvent(2005, pos, 0); + world.syncWorldEvent(WorldEvents.PLANT_FERTILIZED, pos, 0); if (!player.isCreative()) stack.decrement(1); return ActionResult.SUCCESS; }