Skip to content

Commit

Permalink
Replace more magic numbers with constants
Browse files Browse the repository at this point in the history
  • Loading branch information
altrisi committed Sep 27, 2023
1 parent bb5603e commit 86bb475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit 86bb475

Please sign in to comment.