From b871d35b5fffd48391fc89be2811dc778d9d1f04 Mon Sep 17 00:00:00 2001 From: dolu1990 Date: Mon, 16 Jun 2014 14:16:07 +0200 Subject: [PATCH] Rework client process, now, FrameTime must not be used ! use refresh(float) into SixNodeElementRender and TransparentNodeElementRender That allow to be compatible with shader mod. --- mods/eln/Eln.java | 6 +- mods/eln/autominer/AutoMinerRender.java | 75 ++++---- .../batterycharger/BatteryChargerRender.java | 12 +- mods/eln/client/ClientProxy.java | 2 +- mods/eln/client/FrameTime.java | 12 +- mods/eln/eggincubator/EggIncubatorRender.java | 9 +- .../ElectricalAlarmRender.java | 12 +- .../ElectricalBreakerRender.java | 9 +- .../ElectricalFurnaceRender.java | 11 +- .../ElectricalGateSourceRender.java | 33 ++-- .../CompressorDescriptor.java | 15 +- .../ElectricalMachineDescriptor.java | 3 + .../ElectricalMachineRender.java | 28 ++- .../MaceratorDescriptor.java | 21 ++- .../MagnetizerDescriptor.java | 18 +- .../PlateMachineDescriptor.java | 18 +- .../electricalmath/ElectricalMathRender.java | 13 +- .../ElectricalRelayRender.java | 7 +- .../ElectricalSwitchRender.java | 44 ++--- .../ElectricalTimeoutRender.java | 12 +- .../ElectricalVuMeterRender.java | 14 +- .../ElectricalWindSensorRender.java | 25 ++- mods/eln/heatfurnace/HeatFurnaceRender.java | 143 +++++++-------- mods/eln/lampsocket/LampSocketRender.java | 169 +++++++++--------- mods/eln/lampsupply/LampSupplyRender.java | 64 +++---- mods/eln/misc/PhysicalInterpolator.java | 4 +- mods/eln/misc/RcInterpolator.java | 4 +- mods/eln/misc/RcRcInterpolator.java | 4 +- mods/eln/misc/UtilsClient.java | 2 +- mods/eln/modbusrtu/ModbusRtuRender.java | 114 ++++++------ mods/eln/node/NodeBlockEntity.java | 3 + mods/eln/node/SixNodeElementRender.java | 5 + mods/eln/node/SixNodeEntity.java | 9 + .../node/TransparentNodeElementRender.java | 4 + mods/eln/node/TransparentNodeEntity.java | 7 + mods/eln/solarpannel/SolarPannelRender.java | 87 +++++---- mods/eln/teleporter/TeleporterRender.java | 41 +++-- .../ThermalDissipatorActiveRender.java | 12 +- mods/eln/waterturbine/WaterTurbineRender.java | 23 ++- mods/eln/windturbine/WindTurbineRender.java | 17 +- 40 files changed, 601 insertions(+), 510 deletions(-) diff --git a/mods/eln/Eln.java b/mods/eln/Eln.java index f93306d96..987b89922 100644 --- a/mods/eln/Eln.java +++ b/mods/eln/Eln.java @@ -269,7 +269,7 @@ import java.util.ArrayList; import java.util.List; -@Mod(modid = "Eln", version = "BETA-1.4.2") +@Mod(modid = "Eln", version = "BETA-1.4.3") //@Mod(modid = "Eln", name = "Electrical Age", version = "BETA-1.2.0b") //@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = { "miaouMod" }, packetHandler = PacketHandler.class) public class Eln { @@ -551,7 +551,7 @@ public void preInit(FMLPreInitializationEvent event) { config.save(); } - public FrameTime frameTime; + public static FMLEventChannel eventChannel; //FMLCommonHandler.instance().bus().register(this); @@ -568,7 +568,7 @@ public void load(FMLInitializationEvent event) { nodeServer = new NodeServer(); clientLiveDataManager = new LiveDataManager(); - frameTime = new FrameTime(); + packetHandler = new PacketHandler(); // ForgeDummyContainer instance = this; diff --git a/mods/eln/autominer/AutoMinerRender.java b/mods/eln/autominer/AutoMinerRender.java index 51dc18d21..103125eaf 100644 --- a/mods/eln/autominer/AutoMinerRender.java +++ b/mods/eln/autominer/AutoMinerRender.java @@ -3,7 +3,6 @@ import java.io.DataInputStream; import java.io.IOException; - import org.lwjgl.opengl.GL11; import mods.eln.client.FrameTime; @@ -22,100 +21,90 @@ public class AutoMinerRender extends TransparentNodeElementRender { float[] buttonsState; boolean[] ledsAState; boolean[] ledsPState; - - + public AutoMinerRender(TransparentNodeEntity tileEntity, TransparentNodeDescriptor descriptor) { super(tileEntity, descriptor); this.descriptor = (AutoMinerDescriptor) descriptor; - + buttonsState = new float[this.descriptor.buttonsCount]; - for(int idx = 0;idx < this.descriptor.buttonsCount;idx++){ + for (int idx = 0; idx < this.descriptor.buttonsCount; idx++) { buttonsState[idx] = (float) Math.random(); } - + ledsAState = new boolean[this.descriptor.ledsACount]; - for(int idx = 0;idx < this.descriptor.ledsACount;idx++){ + for (int idx = 0; idx < this.descriptor.ledsACount; idx++) { ledsAState[idx] = Math.random() > 0.5; } ledsPState = new boolean[this.descriptor.ledsPCount]; - for(int idx = 0;idx < this.descriptor.ledsPCount;idx++){ + for (int idx = 0; idx < this.descriptor.ledsPCount; idx++) { ledsPState[idx] = Math.random() > 0.5; } } - - @Override public void draw() { - - if(pipeLength != 0) { + + if (pipeLength != 0) { GL11.glPushMatrix(); - for(int idx = pipeLength;idx != 0;idx--){ - if(idx != 1){ + for (int idx = pipeLength; idx != 0; idx--) { + if (idx != 1) { descriptor.pipe.draw(); } - else{ + else { descriptor.head.draw(); } GL11.glTranslatef(0, -1f, 0); } GL11.glPopMatrix(); - /*GL11.glLineWidth(20f); - GL11.glDisable(GL11.GL_TEXTURE_2D); - - GL11.glBegin(GL11.GL_LINES); - GL11.glColor4f(1f, 0f, 0f, 1f); - GL11.glVertex3f(0f, -0.5f, 0f); - GL11.glVertex3f(0f, -0.5f - pipeLength, 0f); - GL11.glEnd(); - - GL11.glEnable(GL11.GL_TEXTURE_2D);*/ + } - - for(int idx = 0;idx < this.descriptor.buttonsCount;idx++){ + + for (int idx = 0; idx < this.descriptor.buttonsCount; idx++) { buttonsState[idx] = idx == job.ordinal() ? 1 : 0; } - - for(int idx = 0;idx < this.descriptor.ledsACount;idx++){ - if(Math.random() < 0.2*FrameTime.get()) - ledsAState[idx] = ! ledsAState[idx]; + + front.glRotateXnRef(); + descriptor.draw(false, buttonsState, ledsAState, ledsPState); + } + + public void refresh(float deltaT) { + for (int idx = 0; idx < this.descriptor.ledsACount; idx++) { + if (Math.random() < 0.2 * deltaT) + ledsAState[idx] = !ledsAState[idx]; } - for(int idx = 0;idx < this.descriptor.ledsPCount;idx++){ - if(Math.random() < 0.2*FrameTime.get()) - ledsPState[idx] = ! ledsPState[idx]; + for (int idx = 0; idx < this.descriptor.ledsPCount; idx++) { + if (Math.random() < 0.2 * deltaT) + ledsPState[idx] = !ledsPState[idx]; } - - - front.glRotateXnRef(); - descriptor.draw(false,buttonsState,ledsAState,ledsPState); + } TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(AutoMinerContainer.inventorySize, 64, this); - + @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { return new AutoMinerGuiDraw(player, inventory, this); } - + short pipeLength = 0; AutoMinerSlowProcess.jobType job; - + @Override public void networkUnserialize(DataInputStream stream) { super.networkUnserialize(stream); try { pipeLength = stream.readShort(); job = AutoMinerSlowProcess.jobType.values()[stream.readByte()]; - // Utils.println(job + " " + pipeLength); + // Utils.println(job + " " + pipeLength); } catch (IOException e) { e.printStackTrace(); } } - + @Override public boolean cameraDrawOptimisation() { return false; diff --git a/mods/eln/batterycharger/BatteryChargerRender.java b/mods/eln/batterycharger/BatteryChargerRender.java index 26eb88c4a..da23d7667 100644 --- a/mods/eln/batterycharger/BatteryChargerRender.java +++ b/mods/eln/batterycharger/BatteryChargerRender.java @@ -48,9 +48,7 @@ public BatteryChargerRender(SixNodeEntity tileEntity, Direction side, public void draw() { super.draw(); - alpha += 90 * FrameTime.get(); - if(alpha > 360) alpha -=360; - + drawEntityItem(b[0], 0.1875, 0.15625, 0.15625, alpha, 0.2f); drawEntityItem(b[1], 0.1875, 0.15625, -0.15625, alpha, 0.2f); drawEntityItem(b[2], 0.1875, -0.15625, 0.15625, alpha, 0.2f); @@ -60,6 +58,14 @@ public void draw() { descriptor.draw(batteryPresence, charged); } + + @Override + public void refresh(float deltaT) { + alpha += 90 * deltaT; + if(alpha > 360) alpha -=360; + + } + float alpha = 0; public void drawEntityItem(EntityItem entityItem, double x, double y, double z, float roty, float scale) { diff --git a/mods/eln/client/ClientProxy.java b/mods/eln/client/ClientProxy.java index fe5a065c0..63d5447c3 100644 --- a/mods/eln/client/ClientProxy.java +++ b/mods/eln/client/ClientProxy.java @@ -52,7 +52,7 @@ public void registerRenderers() { uuidManager = new UuidManager(); soundClientEventListener = new SoundClientEventListener(uuidManager); // FMLCommonHandler.instance().bus().register(); - + new FrameTime(); } public static UuidManager uuidManager; public static SoundClientEventListener soundClientEventListener; diff --git a/mods/eln/client/FrameTime.java b/mods/eln/client/FrameTime.java index 8dee6946c..1b6d7458f 100644 --- a/mods/eln/client/FrameTime.java +++ b/mods/eln/client/FrameTime.java @@ -60,14 +60,14 @@ public void stop() { // NodeBlockEntity.nodeAddedList.clear(); } - public static float get() { + public static float get2() { if(Utils.isGameInPause()) return 0f; return Math.min(0.1f, instance.deltaT); } - public static float getNotCaped() { - float value = get(); + public static float getNotCaped2() { + float value = get2(); return value; } @@ -88,16 +88,18 @@ public void tick(RenderTickEvent event) { } oldNanoTime = nanoTime; - Utils.println(NodeBlockEntity.clientList.size()); + //Utils.println(NodeBlockEntity.clientList.size()); Iterator i = NodeBlockEntity.clientList.iterator(); World w = Minecraft.getMinecraft().theWorld; + + float deltaTcaped = getNotCaped2(); while(i.hasNext()){ NodeBlockEntity e = i.next(); if(e.getWorldObj() != w){ i.remove(); continue; } - //e.clientRefresh(deltaT); + e.clientRefresh(deltaTcaped); } //Minecraft.getMinecraft().theWorld.getChunkFromChunkCoords(1, 1). // Utils.println("delta T : " + deltaT + " " + event); diff --git a/mods/eln/eggincubator/EggIncubatorRender.java b/mods/eln/eggincubator/EggIncubatorRender.java index 6adae7e27..ca48c2897 100644 --- a/mods/eln/eggincubator/EggIncubatorRender.java +++ b/mods/eln/eggincubator/EggIncubatorRender.java @@ -47,8 +47,6 @@ public EggIncubatorRender(TransparentNodeEntity tileEntity, TransparentNodeDescr @Override public void draw() { - alpha += FrameTime.get() * 60; - if(alpha >= 360) alpha -= 360; GL11.glPushMatrix(); front.glRotateXnRef(); @@ -60,6 +58,13 @@ public void draw() { cableRenderType = drawCable(front.down(), descriptor.cable.render, eConn, cableRenderType); } + @Override + public void refresh(float deltaT) { + alpha += deltaT * 60; + if(alpha >= 360) alpha -= 360; + + } + float alpha = 0; @Override diff --git a/mods/eln/electricalalarm/ElectricalAlarmRender.java b/mods/eln/electricalalarm/ElectricalAlarmRender.java index a5a0c9e0e..ad431f450 100644 --- a/mods/eln/electricalalarm/ElectricalAlarmRender.java +++ b/mods/eln/electricalalarm/ElectricalAlarmRender.java @@ -41,14 +41,18 @@ public void draw() { super.draw(); drawSignalPin(front,descriptor.pinDistance); - interpol.setTarget(warm ? descriptor.rotSpeed : 0f); - interpol.stepGraphic(); - - rotAlpha += interpol.get() * FrameTime.get(); //front.glRotateOnX(); descriptor.draw(warm, rotAlpha); } + @Override + public void refresh(float deltaT) { + interpol.setTarget(warm ? descriptor.rotSpeed : 0f); + interpol.step(deltaT); + + rotAlpha += interpol.get() * deltaT; + + } float rotAlpha = 0; boolean warm = false; diff --git a/mods/eln/electricalbreaker/ElectricalBreakerRender.java b/mods/eln/electricalbreaker/ElectricalBreakerRender.java index dd4f2db80..0164b166c 100644 --- a/mods/eln/electricalbreaker/ElectricalBreakerRender.java +++ b/mods/eln/electricalbreaker/ElectricalBreakerRender.java @@ -48,13 +48,18 @@ public ElectricalBreakerRender(SixNodeEntity tileEntity, Direction side, SixNode @Override public void draw() { super.draw(); - interpol.setTarget(switchState ? 1f :0f); - interpol.stepGraphic(); front.glRotateOnX(); descriptor.draw(interpol.get(), UtilsClient.distanceFromClientPlayer(tileEntity)); } + @Override + public void refresh(float deltaT) { + interpol.setTarget(switchState ? 1f :0f); + interpol.step(deltaT); + + } + @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { return cableRender; diff --git a/mods/eln/electricalfurnace/ElectricalFurnaceRender.java b/mods/eln/electricalfurnace/ElectricalFurnaceRender.java index 639030bb4..ab9e6346f 100644 --- a/mods/eln/electricalfurnace/ElectricalFurnaceRender.java +++ b/mods/eln/electricalfurnace/ElectricalFurnaceRender.java @@ -47,19 +47,26 @@ public ElectricalFurnaceRender(TransparentNodeEntity tileEntity, TransparentNode public void draw() { front.glRotateXnRef(); - processState += processStatePerSecond * FrameTime.getNotCaped(); - if(processState > 1f) processState = 1f; Eln.obj.draw("ElectricFurnace", "furnace"); //ClientProxy.obj.draw("ELFURNACE"); drawEntityItem(entityItemIn, -0.1, -0.20, 0, counter, 0.8f); + + } + + + @Override + public void refresh(float deltaT) { + processState += processStatePerSecond * FrameTime.getNotCaped2(); + if(processState > 1f) processState = 1f; counter += (System.currentTimeMillis() - time) * 0.001 * 360 / 4; if(counter > 360) counter -= 360; time = System.currentTimeMillis(); } + float counter = 0; @Override diff --git a/mods/eln/electricalgatesource/ElectricalGateSourceRender.java b/mods/eln/electricalgatesource/ElectricalGateSourceRender.java index 9cf4b6149..bb36cfd15 100644 --- a/mods/eln/electricalgatesource/ElectricalGateSourceRender.java +++ b/mods/eln/electricalgatesource/ElectricalGateSourceRender.java @@ -44,51 +44,54 @@ public ElectricalGateSourceRender(SixNodeEntity tileEntity, Direction side, SixN LRDU front; RcInterpolator interpolator; - + @Override public void draw() { super.draw(); - drawSignalPin(front,new float[]{3,3,3,3}); + drawSignalPin(front, new float[] { 3, 3, 3, 3 }); - - interpolator.setTarget((float)(voltageSyncValue / Eln.SVU)); - interpolator.stepGraphic(); LRDU.Down.glRotateOnX(); descriptor.draw(interpolator.get(), UtilsClient.distanceFromClientPlayer(this.tileEntity), tileEntity); } - + + @Override + public void refresh(float deltaT) { + interpolator.setTarget((float) (voltageSyncValue / Eln.SVU)); + interpolator.step(deltaT); + } + float voltageSyncValue = 0; boolean voltageSyncNew = false; boolean boot = true; - + @Override public void publishUnserialize(DataInputStream stream) { super.publishUnserialize(stream); try { Byte b; b = stream.readByte(); - front = LRDU.fromInt((b >> 4)&3); + front = LRDU.fromInt((b >> 4) & 3); float readF; readF = stream.readFloat(); - if(voltageSyncValue != readF) { + if (voltageSyncValue != readF) { voltageSyncValue = readF; voltageSyncNew = true; } - - if(boot) { + + if (boot) { boot = false; - interpolator.setValue((float)(voltageSyncValue / Eln.SVU)); + interpolator.setValue((float) (voltageSyncValue / Eln.SVU)); } } catch (IOException e) { e.printStackTrace(); - } + } } - + @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { return Eln.instance.signalCableDescriptor.render; } - + @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { return new ElectricalGateSourceGui(player, this); diff --git a/mods/eln/electricalmachine/CompressorDescriptor.java b/mods/eln/electricalmachine/CompressorDescriptor.java index 52de34b0b..ed49f181d 100644 --- a/mods/eln/electricalmachine/CompressorDescriptor.java +++ b/mods/eln/electricalmachine/CompressorDescriptor.java @@ -53,9 +53,7 @@ Object newDrawHandle() { @Override void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { CompressorDescriptorHandle handle = (CompressorDescriptorHandle) handleO; - handle.interpolator.setTarget(processState); - handle.interpolator.stepGraphic(); - + UtilsClient.drawEntityItem(inEntity, -0.35f, 0.04f, 0.3f, handle.itemCounter, 1f); UtilsClient.drawEntityItem(outEntity, 0.35f, 0.04f, 0.3f, -handle.itemCounter + 139f, 1f); @@ -63,7 +61,16 @@ void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, E GL11.glTranslatef(0f, tyOff + (float)Math.sqrt(handle.interpolator.get()) * (tyOn - tyOff), 0f); move.draw(); - handle.itemCounter += FrameTime.get() * 90; + + } + + @Override + void refresh(float deltaT, ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { + CompressorDescriptorHandle handle = (CompressorDescriptorHandle) handleO; + handle.interpolator.setTarget(processState); + handle.interpolator.step(deltaT); + + handle.itemCounter += deltaT * 90; while(handle.itemCounter >= 360f) handle.itemCounter -= 360; } diff --git a/mods/eln/electricalmachine/ElectricalMachineDescriptor.java b/mods/eln/electricalmachine/ElectricalMachineDescriptor.java index 21de8fb5f..d9c11dae7 100644 --- a/mods/eln/electricalmachine/ElectricalMachineDescriptor.java +++ b/mods/eln/electricalmachine/ElectricalMachineDescriptor.java @@ -106,6 +106,9 @@ Object newDrawHandle() { void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { } + void refresh(float deltaT,ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState){ + + } public boolean powerLrdu(Direction side, Direction front) { return true; diff --git a/mods/eln/electricalmachine/ElectricalMachineRender.java b/mods/eln/electricalmachine/ElectricalMachineRender.java index e9626e8d7..7006ef831 100644 --- a/mods/eln/electricalmachine/ElectricalMachineRender.java +++ b/mods/eln/electricalmachine/ElectricalMachineRender.java @@ -46,33 +46,25 @@ public ElectricalMachineRender(TransparentNodeEntity tileEntity, TransparentNode @Override public void draw() { - processState += processStatePerSecond * FrameTime.getNotCaped(); - if(processState > 1f) processState = 1f; + GL11.glPushMatrix(); front.glRotateXnRef(); descriptor.draw(this, drawHandle, inEntity, outEntity, powerFactor, processState); GL11.glPopMatrix(); - /* - if(connectionType == null) { - cableRefresh = false; - connectionType = CableRender.connectionType(tileEntity, eConn, front.getInverse()); - } - - glCableTransforme(front.down()); - descriptor.getPowerCableRender().bindCableTexture(); - - for(LRDU lrdu : LRDU.values()) { - Utils.setGlColorFromDye(connectionType.otherdry[lrdu.toInt()]); - if(eConn.get(lrdu) == false) continue; - if(lrdu != front.down().getLRDUGoingTo(front) && lrdu.inverse() != front.down().getLRDUGoingTo(front)) continue; - maskTemp.set(1 << lrdu.toInt()); - CableRender.drawCable(descriptor.getPowerCableRender(), maskTemp, connectionType); - } */ + if(descriptor.drawCable()) connectionType = drawCable(front.down(), descriptor.getPowerCableRender(), eConn, connectionType); } + + @Override + public void refresh(float deltaT) { + processState += processStatePerSecond * deltaT; + if(processState > 1f) processState = 1f; + descriptor.refresh(deltaT, this, drawHandle, inEntity, outEntity, powerFactor, processState); + } + float counter = 0; @Override diff --git a/mods/eln/electricalmachine/MaceratorDescriptor.java b/mods/eln/electricalmachine/MaceratorDescriptor.java index 82a2f7cf6..854c237bc 100644 --- a/mods/eln/electricalmachine/MaceratorDescriptor.java +++ b/mods/eln/electricalmachine/MaceratorDescriptor.java @@ -50,19 +50,26 @@ void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, E rot1.draw(handle.counter, 0f, 0f, -1f); rot2.draw(handle.counter, 0f, 0f, 1f); - handle.interpolator.setTarget(powerFactor); - handle.interpolator.stepGraphic(); - handle.counter += FrameTime.get() * handle.interpolator.get() * 180; - while(handle.counter >= 360f) handle.counter -= 360; - - handle.itemCounter += FrameTime.get() * 90; - while(handle.itemCounter >= 360f) handle.itemCounter -= 360; + GL11.glScalef(0.7f, 0.7f, 0.7f); UtilsClient.drawEntityItem(inEntity, 0.0, 0.4f, 0f, handle.itemCounter, 1f); UtilsClient.drawEntityItem(outEntity, 0.0, -0.5f, 0f, 130 + handle.itemCounter, 1f); } + @Override + void refresh(float deltaT, ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { + MaceratorDescriptorHandle handle = (MaceratorDescriptorHandle) handleO; + + handle.interpolator.setTarget(powerFactor); + handle.interpolator.step(deltaT); + handle.counter += deltaT * handle.interpolator.get() * 180; + while(handle.counter >= 360f) handle.counter -= 360; + + handle.itemCounter += deltaT * 90; + while(handle.itemCounter >= 360f) handle.itemCounter -= 360; + } + @Override public boolean powerLrdu(Direction side, Direction front) { return side != front && side != front.getInverse(); diff --git a/mods/eln/electricalmachine/MagnetizerDescriptor.java b/mods/eln/electricalmachine/MagnetizerDescriptor.java index 88fa412fa..382ad9624 100644 --- a/mods/eln/electricalmachine/MagnetizerDescriptor.java +++ b/mods/eln/electricalmachine/MagnetizerDescriptor.java @@ -52,18 +52,24 @@ void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, E main.draw(); rot.draw(handle.counter, 0f, 0f, 1f); - handle.interpolator.setTarget(powerFactor); - handle.interpolator.stepGraphic(); - handle.counter += FrameTime.get() * handle.interpolator.get() * 360; - while(handle.counter >= 360f) handle.counter -= 360; - handle.itemCounter += FrameTime.get() * 90; - while(handle.itemCounter >= 360f) handle.itemCounter -= 360; GL11.glScalef(0.5f, 0.5f, 0.5f); UtilsClient.drawEntityItem(inEntity, 0.0, 0.25f, 0f, handle.itemCounter, 1f); } + @Override + void refresh(float deltaT, ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { + MaceratorDescriptorHandle handle = (MaceratorDescriptorHandle) handleO; + handle.interpolator.setTarget(powerFactor); + handle.interpolator.step(deltaT); + handle.counter += deltaT * handle.interpolator.get() * 360; + while(handle.counter >= 360f) handle.counter -= 360; + + handle.itemCounter += deltaT * 90; + while(handle.itemCounter >= 360f) handle.itemCounter -= 360; + } + /* @Override public boolean powerLrdu(Direction side, Direction front) { diff --git a/mods/eln/electricalmachine/PlateMachineDescriptor.java b/mods/eln/electricalmachine/PlateMachineDescriptor.java index 41dae6d43..1605a7570 100644 --- a/mods/eln/electricalmachine/PlateMachineDescriptor.java +++ b/mods/eln/electricalmachine/PlateMachineDescriptor.java @@ -51,18 +51,24 @@ void draw(ElectricalMachineRender render, Object handleO, EntityItem inEntity, E rot1.draw(handle.counter, 0f, 0f, -1f); rot2.draw(handle.counter, 0f, 0f, 1f); - handle.interpolator.setTarget(powerFactor); - handle.interpolator.stepGraphic(); - handle.counter += FrameTime.get() * handle.interpolator.get() * 360; - while(handle.counter >= 360f) handle.counter -= 360; - handle.itemCounter += FrameTime.get() * 90; - while(handle.itemCounter >= 360f) handle.itemCounter -= 360; UtilsClient.drawEntityItem(inEntity, -0.35f, 0.1f, 0f, handle.itemCounter, 1f); UtilsClient.drawEntityItem(outEntity, 0.35f, 0.1f, 0f, -handle.itemCounter + 139f, 1f); } + @Override + void refresh(float deltaT, ElectricalMachineRender render, Object handleO, EntityItem inEntity, EntityItem outEntity, float powerFactor, float processState) { + PlateMachineDescriptorHandle handle = (PlateMachineDescriptorHandle) handleO; + handle.interpolator.setTarget(powerFactor); + handle.interpolator.step(deltaT); + handle.counter += deltaT * handle.interpolator.get() * 360; + while(handle.counter >= 360f) handle.counter -= 360; + + handle.itemCounter += deltaT * 90; + while(handle.itemCounter >= 360f) handle.itemCounter -= 360; + } + @Override public boolean powerLrdu(Direction side, Direction front) { return side != front && side != front.getInverse(); diff --git a/mods/eln/electricalmath/ElectricalMathRender.java b/mods/eln/electricalmath/ElectricalMathRender.java index 1033286bb..4a40f3dfa 100644 --- a/mods/eln/electricalmath/ElectricalMathRender.java +++ b/mods/eln/electricalmath/ElectricalMathRender.java @@ -81,7 +81,14 @@ public void draw() { GL11.glColor3f(1, 1, 1); } - ledTime += FrameTime.get(); + + + descriptor.draw(interpolator.get(), ledOn); + } + + @Override + public void refresh(float deltaT) { + ledTime += deltaT; if(ledTime > 0.4) { for(int idx = 1; idx <= 3; idx++){ @@ -98,10 +105,8 @@ public void draw() { else interpolator.setTarget(1f); - interpolator.stepGraphic(); + interpolator.step(deltaT); - - descriptor.draw(interpolator.get(), ledOn); } boolean[] ledOn = new boolean[8]; diff --git a/mods/eln/electricalrelay/ElectricalRelayRender.java b/mods/eln/electricalrelay/ElectricalRelayRender.java index de55c846a..ce84ca037 100644 --- a/mods/eln/electricalrelay/ElectricalRelayRender.java +++ b/mods/eln/electricalrelay/ElectricalRelayRender.java @@ -51,10 +51,15 @@ public void draw() { drawSignalPin(front,new float[]{2.5f,2.5f,2.5f,2.5f}); front.glRotateOnX(); - interpolator.stepGraphic(); + descriptor.draw(interpolator.get()); } + @Override + public void refresh(float deltaT) { + interpolator.step(deltaT); + } + boolean boot = true; float switchAlpha = 0; public boolean switchState, defaultOutput; diff --git a/mods/eln/electricalswitch/ElectricalSwitchRender.java b/mods/eln/electricalswitch/ElectricalSwitchRender.java index 3b53b7ccd..4238305ae 100644 --- a/mods/eln/electricalswitch/ElectricalSwitchRender.java +++ b/mods/eln/electricalswitch/ElectricalSwitchRender.java @@ -36,47 +36,49 @@ public ElectricalSwitchRender(SixNodeEntity tileEntity, Direction side, SixNodeD } double voltageAnode = 0, voltageCatode = 0, current = 0, temperature = 0; - + RcInterpolator interpol; - + @Override public void draw() { super.draw(); - - interpol.setTarget(switchState ? 1f : 0f); - interpol.stepGraphic(); - - front.glRotateOnX(); + front.glRotateOnX(); descriptor.draw(interpol.get(), UtilsClient.distanceFromClientPlayer(tileEntity), tileEntity); - - if(descriptor.signalSwitch){ - drawSignalPin(LRDU.Left,descriptor.pinDistance); - drawSignalPin(LRDU.Right,descriptor.pinDistance); + + if (descriptor.signalSwitch) { + drawSignalPin(LRDU.Left, descriptor.pinDistance); + drawSignalPin(LRDU.Right, descriptor.pinDistance); } else { - drawPowerPin(LRDU.Left,descriptor.pinDistance); - drawPowerPin(LRDU.Right,descriptor.pinDistance); + drawPowerPin(LRDU.Left, descriptor.pinDistance); + drawPowerPin(LRDU.Right, descriptor.pinDistance); } } - + + @Override + public void refresh(float deltaT) { + interpol.setTarget(switchState ? 1f : 0f); + interpol.step(deltaT); + } + @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { return descriptor.cableRender; } - + @Override public void glListDraw() { } - + @Override public boolean glListEnable() { - return false; + return false; } boolean boot = true; float switchAlpha = 0; boolean switchState; - + @Override public void publishUnserialize(DataInputStream stream) { super.publishUnserialize(stream); @@ -88,9 +90,9 @@ public void publishUnserialize(DataInputStream stream) { temperature = stream.readShort() / NodeBase.networkSerializeTFactor; } catch (IOException e) { e.printStackTrace(); - } - - if(boot) { + } + + if (boot) { interpol.setValue(switchState ? 1f : 0f); } boot = false; diff --git a/mods/eln/electricaltimeout/ElectricalTimeoutRender.java b/mods/eln/electricaltimeout/ElectricalTimeoutRender.java index 8464a7972..737413e44 100644 --- a/mods/eln/electricaltimeout/ElectricalTimeoutRender.java +++ b/mods/eln/electricaltimeout/ElectricalTimeoutRender.java @@ -47,14 +47,16 @@ public ElectricalTimeoutRender(SixNodeEntity tileEntity, Direction side, SixNode public void draw() { super.draw(); front.glRotateOnX(); + + descriptor.draw(timeoutCounter / timeoutValue); + } + + @Override + public void refresh(float deltaT) { if(inputState == false) { - timeoutCounter -= FrameTime.get(); + timeoutCounter -= deltaT; if(timeoutCounter < 0f) timeoutCounter = 0f; } - //interpolator.setTarget(timeoutCounter / timeoutValue); - //interpolator.stepGraphic(); - //descriptor.draw(interpolator.get()); - descriptor.draw(timeoutCounter / timeoutValue); } @Override diff --git a/mods/eln/electricalvumeter/ElectricalVuMeterRender.java b/mods/eln/electricalvumeter/ElectricalVuMeterRender.java index e7d3d401b..41a14f446 100644 --- a/mods/eln/electricalvumeter/ElectricalVuMeterRender.java +++ b/mods/eln/electricalvumeter/ElectricalVuMeterRender.java @@ -39,14 +39,18 @@ public ElectricalVuMeterRender(SixNodeEntity tileEntity, Direction side, SixNode public void draw() { super.draw(); drawSignalPin(front,descriptor.pinDistance); - ItemStack i = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3]; - EntityClientPlayerMP player = UtilsClient.getClientPlayer(); - GL11.glPushMatrix(); - interpolator.stepGraphic(); + descriptor.draw(descriptor.onOffOnly ? interpolator.getTarget() : interpolator.get(), UtilsClient.distanceFromClientPlayer(tileEntity), tileEntity); - GL11.glPopMatrix(); } + + @Override + public void refresh(float deltaT) { + + interpolator.step(deltaT); + + } + @Override public boolean cameraDrawOptimisation() { return false; diff --git a/mods/eln/electricalwindsensor/ElectricalWindSensorRender.java b/mods/eln/electricalwindsensor/ElectricalWindSensorRender.java index 32ad3f0c4..ecb901836 100644 --- a/mods/eln/electricalwindsensor/ElectricalWindSensorRender.java +++ b/mods/eln/electricalwindsensor/ElectricalWindSensorRender.java @@ -1,4 +1,3 @@ - package mods.eln.electricalwindsensor; import java.io.DataInputStream; @@ -20,43 +19,43 @@ import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; - -public class ElectricalWindSensorRender extends SixNodeElementRender{ +public class ElectricalWindSensorRender extends SixNodeElementRender { ElectricalWindSensorDescriptor descriptor; + public ElectricalWindSensorRender(SixNodeEntity tileEntity, Direction side, SixNodeDescriptor descriptor) { super(tileEntity, side, descriptor); this.descriptor = (ElectricalWindSensorDescriptor) descriptor; } - float alpha = 0; float wind = 0; - + RcInterpolator windFilter = new RcInterpolator(5); @Override public void draw() { super.draw(); - drawSignalPin(front.right(),descriptor.pinDistance); + drawSignalPin(front.right(),new float[]{2,2,2,2}); - windFilter.stepGraphic(); - alpha += windFilter.get()*FrameTime.get()*20; - if(alpha>360) alpha-=360; - descriptor.draw(alpha); } + @Override + public void refresh(float deltaT) { + windFilter.step(deltaT); + alpha += windFilter.get() * deltaT * 20; + if (alpha > 360) + alpha -= 360; + } - @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { // TODO Auto-generated method stub return Eln.instance.signalCableDescriptor.render; } - - + @Override public void publishUnserialize(DataInputStream stream) { // TODO Auto-generated method stub diff --git a/mods/eln/heatfurnace/HeatFurnaceRender.java b/mods/eln/heatfurnace/HeatFurnaceRender.java index 96db643ae..d49c466d8 100644 --- a/mods/eln/heatfurnace/HeatFurnaceRender.java +++ b/mods/eln/heatfurnace/HeatFurnaceRender.java @@ -24,69 +24,65 @@ import org.lwjgl.opengl.GL11; - public class HeatFurnaceRender extends TransparentNodeElementRender { double temperature; float gainSyncValue = -1234, temperatureTargetSyncValue = -1234; - boolean gainSyncNew = false,temperatureTargetSyncNew = false; + boolean gainSyncNew = false, temperatureTargetSyncNew = false; short power; - - public boolean controleExternal,takeFuel; - + + public boolean controleExternal, takeFuel; + HeatFurnaceDescriptor descriptor; - public HeatFurnaceRender(TransparentNodeEntity tileEntity,TransparentNodeDescriptor descriptor) { - super(tileEntity,descriptor); + + public HeatFurnaceRender(TransparentNodeEntity tileEntity, TransparentNodeDescriptor descriptor) { + super(tileEntity, descriptor); this.descriptor = (HeatFurnaceDescriptor) descriptor; - interpolator = new PhysicalInterpolator(0.4f,8.0f,0.9f,0.2f); + interpolator = new PhysicalInterpolator(0.4f, 8.0f, 0.9f, 0.2f); coord = new Coordonate(tileEntity); } + Coordonate coord; PhysicalInterpolator interpolator; + + @Override + public void draw() { + + front.glRotateXnRef(); + descriptor.draw(interpolator.get()); + + if (entityItemIn != null) + drawEntityItem(entityItemIn, -0.1, -0.30, 0, counter, 0.8f); + + } + @Override - public void draw() { - - - if(Utils.isPlayerAround(tileEntity.getWorldObj(),coord.getAxisAlignedBB(1)) == false) + public void refresh(float deltaT) { + + if (Utils.isPlayerAround(tileEntity.getWorldObj(), coord.getAxisAlignedBB(1)) == false) interpolator.setTarget(0f); else interpolator.setTarget(1f); - interpolator.stepGraphic(); - - front.glRotateXnRef(); - descriptor.draw(interpolator.get()); - - if(entityItemIn != null) - drawEntityItem(entityItemIn, -0.1, -0.30, 0, counter,0.8f); - - counter += FrameTime.get() * 60; - if(counter >= 360f) counter -= 360; - - /*if(Math.random() < 1 * FrameTime.get() * descriptor.flamePopRate * power/descriptor.nominalPower) - { - double [] p = new double[3]; - - p[0] = Math.random() * descriptor.flameDeltaX + descriptor.flameStartX; - p[1] = Math.random() * descriptor.flameDeltaY + descriptor.flameStartY; - p[2] = Math.random() * descriptor.flameDeltaZ + descriptor.flameStartZ; - front.rotateFromXN(p); - p[0] += tileEntity.xCoord + 0.5;p[1] += tileEntity.yCoord+0.5;p[2] += tileEntity.zCoord+0.5; - tileEntity.worldObj.spawnParticle("flame",p[0],p[1],p[2], 0.0D, 0.0D, 0.0D); - }*/ + interpolator.step(deltaT); + + counter += deltaT * 60; + if (counter >= 360f) + counter -= 360; + } + float counter = 0; - + TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(4, 64, this); boolean boot = true; + @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { // TODO Auto-generated method stub return new HeatFurnaceGuiDraw(player, inventory, this); } - - @Override public void networkUnserialize(DataInputStream stream) { // TODO Auto-generated method stub @@ -94,31 +90,27 @@ public void networkUnserialize(DataInputStream stream) { try { controleExternal = stream.readBoolean(); takeFuel = stream.readBoolean(); - - - temperature = stream.readShort() /NodeBase.networkSerializeTFactor; + + temperature = stream.readShort() / NodeBase.networkSerializeTFactor; float readF; readF = stream.readFloat(); - if(gainSyncValue != readF || controleExternal) + if (gainSyncValue != readF || controleExternal) { gainSyncValue = readF; gainSyncNew = true; } readF = stream.readFloat(); - if(temperatureTargetSyncValue!= readF || controleExternal) + if (temperatureTargetSyncValue != readF || controleExternal) { temperatureTargetSyncValue = readF; temperatureTargetSyncNew = true; } - - + power = stream.readShort(); - - - entityItemIn = unserializeItemStackToEntityItem(stream,entityItemIn); - - - if(boot) + + entityItemIn = unserializeItemStackToEntityItem(stream, entityItemIn); + + if (boot) { coord.move(front); //coord.move(front); @@ -127,58 +119,59 @@ public void networkUnserialize(DataInputStream stream) { } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - - + public void clientToogleControl() { clientSendId(HeatFurnaceElement.unserializeToogleControlExternalId); - } + } + public void clientToogleTakeFuel() { clientSendId(HeatFurnaceElement.unserializeToogleTakeFuelId); } + EntityItem entityItemIn; + public void clientSetGain(float value) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream stream = new DataOutputStream(bos); - - preparePacketForServer(stream); - + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream stream = new DataOutputStream(bos); + + preparePacketForServer(stream); + stream.writeByte(HeatFurnaceElement.unserializeGain); stream.writeFloat(value); - + sendPacketToServer(bos); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + public void clientSetTemperatureTarget(float value) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream stream = new DataOutputStream(bos); - - preparePacketForServer(stream); - + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream stream = new DataOutputStream(bos); + + preparePacketForServer(stream); + stream.writeByte(HeatFurnaceElement.unserializeTemperatureTarget); stream.writeFloat(value); - + sendPacketToServer(bos); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - - + @Override public boolean cameraDrawOptimisation() { // TODO Auto-generated method stub diff --git a/mods/eln/lampsocket/LampSocketRender.java b/mods/eln/lampsocket/LampSocketRender.java index 5639e984a..be99ed89e 100644 --- a/mods/eln/lampsocket/LampSocketRender.java +++ b/mods/eln/lampsocket/LampSocketRender.java @@ -41,12 +41,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.EnumSkyBlock; +public class LampSocketRender extends SixNodeElementRender { -public class LampSocketRender extends SixNodeElementRender{ - - LampSocketDescriptor lampSocketDescriptor = null; LampSocketDescriptor descriptor; + public LampSocketRender(SixNodeEntity tileEntity, Direction side, SixNodeDescriptor descriptor) { super(tileEntity, side, descriptor); @@ -58,15 +57,11 @@ public LampSocketRender(SixNodeEntity tileEntity, Direction side, SixNodeElementInventory inventory = new SixNodeElementInventory(2, 64, this);; boolean grounded = true; public boolean poweredByLampSupply; - - - - @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { // TODO Auto-generated method stub - return new LampSocketGuiDraw(player, inventory,this); + return new LampSocketGuiDraw(player, inventory, this); } @Override @@ -74,87 +69,88 @@ public IInventory getInventory() { // TODO Auto-generated method stub return inventory; } - - float pertuVy = 0,pertuPy = 0; - float pertuVz = 0,pertuPz = 0; - float weatherAlphaZ = 0,weatherAlphaY = 0; - + + float pertuVy = 0, pertuPy = 0; + float pertuVz = 0, pertuPz = 0; + float weatherAlphaZ = 0, weatherAlphaY = 0; + List entityList = new ArrayList(); float entityTimout = 0; + @Override public void draw() { super.draw(); - - if(descriptor.render instanceof LampSocketSuspendedObjRender){ - float dt = FrameTime.get(); - /*if(Math.random() < 0.2*dt || (pertuVy == 0 && pertuPy == 0)){ - pertuVy += Math.random(); - } - if(Math.random() < 0.2*dt || (pertuVz == 0 && pertuPz == 0)){ - pertuVz += Math.random(); - }*/ + + + + descriptor.render.draw(this); + + } + + @Override + public void refresh(float deltaT) { + if (descriptor.render instanceof LampSocketSuspendedObjRender) { + float dt = deltaT; + entityTimout -= dt; - if(entityTimout < 0){ - entityList = tileEntity.getWorldObj().getEntitiesWithinAABB(Entity.class, new Coordonate(tileEntity.xCoord,tileEntity.yCoord-2,tileEntity.zCoord,tileEntity.getWorldObj()).getAxisAlignedBB(2)); + if (entityTimout < 0) { + entityList = tileEntity.getWorldObj().getEntitiesWithinAABB(Entity.class, new Coordonate(tileEntity.xCoord, tileEntity.yCoord - 2, tileEntity.zCoord, tileEntity.getWorldObj()).getAxisAlignedBB(2)); entityTimout = 0.1f; } - - for (Object o : entityList ) { + + for (Object o : entityList) { Entity e = (Entity) o; float eFactor = 0; - if(e instanceof EntityArrow) eFactor = 1f; - if(e instanceof EntityLivingBase) eFactor = 4f; + if (e instanceof EntityArrow) + eFactor = 1f; + if (e instanceof EntityLivingBase) + eFactor = 4f; - if(eFactor == 0) continue; + if (eFactor == 0) + continue; pertuVz += e.motionX * eFactor * dt; pertuVy += e.motionZ * eFactor * dt; } - - if(tileEntity.getWorldObj().getSavedLightValue(EnumSkyBlock.Sky, tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord) > 3){ - float weather = (float) Utils.getWeather(tileEntity.getWorldObj())*0.9f+0.1f; - - weatherAlphaY += (0.4-Math.random())*dt*Math.PI/0.2*weather; - weatherAlphaZ += (0.4-Math.random())*dt*Math.PI/0.2*weather; - if(weatherAlphaY > 2*Math.PI) weatherAlphaY -= 2*Math.PI; - if(weatherAlphaZ > 2*Math.PI) weatherAlphaZ -= 2*Math.PI; - pertuVy += Math.random()*Math.sin(weatherAlphaY)*weather*weather*dt*3; - pertuVz += Math.random()*Math.cos(weatherAlphaY)*weather*weather*dt*3; - - pertuVy += 0.4 * dt * weather*Math.signum(pertuVy) * Math.random(); - pertuVz += 0.4 * dt * weather*Math.signum(pertuVz) * Math.random(); + if (tileEntity.getWorldObj().getSavedLightValue(EnumSkyBlock.Sky, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) > 3) { + float weather = (float) Utils.getWeather(tileEntity.getWorldObj()) * 0.9f + 0.1f; + + weatherAlphaY += (0.4 - Math.random()) * dt * Math.PI / 0.2 * weather; + weatherAlphaZ += (0.4 - Math.random()) * dt * Math.PI / 0.2 * weather; + if (weatherAlphaY > 2 * Math.PI) + weatherAlphaY -= 2 * Math.PI; + if (weatherAlphaZ > 2 * Math.PI) + weatherAlphaZ -= 2 * Math.PI; + pertuVy += Math.random() * Math.sin(weatherAlphaY) * weather * weather * dt * 3; + pertuVz += Math.random() * Math.cos(weatherAlphaY) * weather * weather * dt * 3; + + pertuVy += 0.4 * dt * weather * Math.signum(pertuVy) * Math.random(); + pertuVz += 0.4 * dt * weather * Math.signum(pertuVz) * Math.random(); } - - - pertuVy -= pertuPy/10*dt; - pertuVy *= (1-0.2*dt); + + pertuVy -= pertuPy / 10 * dt; + pertuVy *= (1 - 0.2 * dt); pertuPy += pertuVy; - - pertuVz -= pertuPz/10*dt; - pertuVz *= (1-0.2*dt); + + pertuVz -= pertuPz / 10 * dt; + pertuVz *= (1 - 0.2 * dt); pertuPz += pertuVz; } - - descriptor.render.draw(this); - - - - - } + public String channel; LampDescriptor lampDescriptor = null; float alphaZ; - byte light,oldLight =-1; - - void setLight(byte newLight){ + byte light, oldLight = -1; + + void setLight(byte newLight) { light = newLight; - if(lampDescriptor != null && lampDescriptor.type == Type.eco && oldLight != -1 && oldLight < 9 && light >= 9){ + if (lampDescriptor != null && lampDescriptor.type == Type.eco && oldLight != -1 && oldLight < 9 && light >= 9) { play(new SoundCommand("eln:neon_lamp").mulVolume(1, 1f).smallRange()); } oldLight = light; } - + @Override public void publishUnserialize(DataInputStream stream) { // TODO Auto-generated method stub @@ -162,25 +158,26 @@ public void publishUnserialize(DataInputStream stream) { try { Byte b; b = stream.readByte(); - grounded = (b & (1<<6)) != 0; - + grounded = (b & (1 << 6)) != 0; + ItemStack lampStack = Utils.unserialiseItemStack(stream); lampDescriptor = (LampDescriptor) Utils.getItemObject(lampStack); alphaZ = stream.readFloat(); - cable = (ElectricalCableDescriptor) ElectricalCableDescriptor.getDescriptor(Utils.unserialiseItemStack(stream),ElectricalCableDescriptor.class); - + cable = (ElectricalCableDescriptor) ElectricalCableDescriptor.getDescriptor(Utils.unserialiseItemStack(stream), ElectricalCableDescriptor.class); + poweredByLampSupply = stream.readBoolean(); channel = stream.readUTF(); - + isConnectedToLampSupply = stream.readBoolean(); - + setLight(stream.readByte()); - + } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } + @Override public void serverPacketUnserialize(DataInputStream stream) throws IOException { @@ -188,46 +185,46 @@ public void serverPacketUnserialize(DataInputStream stream) super.serverPacketUnserialize(stream); setLight(stream.readByte()); } - + public boolean isConnectedToLampSupply; - + ElectricalCableDescriptor cable; - public boolean getGrounded() { return grounded; } + public void setGrounded(boolean grounded) { this.grounded = grounded; } - - + @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { - if(cable == null) return null; + if (cable == null) + return null; return cable.render; } + public void clientSetGrounded(boolean value) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream stream = new DataOutputStream(bos); - - preparePacketForServer(stream); - + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream stream = new DataOutputStream(bos); + + preparePacketForServer(stream); + stream.writeByte(LampSocketElement.setGroundedId); stream.writeByte(value ? 1 : 0); - + sendPacketToServer(bos); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - - + @Override public boolean cameraDrawOptimisation() { return descriptor.cameraOpt; diff --git a/mods/eln/lampsupply/LampSupplyRender.java b/mods/eln/lampsupply/LampSupplyRender.java index 2fc8bd271..4f1b09047 100644 --- a/mods/eln/lampsupply/LampSupplyRender.java +++ b/mods/eln/lampsupply/LampSupplyRender.java @@ -21,74 +21,72 @@ import mods.eln.node.SixNodeElementRender; import mods.eln.node.SixNodeEntity; -public class LampSupplyRender extends SixNodeElementRender{ +public class LampSupplyRender extends SixNodeElementRender { - LampSupplyDescriptor descriptor; + public LampSupplyRender(SixNodeEntity tileEntity, Direction side, SixNodeDescriptor descriptor) { super(tileEntity, side, descriptor); this.descriptor = (LampSupplyDescriptor) descriptor; - interpolator = new PhysicalInterpolator(0.4f,8.0f,0.9f,0.2f); + interpolator = new PhysicalInterpolator(0.4f, 8.0f, 0.9f, 0.2f); coord = new Coordonate(tileEntity); } + Coordonate coord; PhysicalInterpolator interpolator; + @Override - public void draw() { + public void draw() { super.draw(); - - - - - if(Utils.isPlayerAround(tileEntity.getWorldObj(),coord.getAxisAlignedBB(1)) == false) + + drawPowerPin(new float[] { 4, 4, 5, 5 }); + + LRDU.Down.glRotateOnX(); + descriptor.draw(interpolator.get()); + } + + @Override + public void refresh(float deltaT) { + + if (Utils.isPlayerAround(tileEntity.getWorldObj(), coord.getAxisAlignedBB(1)) == false) interpolator.setTarget(0f); else interpolator.setTarget(1f); - - - interpolator.stepGraphic(); - - - drawPowerPin(new float[]{4,4,5,5}); - - LRDU.Down.glRotateOnX(); - descriptor.draw(interpolator.get()); + + interpolator.step(deltaT); + } - - - + @Override public CableRenderDescriptor getCableRender(LRDU lrdu) { // TODO Auto-generated method stub return cableRender; } - - - + @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { // TODO Auto-generated method stub - return new LampSupplyGui(this,player,inventory); + return new LampSupplyGui(this, player, inventory); } - + String channel; - + CableRenderDescriptor cableRender; - + @Override public void publishUnserialize(DataInputStream stream) { // TODO Auto-generated method stub super.publishUnserialize(stream); try { channel = stream.readUTF(); - + ItemStack cableStack = Utils.unserialiseItemStack(stream); - if(cableStack != null){ + if (cableStack != null) { ElectricalCableDescriptor desc = (ElectricalCableDescriptor) ElectricalCableDescriptor.getDescriptor(cableStack); cableRender = desc.render; } - else{ + else { cableRender = null; } } catch (IOException e) { @@ -97,9 +95,5 @@ public void publishUnserialize(DataInputStream stream) { } } - - - - SixNodeElementInventory inventory = new SixNodeElementInventory(1, 64, this); } diff --git a/mods/eln/misc/PhysicalInterpolator.java b/mods/eln/misc/PhysicalInterpolator.java index 512636934..eb0012f1f 100644 --- a/mods/eln/misc/PhysicalInterpolator.java +++ b/mods/eln/misc/PhysicalInterpolator.java @@ -46,10 +46,10 @@ public void step(float deltaT) factorSpeed = -factorSpeed * rebond; } } - public void stepGraphic() + /*public void stepGraphic() { step(FrameTime.get()); - } + }*/ public float get() { return factorPos; diff --git a/mods/eln/misc/RcInterpolator.java b/mods/eln/misc/RcInterpolator.java index 1ea4cba7b..745cb4e44 100644 --- a/mods/eln/misc/RcInterpolator.java +++ b/mods/eln/misc/RcInterpolator.java @@ -20,10 +20,10 @@ public void step(float deltaT) } float factor,factorFiltred; - public void stepGraphic() + /*public void stepGraphic() { step(FrameTime.get()); - } + }*/ public float get() { return factorFiltred; diff --git a/mods/eln/misc/RcRcInterpolator.java b/mods/eln/misc/RcRcInterpolator.java index 1abb68ee9..e894882c4 100644 --- a/mods/eln/misc/RcRcInterpolator.java +++ b/mods/eln/misc/RcRcInterpolator.java @@ -23,10 +23,10 @@ public void step(float deltaT) } - public void stepGraphic() + /*public void stepGraphic() { step(FrameTime.get()); - } + }*/ public float get() { return c2; diff --git a/mods/eln/misc/UtilsClient.java b/mods/eln/misc/UtilsClient.java index eb7c0c0f3..c701e212a 100644 --- a/mods/eln/misc/UtilsClient.java +++ b/mods/eln/misc/UtilsClient.java @@ -437,7 +437,7 @@ static public void drawConnectionPinSixNode(LRDU front,float[] dList,float w,flo //front.glRotateOnX(); //drawConnectionPinSixNode(d[front.toInt()], w, h); float d = dList[front.toInt()]; - d+=0.1f; + d+=0.04f; d*=0.0625f; w*=0.0625f; h*=0.0625f; diff --git a/mods/eln/modbusrtu/ModbusRtuRender.java b/mods/eln/modbusrtu/ModbusRtuRender.java index 8d2579ffd..1d545b076 100644 --- a/mods/eln/modbusrtu/ModbusRtuRender.java +++ b/mods/eln/modbusrtu/ModbusRtuRender.java @@ -44,59 +44,62 @@ import com.google.common.base.CaseFormat; - -public class ModbusRtuRender extends SixNodeElementRender{ +public class ModbusRtuRender extends SixNodeElementRender { Coordonate coord; PhysicalInterpolator interpolator; float modbusActivityTimeout = 0; float modbusErrorTimeout = 0; - + ModbusRtuDescriptor descriptor; - public ModbusRtuRender(SixNodeEntity tileEntity, Direction side,SixNodeDescriptor descriptor) { - super(tileEntity,side,descriptor); + + public ModbusRtuRender(SixNodeEntity tileEntity, Direction side, SixNodeDescriptor descriptor) { + super(tileEntity, side, descriptor); this.descriptor = (ModbusRtuDescriptor) descriptor; - - interpolator = new PhysicalInterpolator(0.4f,8.0f,0.9f,0.2f); + + interpolator = new PhysicalInterpolator(0.4f, 8.0f, 0.9f, 0.2f); coord = new Coordonate(tileEntity); } - - HashMap wirelessTxStatusList = new HashMap(); - HashMap wirelessRxStatusList = new HashMap(); - + HashMap wirelessTxStatusList = new HashMap(); + HashMap wirelessRxStatusList = new HashMap(); + @Override public void draw() { super.draw(); // TODO Auto-generated method stub - if(Utils.isPlayerAround(tileEntity.getWorldObj(),coord.getAxisAlignedBB(0)) == false) + LRDU.Down.glRotateOnX(); + + descriptor.draw(interpolator.get(), modbusActivityTimeout > 0, modbusErrorTimeout > 0); + + } + + @Override + public void refresh(float deltaT) { + if (Utils.isPlayerAround(tileEntity.getWorldObj(), coord.getAxisAlignedBB(0)) == false) interpolator.setTarget(0f); else interpolator.setTarget(1f); - - - interpolator.stepGraphic(); - - LRDU.Down.glRotateOnX(); - - descriptor.draw(interpolator.get(), modbusActivityTimeout > 0, modbusErrorTimeout > 0); - - if (modbusActivityTimeout > 0) - modbusActivityTimeout -= FrameTime.get(); - - if (modbusErrorTimeout > 0) - modbusErrorTimeout -= FrameTime.get(); + + interpolator.step(deltaT); + + if (modbusActivityTimeout > 0) + modbusActivityTimeout -= deltaT; + + if (modbusErrorTimeout > 0) + modbusErrorTimeout -= deltaT; } int station = -1; String name; boolean boot = true; + @Override public void publishUnserialize(DataInputStream stream) { // TODO Auto-generated method stub super.publishUnserialize(stream); - + try { station = stream.readInt(); name = stream.readUTF(); @@ -104,96 +107,89 @@ public void publishUnserialize(DataInputStream stream) { // TODO Auto-generated catch block e.printStackTrace(); } - - if(boot) + + if (boot) clientSend(ModbusRtuElement.serverAllSyncronise); boot = false; - + } - @Override public void serverPacketUnserialize(DataInputStream stream) throws IOException { // TODO Auto-generated method stub super.serverPacketUnserialize(stream); - + switch (stream.readByte()) { - case ModbusRtuElement.clientAllSyncronise: - { + case ModbusRtuElement.clientAllSyncronise: { wirelessTxStatusList.clear(); - for(int idx = stream.readInt();idx > 0;idx--){ + for (int idx = stream.readInt(); idx > 0; idx--) { WirelessTxStatus tx = new WirelessTxStatus(); tx.readFrom(stream); wirelessTxStatusList.put(tx.uuid, tx); } wirelessRxStatusList.clear(); - for(int idx = stream.readInt();idx > 0;idx--){ + for (int idx = stream.readInt(); idx > 0; idx--) { WirelessRxStatus rx = new WirelessRxStatus(); rx.readFrom(stream); wirelessRxStatusList.put(rx.uuid, rx); } - - + rxTxChange = true; } - break; - case ModbusRtuElement.clientTx1Syncronise: - { + break; + case ModbusRtuElement.clientTx1Syncronise: { WirelessTxStatus newTx = new WirelessTxStatus(); newTx.readFrom(stream); wirelessTxStatusList.put(newTx.uuid, newTx); rxTxChange = true; } - break; - case ModbusRtuElement.clientRx1Syncronise: - { + break; + case ModbusRtuElement.clientRx1Syncronise: { WirelessRxStatus newRx = new WirelessRxStatus(); newRx.readFrom(stream); wirelessRxStatusList.put(newRx.uuid, newRx); rxTxChange = true; } - break; - case ModbusRtuElement.clientTxDelete: - { + break; + case ModbusRtuElement.clientTxDelete: { wirelessTxStatusList.remove(stream.readInt()); rxTxChange = true; } - break; - case ModbusRtuElement.clientRxDelete: - { + break; + case ModbusRtuElement.clientRxDelete: { wirelessRxStatusList.remove(stream.readInt()); rxTxChange = true; } - break; + break; case ModbusRtuElement.clientRx1Connected: WirelessRxStatus rx = wirelessRxStatusList.get(stream.readInt()); - if(rx != null){ + if (rx != null) { rx.connected = stream.readBoolean(); } break; - + case ModbusRtuElement.ClientModbusActivityEvent: modbusActivityTimeout = 0.05f; break; - + case ModbusRtuElement.ClientModbusErrorEvent: modbusErrorTimeout = 1f; break; } } - + boolean rxTxChange = false; - + @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { // TODO Auto-generated method stub return new ModbusRtuGui(player, this); } - public CableRenderDescriptor getCableRender(LRDU lrdu) - { - return Eln.instance.signalCableDescriptor.render; - } + public CableRenderDescriptor getCableRender(LRDU lrdu) + { + return Eln.instance.signalCableDescriptor.render; + } } diff --git a/mods/eln/node/NodeBlockEntity.java b/mods/eln/node/NodeBlockEntity.java index ef5959de9..d5ea5030b 100644 --- a/mods/eln/node/NodeBlockEntity.java +++ b/mods/eln/node/NodeBlockEntity.java @@ -418,4 +418,7 @@ public boolean canConnectRedstone(Direction xn) { return getNode().canConnectRedstone(); } } + public void clientRefresh(float deltaT) { + + } } diff --git a/mods/eln/node/SixNodeElementRender.java b/mods/eln/node/SixNodeElementRender.java index 5235fb6e5..d57f9e33f 100644 --- a/mods/eln/node/SixNodeElementRender.java +++ b/mods/eln/node/SixNodeElementRender.java @@ -368,6 +368,11 @@ public void serverPacketUnserialize(DataInputStream stream) throws IOException { public void notifyNeighborSpawn() { needRedraw = true; + } + + public void refresh(float deltaT) { + // TODO Auto-generated method stub + } diff --git a/mods/eln/node/SixNodeEntity.java b/mods/eln/node/SixNodeEntity.java index d9093f5a8..829dac799 100644 --- a/mods/eln/node/SixNodeEntity.java +++ b/mods/eln/node/SixNodeEntity.java @@ -234,6 +234,15 @@ public INodeInfo getInfo() { // TODO Auto-generated method stub return Eln.sixNodeBlock; } + + @Override + public void clientRefresh(float deltaT) { + for(SixNodeElementRender e : elementRenderList){ + if(e != null){ + e.refresh(deltaT); + } + } + } } // && \ No newline at end of file diff --git a/mods/eln/node/TransparentNodeElementRender.java b/mods/eln/node/TransparentNodeElementRender.java index a51707b25..34e16f0a2 100644 --- a/mods/eln/node/TransparentNodeElementRender.java +++ b/mods/eln/node/TransparentNodeElementRender.java @@ -277,4 +277,8 @@ public void destructor() if(usedUuid()) ClientProxy.uuidManager.kill(uuid); } + public void refresh(float deltaT) { + // TODO Auto-generated method stub + + } } diff --git a/mods/eln/node/TransparentNodeEntity.java b/mods/eln/node/TransparentNodeEntity.java index d0f60572b..c22e568d5 100644 --- a/mods/eln/node/TransparentNodeEntity.java +++ b/mods/eln/node/TransparentNodeEntity.java @@ -189,5 +189,12 @@ public void destructor() { super.destructor(); } + + @Override + public void clientRefresh(float deltaT) { + if(elementRender != null){ + elementRender.refresh(deltaT); + } + } } // && \ No newline at end of file diff --git a/mods/eln/solarpannel/SolarPannelRender.java b/mods/eln/solarpannel/SolarPannelRender.java index e6187a88f..dca38b731 100644 --- a/mods/eln/solarpannel/SolarPannelRender.java +++ b/mods/eln/solarpannel/SolarPannelRender.java @@ -26,11 +26,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; - -public class SolarPannelRender extends TransparentNodeElementRender{ +public class SolarPannelRender extends TransparentNodeElementRender { public SolarPannelDescriptor descriptor; private CableRenderType renderPreProcess; + public SolarPannelRender(TransparentNodeEntity tileEntity, TransparentNodeDescriptor descriptor) { super(tileEntity, descriptor); @@ -40,14 +40,20 @@ public SolarPannelRender(TransparentNodeEntity tileEntity, RcInterpolator interpol = new RcInterpolator(1f); boolean boot = true; + @Override public void draw() { - float alpha; renderPreProcess = drawCable(Direction.YN, descriptor.cableRender, eConn, renderPreProcess); - - - if(hasTracker == false) + + descriptor.draw((float) (interpol.get() * 180 / Math.PI - 90), front); + + } + + @Override + public void refresh(float deltaT) { + float alpha; + if (hasTracker == false) { alpha = (float) descriptor.alphaTrunk(pannelAlphaSyncValue); } @@ -56,94 +62,85 @@ public void draw() { alpha = (float) descriptor.alphaTrunk(SolarPannelSlowProcess.getSolarAlpha(tileEntity.getWorldObj())); } interpol.setTarget(alpha); - if(boot){ + if (boot) { boot = false; interpol.setValueFromTarget(); } - - interpol.stepGraphic(); - - descriptor.draw((float) (interpol.get()*180/Math.PI - 90),front); - - + + interpol.step(deltaT); } @Override public CableRenderDescriptor getCableRender(Direction side, LRDU lrdu) { return descriptor.cableRender; } - - - public boolean pannelAlphaSyncNew = false; public float pannelAlphaSyncValue = -1234; - + public boolean hasTracker; - - + LRDUMask eConn = new LRDUMask(); + @Override public void networkUnserialize(DataInputStream stream) { // TODO Auto-generated method stub super.networkUnserialize(stream); - + short read; - + try { - + Byte b; - - + hasTracker = stream.readBoolean(); - + float pannelAlphaIncoming = stream.readFloat(); - - if(pannelAlphaIncoming != pannelAlphaSyncValue) + + if (pannelAlphaIncoming != pannelAlphaSyncValue) { pannelAlphaSyncValue = pannelAlphaIncoming; pannelAlphaSyncNew = true; } - + eConn.deserialize(stream); - + renderPreProcess = null; - + } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } - + public void clientSetPannelAlpha(float value) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream stream = new DataOutputStream(bos); - - preparePacketForServer(stream); - + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + DataOutputStream stream = new DataOutputStream(bos); + + preparePacketForServer(stream); + stream.writeByte(SolarPannelElement.unserializePannelAlpha); stream.writeFloat(value); - + sendPacketToServer(bos); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - - TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(1 , 64, this); + + TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(1, 64, this); @Override public GuiScreen newGuiDraw(Direction side, EntityPlayer player) { // TODO Auto-generated method stub return new SolarPannelGuiDraw(player, inventory, this); } - - + @Override public boolean cameraDrawOptimisation() { // TODO Auto-generated method stub diff --git a/mods/eln/teleporter/TeleporterRender.java b/mods/eln/teleporter/TeleporterRender.java index 7dfbfb5fb..09cf38ea7 100644 --- a/mods/eln/teleporter/TeleporterRender.java +++ b/mods/eln/teleporter/TeleporterRender.java @@ -53,20 +53,9 @@ public void draw() { boolean lightEnable = tileEntity.getWorldObj().getBlock(lightCoordonate.x, lightCoordonate.y, lightCoordonate.z) == Eln.lightBlock; - counter += FrameTime.get(); - if(counter > 0.4){ - counter = 0; - blink = ! blink; - } - ledCounter += FrameTime.get(); - if(ledCounter > 0.1){ - ledCounter = 0; - } + - doorInterpolator.stepGraphic(); - processRatioInterpolator.stepGraphic(); - blueInterpolator.setTarget(processRatioInterpolator.get() > 0.1 && (! doorState)? 1f : 0f); - blueInterpolator.stepGraphic(); + front.glRotateXnRef(); GL11.glTranslatef(-1, 0, 0); @@ -168,8 +157,7 @@ public void draw() { - gyroAlpha +=360*FrameTime.get()*(1.0f -doorInterpolator.get()); - if(gyroAlpha >= 360) gyroAlpha -=360; + /* door_in_charge = obj.getPart("door_in_charge"); door_in = obj.getPart("door_in"); @@ -178,6 +166,29 @@ public void draw() { */ } + + + @Override + public void refresh(float deltaT) { + + doorInterpolator.step(deltaT); + processRatioInterpolator.step(deltaT); + blueInterpolator.setTarget(processRatioInterpolator.get() > 0.1 && (! doorState)? 1f : 0f); + blueInterpolator.step(deltaT); + + counter += deltaT; + if(counter > 0.4){ + counter = 0; + blink = ! blink; + } + ledCounter += deltaT; + if(ledCounter > 0.1){ + ledCounter = 0; + } + gyroAlpha +=360*deltaT*(1.0f -doorInterpolator.get()); + if(gyroAlpha >= 360) gyroAlpha -=360; + } + float voltage; String name,targetName; float chargePower,chargePowerLast,energyHit/*,energyTarget,chargeRatio*/; diff --git a/mods/eln/thermaldissipatoractive/ThermalDissipatorActiveRender.java b/mods/eln/thermaldissipatoractive/ThermalDissipatorActiveRender.java index 24d77eed5..82b471277 100644 --- a/mods/eln/thermaldissipatoractive/ThermalDissipatorActiveRender.java +++ b/mods/eln/thermaldissipatoractive/ThermalDissipatorActiveRender.java @@ -22,12 +22,18 @@ public ThermalDissipatorActiveRender(TransparentNodeEntity tileEntity, public void draw() { front.glRotateXnRef(); + + descriptor.draw(alpha); + } + + @Override + public void refresh(float deltaT) { rc.setTarget(powerFactor); - rc.stepGraphic(); - alpha += rc.get() * 360f * FrameTime.get(); + rc.step(deltaT); + alpha += rc.get() * 360f * deltaT; while(alpha > 360f) alpha -= 360f; - descriptor.draw(alpha); } + float alpha = 0; float powerFactor; @Override diff --git a/mods/eln/waterturbine/WaterTurbineRender.java b/mods/eln/waterturbine/WaterTurbineRender.java index 2e44d36df..efe71dc13 100644 --- a/mods/eln/waterturbine/WaterTurbineRender.java +++ b/mods/eln/waterturbine/WaterTurbineRender.java @@ -36,26 +36,31 @@ public WaterTurbineRender(TransparentNodeEntity tileEntity, @Override public void draw() { // front.glRotateXnRef(); + + front.glRotateXnRef(); + descriptor.draw(alpha); + + } + + + public void refresh(float deltaT) { float flowDir = waterCoord.getMeta() > waterCoordRight.getMeta() ? 1 : -1; if (Utils.isWater(waterCoord) == false) flowDir = 0; dirFilter.setTarget(flowDir); - dirFilter.stepGraphic(); + dirFilter.step(deltaT); powerFactorFilter.setTarget((float) (dirFilter.get() * Math.sqrt(powerFactor))); - powerFactorFilter.stepGraphic(); + powerFactorFilter.step(deltaT); // Utils.println(powerFactorFilter.get()); float alphaN_1 = alpha; - alpha += FrameTime.get() * descriptor.speed * (powerFactorFilter.get()); + alpha += deltaT * descriptor.speed * (powerFactorFilter.get()); if (alpha > 360) alpha -= 360; if (alpha < 0) - alpha += 360; - front.glRotateXnRef(); - descriptor.draw(alpha); - - // if (Math.signum((alpha % 45) - 40f) != Math.signum((alphaN_1 % 45) - 40f) && soundPlaying == false) { + alpha += 360; + if ((int)(alpha/45) != (int)(alphaN_1/45) && soundPlaying == false) { Coordonate coord = coordonate(); play(new SoundCommand(descriptor.soundName) @@ -67,6 +72,8 @@ public void draw() { soundPlaying = false; } + + TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(0, 64, this); private float water; private float powerFactor; diff --git a/mods/eln/windturbine/WindTurbineRender.java b/mods/eln/windturbine/WindTurbineRender.java index eab8cec3c..95b0da47f 100644 --- a/mods/eln/windturbine/WindTurbineRender.java +++ b/mods/eln/windturbine/WindTurbineRender.java @@ -30,14 +30,17 @@ public WindTurbineRender(TransparentNodeEntity tileEntity, float alpha = (float) (Math.random()*360); @Override public void draw() { + front.glRotateXnRef(); + descriptor.draw(alpha); + } + + + public void refresh(float deltaT) { powerFactorFilter.setTarget(powerFactor); - powerFactorFilter.stepGraphic(); + powerFactorFilter.step(deltaT); float alphaN_1 = alpha; - alpha += FrameTime.get() * descriptor.speed * Math.sqrt(powerFactorFilter.get()); - if(alpha > 360) alpha -= 360; - front.glRotateXnRef(); - descriptor.draw(alpha); - + alpha += deltaT * descriptor.speed * Math.sqrt(powerFactorFilter.get()); + if(alpha > 360) alpha -= 360; if (alpha % 120 > 45 && alphaN_1 % 120 <= 45 && soundPlaying == false) { Coordonate coord = coordonate(); this.play(new SoundCommand(descriptor.soundName) @@ -48,7 +51,7 @@ public void draw() { } else { soundPlaying = false; } - + } TransparentNodeElementInventory inventory = new TransparentNodeElementInventory(0 , 64, this);