Search in sources :

Example 1 with PacketCamouflageSelectionServer

use of forestry.greenhouse.network.packets.PacketCamouflageSelectionServer in project ForestryMC by ForestryMC.

the class TileGreenhouse method setCamouflageBlock.

/* ICamouflageHandler */
@Override
public boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate) {
    if (!ItemStackUtil.isIdenticalItem(camouflageBlock, this.camouflageBlock)) {
        this.camouflageBlock = camouflageBlock;
        if (sendClientUpdate && world != null && world.isRemote) {
            NetworkUtil.sendToServer(new PacketCamouflageSelectionServer(this, CamouflageHandlerType.TILE));
            world.markBlockRangeForRenderUpdate(pos, pos);
        }
        return true;
    }
    return false;
}
Also used : PacketCamouflageSelectionServer(forestry.greenhouse.network.packets.PacketCamouflageSelectionServer)

Example 2 with PacketCamouflageSelectionServer

use of forestry.greenhouse.network.packets.PacketCamouflageSelectionServer in project ForestryMC by ForestryMC.

the class GreenhouseController method setCamouflageBlock.

@Override
public boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate) {
    if (!ItemStackUtil.isIdenticalItem(camouflageBlock, camouflage)) {
        camouflage = camouflageBlock;
        if (sendClientUpdate && world.isRemote) {
            for (IMultiblockComponent comp : connectedParts) {
                if (comp instanceof ICamouflagedTile) {
                    ICamouflagedTile camBlock = (ICamouflagedTile) comp;
                    BlockPos coordinates = camBlock.getCoordinates();
                    world.markBlockRangeForRenderUpdate(coordinates, coordinates);
                }
            }
            NetworkUtil.sendToServer(new PacketCamouflageSelectionServer(this, CamouflageHandlerType.STRUCTURE));
        }
        return true;
    }
    return false;
}
Also used : ICamouflagedTile(forestry.api.core.ICamouflagedTile) BlockPos(net.minecraft.util.math.BlockPos) IMultiblockComponent(forestry.api.multiblock.IMultiblockComponent) PacketCamouflageSelectionServer(forestry.greenhouse.network.packets.PacketCamouflageSelectionServer)

Example 3 with PacketCamouflageSelectionServer

use of forestry.greenhouse.network.packets.PacketCamouflageSelectionServer in project ForestryMC by ForestryMC.

the class ItemInventoryCamouflageSprayCan method setCamouflageBlock.

@Override
public boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate) {
    if (!ItemStackUtil.isIdenticalItem(camouflageBlock, getStackInSlot(0))) {
        setInventorySlotContents(0, camouflageBlock);
        World world = player.world;
        if (sendClientUpdate && world != null && world.isRemote) {
            NetworkUtil.sendToServer(new PacketCamouflageSelectionServer(this, CamouflageHandlerType.ITEM));
        }
        return true;
    }
    return false;
}
Also used : World(net.minecraft.world.World) PacketCamouflageSelectionServer(forestry.greenhouse.network.packets.PacketCamouflageSelectionServer)

Example 4 with PacketCamouflageSelectionServer

use of forestry.greenhouse.network.packets.PacketCamouflageSelectionServer in project ForestryMC by ForestryMC.

the class TileClimatiser method setCamouflageBlock.

/* ICamouflageHandler */
@Override
public boolean setCamouflageBlock(ItemStack camouflageBlock, boolean sendClientUpdate) {
    if (!ItemStackUtil.isIdenticalItem(camouflageBlock, this.camouflageBlock)) {
        this.camouflageBlock = camouflageBlock;
        if (sendClientUpdate && world != null && world.isRemote) {
            NetworkUtil.sendToServer(new PacketCamouflageSelectionServer(this, CamouflageHandlerType.TILE));
            world.markBlockRangeForRenderUpdate(pos, pos);
            markDirty();
        }
        return true;
    }
    return false;
}
Also used : PacketCamouflageSelectionServer(forestry.greenhouse.network.packets.PacketCamouflageSelectionServer)

Aggregations

PacketCamouflageSelectionServer (forestry.greenhouse.network.packets.PacketCamouflageSelectionServer)4 ICamouflagedTile (forestry.api.core.ICamouflagedTile)1 IMultiblockComponent (forestry.api.multiblock.IMultiblockComponent)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1