fix the water bowl picking up stuff it shouldn't

Closes #715
This commit is contained in:
Ellpeck 2017-03-28 17:09:45 +02:00
parent 9216debef4
commit 5ea1c653b9

View file

@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -51,9 +52,9 @@ public class ItemWaterBowl extends ItemBase{
if(result == null && trace != null && trace.getBlockPos() != null){ if(result == null && trace != null && trace.getBlockPos() != null){
if(event.getEntityPlayer().canPlayerEdit(trace.getBlockPos().offset(trace.sideHit), trace.sideHit, event.getItemStack())){ if(event.getEntityPlayer().canPlayerEdit(trace.getBlockPos().offset(trace.sideHit), trace.sideHit, event.getItemStack())){
IBlockState state = event.getWorld().getBlockState(trace.getBlockPos()); IBlockState state = event.getWorld().getBlockState(trace.getBlockPos());
Material material = state.getMaterial(); Block block = state.getBlock();
if(material == Material.WATER && state.getValue(BlockLiquid.LEVEL) == 0){ if((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && state.getValue(BlockLiquid.LEVEL) == 0){
event.getEntityPlayer().playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F); event.getEntityPlayer().playSound(SoundEvents.ITEM_BUCKET_FILL, 1.0F, 1.0F);
if(!event.getWorld().isRemote){ if(!event.getWorld().isRemote){