use of forestry.api.multiblock.IMultiblockComponent in project ForestryMC by ForestryMC.
the class CamouflageUtil method getCamouflageBlock.
public static ItemStack getCamouflageBlock(@Nullable IBlockAccess world, @Nullable BlockPos pos) {
if (world == null || pos == null) {
return ItemStack.EMPTY;
}
TileEntity tile = TileUtil.getTile(world, pos, TileEntity.class);
if (tile instanceof ICamouflagedTile) {
ICamouflagedTile block = (ICamouflagedTile) tile;
ItemStack camouflageStack = ItemStack.EMPTY;
if (tile instanceof ICamouflageHandler) {
ICamouflageHandler tileHandler = (ICamouflageHandler) tile;
ItemStack tileCamouflageStack = tileHandler.getCamouflageBlock();
ItemStack defaultCamouflageStack = tileHandler.getDefaultCamouflageBlock();
if (!ItemStackUtil.isIdenticalItem(tileCamouflageStack, defaultCamouflageStack)) {
camouflageStack = tileCamouflageStack;
}
}
if (camouflageStack.isEmpty() && tile instanceof IMultiblockComponent) {
IMultiblockComponent component = (IMultiblockComponent) tile;
IMultiblockController controller = component.getMultiblockLogic().getController();
if (controller.isAssembled() && controller instanceof ICamouflageHandler) {
ICamouflageHandler multiblockHandler = (ICamouflageHandler) controller;
camouflageStack = multiblockHandler.getCamouflageBlock();
}
}
return camouflageStack;
}
return ItemStack.EMPTY;
}
use of forestry.api.multiblock.IMultiblockComponent in project ForestryMC by ForestryMC.
the class GreenhouseController method onMachineDisassembled.
@Override
protected void onMachineDisassembled() {
super.onMachineDisassembled();
provider.clear(false);
provider.getStorage().removeProviderFromChunks();
this.centerPos = BlockPos.ORIGIN;
for (IMultiblockComponent comp : connectedParts) {
if (comp instanceof ICamouflagedTile) {
world.markBlockRangeForRenderUpdate(comp.getCoordinates(), comp.getCoordinates());
}
}
limits = null;
}
Aggregations