@Override public void onContainerClosed(EntityPlayer entityplayer) { super.onContainerClosed(entityplayer); tileEntity.close(entityplayer); tileEntity.closeInventory(entityplayer); }
public ContainerDynamicTank(InventoryPlayer inventory, TileEntityDynamicTank tentity) { tileEntity = tentity; addSlotToContainer(new Slot(tentity, 0, 146, 20)); addSlotToContainer(new SlotOutput(tentity, 1, 146, 51)); int slotY; for (slotY = 0; slotY < 3; slotY++) { for (int slotX = 0; slotX < 9; slotX++) { addSlotToContainer( new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18)); } } for (slotY = 0; slotY < 9; slotY++) { addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142)); } tileEntity.open(inventory.player); tileEntity.openInventory(inventory.player); }
public void renderAModelAt( TileEntityDynamicTank tileEntity, double x, double y, double z, float partialTick) { if (tileEntity.clientHasStructure && tileEntity.isRendering && tileEntity.structure != null && tileEntity.structure.fluidStored != null && tileEntity.structure.fluidStored.amount != 0) { RenderData data = new RenderData(); data.location = tileEntity.structure.renderLocation; data.height = tileEntity.structure.volHeight; data.length = tileEntity.structure.volLength; data.width = tileEntity.structure.volWidth; bindTexture(MekanismRenderer.getBlocksTexture()); if (data.location != null && data.height >= 3 && tileEntity.structure.fluidStored.getFluid() != null) { push(); GL11.glTranslated( getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord)); MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity()); MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid()); DisplayInteger[] displayList = getListAndRender( data, tileEntity.structure.fluidStored.getFluid(), tileEntity.getWorldObj()); if (tileEntity.structure.fluidStored.getFluid().isGaseous()) { GL11.glColor4f( 1F, 1F, 1F, Math.min( 1, ((float) tileEntity.structure.fluidStored.amount / (float) tileEntity.clientCapacity) + MekanismRenderer.GAS_RENDER_BASE)); displayList[getStages(data.height) - 1].render(); } else { displayList[ Math.min( getStages(data.height) - 1, (int) (tileEntity.prevScale * ((float) getStages(data.height) - 1)))] .render(); } MekanismRenderer.glowOff(); MekanismRenderer.resetColor(); pop(); for (ValveData valveData : tileEntity.valveViewing) { push(); GL11.glTranslated( getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord)); MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity()); getValveDisplay( ValveRenderData.get(data, valveData), tileEntity.structure.fluidStored.getFluid(), tileEntity.getWorldObj()) .render(); MekanismRenderer.glowOff(); MekanismRenderer.resetColor(); pop(); } } } }
@Override public boolean canInteractWith(EntityPlayer entityplayer) { return tileEntity.isUseableByPlayer(entityplayer); }