better handling of breaking and constructing of blocks

This commit is contained in:
way2muchnoise
2017-01-26 19:19:47 +01:00
parent 9dddf8a36f
commit 74a98ff024
2 changed files with 4 additions and 5 deletions

View File

@@ -29,6 +29,7 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
@@ -151,14 +152,13 @@ public class NetworkNodeConstructor extends NetworkNode implements IComparable,
ItemStack took = network.extractItem(itemFilters.getStackInSlot(0), 1, compare, true);
if (took != null) {
@SuppressWarnings("deprecation")
IBlockState state = block.getBlock().getStateFromMeta(took.getMetadata());
IBlockState state = block.getBlock().getStateForPlacement(holder.world(), front, holder.getDirection(), 0.5F, 0.5F, 0.5F, took.getMetadata(), null, EnumHand.MAIN_HAND);
if (!canPlace(front, state)) {
return;
}
network.extractItem(itemFilters.getStackInSlot(0), 1, compare, false);
took = network.extractItem(itemFilters.getStackInSlot(0), 1, compare, false);
if (item.getItem() instanceof ItemBlock) {
((ItemBlock) item.getItem()).placeBlockAt(

View File

@@ -98,8 +98,7 @@ public class NetworkNodeDestructor extends NetworkNode implements IComparable, I
IBlockState frontBlockState = holder.world().getBlockState(front);
Block frontBlock = frontBlockState.getBlock();
@SuppressWarnings("deprecation")
ItemStack frontStack = frontBlock.getItem(holder.world(), front, frontBlockState);
ItemStack frontStack = frontBlock.getPickBlock(frontBlockState, null, holder.world(), front, null);
if (!frontStack.isEmpty()) {
if (IFilterable.canTake(itemFilters, mode, compare, frontStack) && frontBlockState.getBlockHardness(holder.world(), front) != -1.0) {