@Override public boolean shouldRenderInPass(int arg0) { if (facadeId != null && facadeId.isOpaqueCube() && !ConduitUtil.isFacadeHidden(this, EnderIO.proxy.getClientPlayer())) { return false; } return super.shouldRenderInPass(arg0); }
private void doFacadeChanged() { // force re-calc of lighting for both client and server ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord); // worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); worldObj.func_147451_t(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, EnderIO.blockConduitBundle); facadeChanged = false; }
private void updateEntityClient() { boolean markForUpdate = false; if (clientUpdated) { // TODO: This is not the correct solution here but just marking the block for a render update // server side // seems to get out of sync with the client sometimes so connections are not rendered // correctly markForUpdate = true; clientUpdated = false; } FacadeRenderState curRS = getFacadeRenderedAs(); FacadeRenderState rs = ConduitUtil.getRequiredFacadeRenderState(this, EnderIO.proxy.getClientPlayer()); if (Config.updateLightingWhenHidingFacades) { int curLO = getLightOpacity(); int shouldBeLO = rs == FacadeRenderState.FULL ? 255 : 0; if (curLO != shouldBeLO) { setLightOpacity(shouldBeLO); // worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); worldObj.func_147451_t(xCoord, yCoord, zCoord); } } if (curRS != rs) { setFacadeRenderAs(rs); if (!ConduitUtil.forceSkylightRecalculation(worldObj, xCoord, yCoord, zCoord)) { markForUpdate = true; } } else { // can do the else as only need to update once ConduitDisplayMode curMode = ConduitDisplayMode.getDisplayMode( EnderIO.proxy.getClientPlayer().getCurrentEquippedItem()); if (curMode != lastMode) { markForUpdate = true; lastMode = curMode; } } if (markForUpdate) { worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } }
@Override public void writeCustomNBT(NBTTagCompound nbtRoot) { NBTTagList conduitTags = new NBTTagList(); for (IConduit conduit : conduits) { NBTTagCompound conduitRoot = new NBTTagCompound(); ConduitUtil.writeToNBT(conduit, conduitRoot); conduitTags.appendTag(conduitRoot); } nbtRoot.setTag("conduits", conduitTags); if (facadeId != null) { nbtRoot.setString("facadeId", Block.blockRegistry.getNameForObject(facadeId)); nbtRoot.setString("facadeType", facadeType.name()); } else { nbtRoot.setString("facadeId", "null"); } nbtRoot.setInteger("facadeMeta", facadeMeta); nbtRoot.setShort("nbtVersion", NBT_VERSION); if (MicroblocksUtil.supportMicroblocks()) { writeMicroblocksToNBT(nbtRoot); } }
@Override public void readCustomNBT(NBTTagCompound nbtRoot) { short nbtVersion = nbtRoot.getShort("nbtVersion"); conduits.clear(); cachedCollidables.clear(); NBTTagList conduitTags = (NBTTagList) nbtRoot.getTag("conduits"); if (conduitTags != null) { for (int i = 0; i < conduitTags.tagCount(); i++) { NBTTagCompound conduitTag = conduitTags.getCompoundTagAt(i); IConduit conduit = ConduitUtil.readConduitFromNBT(conduitTag, nbtVersion); if (conduit != null) { conduit.setBundle(this); conduits.add(conduit); } } } String fs = nbtRoot.getString("facadeId"); if (fs == null || "null".equals(fs)) { facadeId = null; facadeType = FacadeType.BASIC; } else { facadeId = Block.getBlockFromName(fs); if (nbtRoot.hasKey("facadeType")) { // backwards compat, never true in freshly placed bundles facadeType = FacadeType.valueOf(nbtRoot.getString("facadeType")); } } facadeMeta = nbtRoot.getInteger("facadeMeta"); if (worldObj != null && worldObj.isRemote) { clientUpdated = true; } if (MicroblocksUtil.supportMicroblocks()) { readMicroblocksFromNBT(nbtRoot); } }