use of com.builtbroken.mc.api.tile.multiblock.IMultiTileHost in project Engine by VoltzEngine-Project.
the class TileMulti method read.
@Override
public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) {
if (worldObj.isRemote) {
if (id == 1) {
//Update host data for client use
Pos pos = new Pos(buf);
if (pos.isZero()) {
this.setHost(null);
} else {
TileEntity tile = pos.getTileEntity(worldObj);
if (tile instanceof IMultiTileHost) {
this.setHost((IMultiTileHost) tile);
}
}
//Update should render
boolean prev = shouldRenderBlock;
shouldRenderBlock = buf.readBoolean();
//Update render bounds
if (buf.readBoolean()) {
overrideRenderBounds = new Cube(buf);
} else {
overrideRenderBounds = new Cube(0, 0, 0, 1, 1, 1);
}
if (prev != shouldRenderBlock) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
return true;
}
}
return false;
}
use of com.builtbroken.mc.api.tile.multiblock.IMultiTileHost in project ICBM-Classic by BuiltBrokenModding.
the class ItemRadarGun method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hit_x, float hit_y, float hit_z) {
if (world.isRemote) {
return true;
}
Location location = new Location(world, x, y, z);
TileEntity tile = location.getTileEntity();
if (tile instanceof IMultiTile) {
IMultiTileHost host = ((IMultiTile) tile).getHost();
if (host instanceof TileEntity) {
tile = (TileEntity) host;
}
}
if (player.isSneaking()) {
stack.setTagCompound(null);
stack.setItemDamage(0);
LanguageUtility.addChatToPlayer(player, "gps.cleared");
player.inventoryContainer.detectAndSendChanges();
return true;
} else {
Location storedLocation = getLocation(stack);
if (storedLocation == null || !storedLocation.isAboveBedrock()) {
LanguageUtility.addChatToPlayer(player, "gps.error.pos.invalid");
return true;
} else if (tile instanceof ILauncherController) {
((ILauncherController) tile).setTarget(storedLocation.toPos());
LanguageUtility.addChatToPlayer(player, "gps.data.transferred");
return true;
}
}
return false;
}
use of com.builtbroken.mc.api.tile.multiblock.IMultiTileHost in project Engine by VoltzEngine-Project.
the class TileMulti method read.
@Override
public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) {
if (worldObj.isRemote) {
if (id == 1) {
// Update host data for client use
Pos pos = new Pos(buf);
if (pos.isZero()) {
this.setHost(null);
} else {
TileEntity tile = pos.getTileEntity(worldObj);
if (tile instanceof IMultiTileHost) {
this.setHost((IMultiTileHost) tile);
}
}
// Update should render
boolean prev = shouldRenderBlock;
shouldRenderBlock = buf.readBoolean();
// Update render bounds
if (buf.readBoolean()) {
overrideRenderBounds = new Cube(buf);
} else {
overrideRenderBounds = new Cube(0, 0, 0, 1, 1, 1);
}
if (prev != shouldRenderBlock) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
return true;
}
}
return false;
}
Aggregations