use of net.minecraft.server.v1_14_R1.IBlockData in project TheAPI by TheDevTec.
the class v1_14_R1 method packetBlockChange.
@Override
public Object packetBlockChange(World world, Position position) {
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange();
packet.block = (IBlockData) position.getIBlockData();
try {
pos.set(packet, position.getBlockPosition());
} catch (Exception e) {
}
return packet;
}
use of net.minecraft.server.v1_14_R1.IBlockData in project PaperDev by Kamillaova.
the class CraftBlockState method update.
public boolean update(boolean force, boolean applyPhysics) {
if (!isPlaced()) {
return true;
}
Block block = getBlock();
if (block.getType() != getType()) {
if (!force) {
return false;
}
}
BlockPosition pos = new BlockPosition(x, y, z);
IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
world.getHandle().notify(pos, CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()), newBlock, 3);
// Update levers etc
if (applyPhysics && getData() instanceof Attachable) {
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock(), false);
}
return true;
}
use of net.minecraft.server.v1_14_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_9_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_9_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_9_R1.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_14_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_11_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_11_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_11_R1.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_14_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_8_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_8_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_8_R1.Block.getByCombinedId(combined);
chunk.a(bp, ibd);
if (applyPhysics) {
net.minecraft.server.v1_8_R1.Block block = chunk.getType(bp);
w.update(bp, block);
}
}
Aggregations