protected boolean shouldDrawName() { if(this.inventorySlots instanceof BaseContainer) { return ((BaseContainer) this.inventorySlots).getInventoryDisplayName() != null; } return false; }
public GuiScalingChest(GuiMultiModule parent, BaseContainer container) { super(parent, container); inventory = (IInventory) container.getTile(); slotCount = inventory.getSizeInventory(); sliderActive = true; }
@Override public boolean openGui(EntityPlayer player, World world, BlockPos pos) { if(!world.isRemote) { player.openGui(TConstruct.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); if(player.openContainer instanceof BaseContainer) { ((BaseContainer) player.openContainer).syncOnOpen((EntityPlayerMP) player); } } return true; }
public void syncOnOpen(EntityPlayerMP playerOpened) { // find another player that already has the gui for this tile open WorldServer server = playerOpened.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == playerOpened) { continue; } if(player.openContainer instanceof BaseContainer) { if(this.sameGui((BaseContainer<T>) player.openContainer)) { syncWithOtherContainer((BaseContainer<T>) player.openContainer, playerOpened); return; } } } // no player has a container open for the tile syncNewContainer(playerOpened); }
@Override public void handleServerSafe(NetHandlerPlayServer netHandler) { Container container = netHandler.player.openContainer; if(container instanceof ContainerToolStation) { ((ContainerToolStation) container).setToolSelection(tool, activeSlots); // find all people who also have the same gui open and update them too WorldServer server = netHandler.player.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == netHandler.player) { continue; } if(player.openContainer instanceof ContainerToolStation) { if(((BaseContainer) container).sameGui((BaseContainer) player.openContainer)) { ((ContainerToolStation) player.openContainer).setToolSelection(tool, activeSlots); // same gui, send him an update TinkerNetwork.sendTo(this, (EntityPlayerMP) player); } } } } }
boolean ret = mergeItemStackRefill(stack, startIndex, endIndex, useEndIndex); if(!stack.isEmpty() && stack.getCount() > 0) { ret |= mergeItemStackMove(stack, startIndex, endIndex, useEndIndex);
@Override public void handleServerSafe(NetHandlerPlayServer netHandler) { Container container = netHandler.player.openContainer; if(container instanceof ContainerStencilTable) { ((ContainerStencilTable) container).setOutput(output); // find all people who also have the same gui open and update them too WorldServer server = netHandler.player.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == netHandler.player) { continue; } if(player.openContainer instanceof ContainerStencilTable) { if(((BaseContainer) container).sameGui((BaseContainer) player.openContainer)) { ((ContainerStencilTable) player.openContainer).setOutput(output); // same gui, send him an update TinkerNetwork.sendTo(this, (EntityPlayerMP) player); } } } } }
protected void drawContainerName() { BaseContainer<?> multiContainer = (BaseContainer<?>) this.inventorySlots; String localizedName = multiContainer.getInventoryDisplayName(); if(localizedName != null) { this.fontRenderer.drawString(localizedName, 8 + guiLeft, 6 + guiTop, 0x404040); } }
@Override public boolean openGui(EntityPlayer player, World world, BlockPos pos) { player.openGui(TConstruct.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); if(player.openContainer instanceof BaseContainer) { ((BaseContainer) player.openContainer).syncOnOpen((EntityPlayerMP) player); } return true; }
@Override public void handleServerSafe(NetHandlerPlayServer netHandler) { if(netHandler.player.openContainer instanceof BaseContainer) { TileEntity te = ((BaseContainer<?>) netHandler.player.openContainer).getTile(); if(te instanceof ISmelteryTankHandler) { ISmelteryTankHandler smeltery = (ISmelteryTankHandler)te; smeltery.getTank().moveFluidToBottom(index); smeltery.onTankChanged(smeltery.getTank().getFluids(), null); } } }
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { if(shouldDrawName()) { String name = ((BaseContainer) inventorySlots).getInventoryDisplayName(); this.fontRenderer.drawString(name, border.w, border.h - 1, 0x404040);