From 0e35aca15aa982ed0adc40a5c0bd3a33fe2a2507 Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Thu, 12 Dec 2013 22:31:27 -0500 Subject: [PATCH] Rendering enhancements --- .../client/render => }/PartTransmitterIcons.java | 2 +- common/mekanism/client/render/RenderPartTransmitter.java | 2 +- .../client/render/tileentity/RenderDynamicTank.java | 2 +- common/mekanism/common/multipart/MultipartMekanism.java | 1 + common/mekanism/common/multipart/PartMechanicalPipe.java | 2 +- .../mekanism/common/multipart/PartPressurizedTube.java | 2 +- common/mekanism/common/multipart/PartTransmitter.java | 2 +- common/mekanism/common/multipart/PartUniversalCable.java | 6 ++++-- .../common/tileentity/TileEntityDynamicTank.java | 9 +++++++++ 9 files changed, 20 insertions(+), 8 deletions(-) rename common/mekanism/client/render/{mekanism/client/render => }/PartTransmitterIcons.java (93%) diff --git a/common/mekanism/client/render/mekanism/client/render/PartTransmitterIcons.java b/common/mekanism/client/render/PartTransmitterIcons.java similarity index 93% rename from common/mekanism/client/render/mekanism/client/render/PartTransmitterIcons.java rename to common/mekanism/client/render/PartTransmitterIcons.java index a11964c71..e6c4e3293 100644 --- a/common/mekanism/client/render/mekanism/client/render/PartTransmitterIcons.java +++ b/common/mekanism/client/render/PartTransmitterIcons.java @@ -1,4 +1,4 @@ -package mekanism.client.render.mekanism.client.render; +package mekanism.client.render; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.util.Icon; diff --git a/common/mekanism/client/render/RenderPartTransmitter.java b/common/mekanism/client/render/RenderPartTransmitter.java index 39367951e..541206094 100644 --- a/common/mekanism/client/render/RenderPartTransmitter.java +++ b/common/mekanism/client/render/RenderPartTransmitter.java @@ -105,7 +105,7 @@ public class RenderPartTransmitter implements IIconRegister public void renderContents(PartUniversalCable cable, Vector3 pos) { - if(cable.getTransmitterNetwork().clientEnergyScale == 0) + if(cable.currentPower == 0) { return; } diff --git a/common/mekanism/client/render/tileentity/RenderDynamicTank.java b/common/mekanism/client/render/tileentity/RenderDynamicTank.java index 40162766a..15a73cb99 100644 --- a/common/mekanism/client/render/tileentity/RenderDynamicTank.java +++ b/common/mekanism/client/render/tileentity/RenderDynamicTank.java @@ -65,7 +65,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer displayList[getStages(data.height)-1].render(); } else { - displayList[(int)(((float)tileEntity.structure.fluidStored.amount/(float)tileEntity.clientCapacity)*((float)getStages(data.height)-1))].render(); + displayList[(int)(tileEntity.prevScale*((float)getStages(data.height)-1))].render(); } MekanismRenderer.glowOff(); diff --git a/common/mekanism/common/multipart/MultipartMekanism.java b/common/mekanism/common/multipart/MultipartMekanism.java index 999d92103..6bc437433 100644 --- a/common/mekanism/common/multipart/MultipartMekanism.java +++ b/common/mekanism/common/multipart/MultipartMekanism.java @@ -53,6 +53,7 @@ public class MultipartMekanism implements IPartFactory, IPartConverter int meta = world.getBlockMetadata(pos.x, pos.y, pos.z); return PartTransmitter.getPartType(TransmissionType.fromOldMeta(meta)); } + return null; } } diff --git a/common/mekanism/common/multipart/PartMechanicalPipe.java b/common/mekanism/common/multipart/PartMechanicalPipe.java index f1369b2ee..43f0dcaa0 100644 --- a/common/mekanism/common/multipart/PartMechanicalPipe.java +++ b/common/mekanism/common/multipart/PartMechanicalPipe.java @@ -6,8 +6,8 @@ import java.util.Set; import mekanism.api.Object3D; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; +import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; -import mekanism.client.render.mekanism.client.render.PartTransmitterIcons; import mekanism.common.FluidNetwork; import mekanism.common.PipeUtils; import net.minecraft.client.renderer.texture.IconRegister; diff --git a/common/mekanism/common/multipart/PartPressurizedTube.java b/common/mekanism/common/multipart/PartPressurizedTube.java index 4c16d3709..08bdabbf0 100644 --- a/common/mekanism/common/multipart/PartPressurizedTube.java +++ b/common/mekanism/common/multipart/PartPressurizedTube.java @@ -10,8 +10,8 @@ import mekanism.api.gas.GasNetwork; import mekanism.api.gas.IGasAcceptor; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; +import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; -import mekanism.client.render.mekanism.client.render.PartTransmitterIcons; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; diff --git a/common/mekanism/common/multipart/PartTransmitter.java b/common/mekanism/common/multipart/PartTransmitter.java index eaf39775b..fbe057e60 100644 --- a/common/mekanism/common/multipart/PartTransmitter.java +++ b/common/mekanism/common/multipart/PartTransmitter.java @@ -14,8 +14,8 @@ import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmissionType.Size; import mekanism.api.transmitters.TransmitterNetworkRegistry; +import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; -import mekanism.client.render.mekanism.client.render.PartTransmitterIcons; import mekanism.common.ITileNetwork; import mekanism.common.Mekanism; import mekanism.common.item.ItemConfigurator; diff --git a/common/mekanism/common/multipart/PartUniversalCable.java b/common/mekanism/common/multipart/PartUniversalCable.java index b5a9e3217..3d2705bcf 100644 --- a/common/mekanism/common/multipart/PartUniversalCable.java +++ b/common/mekanism/common/multipart/PartUniversalCable.java @@ -15,7 +15,6 @@ import codechicken.lib.vec.Vector3; import codechicken.multipart.TileMultipart; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import mekanism.client.render.mekanism.client.render.PartTransmitterIcons; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.util.Icon; import universalelectricity.core.block.IConductor; @@ -35,6 +34,7 @@ import mekanism.api.energy.ICableOutputter; import mekanism.api.energy.IStrictEnergyAcceptor; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; +import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.RenderPartTransmitter; import mekanism.common.EnergyNetwork; import mekanism.common.Mekanism; @@ -51,8 +51,8 @@ import cpw.mods.fml.relauncher.SideOnly; public class PartUniversalCable extends PartTransmitter implements IEnergySink, IEnergyHandler, IElectrical { - public static PartTransmitterIcons cableIcons; + public double currentPower = 0; @Override @@ -61,11 +61,13 @@ public class PartUniversalCable extends PartTransmitter implement if(world().isRemote) { double targetPower = getTransmitterNetwork().clientEnergyScale; + if(Math.abs(currentPower - targetPower) > 0.01) { currentPower = (9*currentPower + targetPower)/10; } } + super.update(); } diff --git a/common/mekanism/common/tileentity/TileEntityDynamicTank.java b/common/mekanism/common/tileentity/TileEntityDynamicTank.java index a957b8a33..95a531e25 100644 --- a/common/mekanism/common/tileentity/TileEntityDynamicTank.java +++ b/common/mekanism/common/tileentity/TileEntityDynamicTank.java @@ -56,6 +56,8 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock /** Whether or not this tank segment is rendering the structure. */ public boolean isRendering; + public float prevScale; + public TileEntityDynamicTank() { this("DynamicTank"); @@ -104,6 +106,13 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock { Mekanism.proxy.doTankAnimation(this); } + + float targetScale = (float)(structure.fluidStored != null ? structure.fluidStored.amount : 0)/clientCapacity; + + if(Math.abs(prevScale - targetScale) > 0.01) + { + prevScale = (9*prevScale + targetScale)/10; + } } prevStructure = clientHasStructure;