From 8996cf969001950187c7f1ad831f1f845644f30c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 20 Oct 2018 23:21:29 +0200 Subject: [PATCH] made the shovel only convert to grass if it's around grass already --- .../de/ellpeck/naturesaura/items/tools/ItemShovelNA.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java index 9ad65338..599ac351 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java @@ -45,8 +45,13 @@ public class ItemShovelNA extends ItemSpade implements IModItem, IModelProvider if (state.getBlock() instanceof BlockDirt) { if (worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR) { - worldIn.setBlockState(pos, Blocks.GRASS.getDefaultState()); - damage = 5; + for (EnumFacing dir : EnumFacing.HORIZONTALS) { + if (worldIn.getBlockState(pos.offset(dir)).getBlock() == Blocks.GRASS) { + worldIn.setBlockState(pos, Blocks.GRASS.getDefaultState()); + damage = 5; + break; + } + } } } else { int range = player.isSneaking() ? 0 : 1;