Fixed sweet berry bushes

This commit is contained in:
Frederik Palmø 2021-10-11 18:18:09 +02:00
parent f849e49e42
commit 55a8fbef43

View file

@ -7,6 +7,7 @@ import net.minecraft.block.CropBlock;
import net.minecraft.block.MelonBlock; import net.minecraft.block.MelonBlock;
import net.minecraft.block.SweetBerryBushBlock; import net.minecraft.block.SweetBerryBushBlock;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.property.Property;
import net.minecraft.tag.BlockTags; import net.minecraft.tag.BlockTags;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -37,9 +38,13 @@ public class Events {
BlockState state = world.getBlockState(hitResult.getBlockPos()); BlockState state = world.getBlockState(hitResult.getBlockPos());
if (state.getBlock() instanceof SweetBerryBushBlock && world instanceof ServerWorld) { if (state.getBlock() instanceof SweetBerryBushBlock && world instanceof ServerWorld) {
int age = state.get(SweetBerryBushBlock.AGE);
if (age == 3) {
Util.spawnExp((ServerWorld) world, hitResult.getBlockPos(), 1, 1); Util.spawnExp((ServerWorld) world, hitResult.getBlockPos(), 1, 1);
} }
}
return ActionResult.PASS; return ActionResult.PASS;
})); }));
} }