Made Placers be able to place anything again.

Yes. Really.
This commit is contained in:
Ellpeck 2016-05-12 18:48:13 +02:00
parent 43c93f2e51
commit 8e93abf05a

View file

@ -138,22 +138,23 @@ public class WorldUtil{
} }
//Redstone //Redstone
else if(replaceable && stack.getItem() == Items.REDSTONE){ if(replaceable && stack.getItem() == Items.REDSTONE){
PosUtil.setBlock(offsetPos, world, Blocks.REDSTONE_WIRE, 0, 2); PosUtil.setBlock(offsetPos, world, Blocks.REDSTONE_WIRE, 0, 2);
stack.stackSize--; stack.stackSize--;
return stack;
} }
//Plants //Plants
else if(replaceable && stack.getItem() instanceof IPlantable){ if(replaceable && stack.getItem() instanceof IPlantable){
if(((IPlantable)stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)){ if(((IPlantable)stack.getItem()).getPlant(world, offsetPos).getBlock().canPlaceBlockAt(world, offsetPos)){
if(world.setBlockState(offsetPos, ((IPlantable)stack.getItem()).getPlant(world, offsetPos), 2)){ if(world.setBlockState(offsetPos, ((IPlantable)stack.getItem()).getPlant(world, offsetPos), 2)){
stack.stackSize--; stack.stackSize--;
return stack;
} }
} }
} }
//Everything else //Everything else
else{
try{ try{
EntityPlayer fake = FakePlayerUtil.getFakePlayer(world); EntityPlayer fake = FakePlayerUtil.getFakePlayer(world);
stack.onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F); stack.onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F);
@ -163,7 +164,6 @@ public class WorldUtil{
ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!", e); ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!", e);
} }
} }
}
return stack; return stack;
} }