diff --git a/common/mekanism/client/model/ModelLogisticalSorter.java b/common/mekanism/client/model/ModelLogisticalSorter.java index 835d52455..97c75743a 100644 --- a/common/mekanism/client/model/ModelLogisticalSorter.java +++ b/common/mekanism/client/model/ModelLogisticalSorter.java @@ -1,5 +1,6 @@ package mekanism.client.model; +import mekanism.client.render.MekanismRenderer; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @@ -189,7 +190,7 @@ public class ModelLogisticalSorter extends ModelBase setRotation(DecorPlate, 0F, 0F, 0F); } - public void render(float size) + public void render(float size, boolean active) { LeftThing.render(size); RightThing.render(size); @@ -197,6 +198,12 @@ public class ModelLogisticalSorter extends ModelBase TopPlate.render(size); LeftPlate.render(size); RightPlate.render(size); + + if(active) + { + MekanismRenderer.glowOn(); + } + BR1Block1.render(size); BL1Block1.render(size); TL1Block1.render(size); @@ -205,6 +212,12 @@ public class ModelLogisticalSorter extends ModelBase BL1Block2.render(size); TL1Block2.render(size); TR1Block2.render(size); + + if(active) + { + MekanismRenderer.glowOff(); + } + PoleBR.render(size); PoleTL.render(size); PoleTR.render(size); diff --git a/common/mekanism/client/render/block/MachineRenderingHandler.java b/common/mekanism/client/render/block/MachineRenderingHandler.java index 8d7aad739..0b2b3df76 100644 --- a/common/mekanism/client/render/block/MachineRenderingHandler.java +++ b/common/mekanism/client/render/block/MachineRenderingHandler.java @@ -71,7 +71,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F); GL11.glTranslatef(0.0F, -0.85F, -0.15F); Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalSorter.png")); - logisticalSorter.render(0.0625F); + logisticalSorter.render(0.0625F, false); } else { MekanismRenderer.renderItem(renderer, metadata, block); diff --git a/common/mekanism/client/render/tileentity/RenderLogisticalSorter.java b/common/mekanism/client/render/tileentity/RenderLogisticalSorter.java index 11bedfa49..869a750ed 100644 --- a/common/mekanism/client/render/tileentity/RenderLogisticalSorter.java +++ b/common/mekanism/client/render/tileentity/RenderLogisticalSorter.java @@ -24,7 +24,7 @@ public class RenderLogisticalSorter extends TileEntitySpecialRenderer GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalSorter.png")); + bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalSorter" + (tileEntity.isActive ? "On" : "") + ".png")); switch(tileEntity.facing) { @@ -47,7 +47,7 @@ public class RenderLogisticalSorter extends TileEntitySpecialRenderer } GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - model.render(0.0625F); + model.render(0.0625F, tileEntity.isActive); GL11.glPopMatrix(); } } diff --git a/common/mekanism/client/sound/SoundHandler.java b/common/mekanism/client/sound/SoundHandler.java index 7f435387a..148cd01e1 100644 --- a/common/mekanism/client/sound/SoundHandler.java +++ b/common/mekanism/client/sound/SoundHandler.java @@ -37,6 +37,8 @@ public class SoundHandler /** The current base volume Minecraft is using. */ public float masterVolume = 0; + public Minecraft mc = Minecraft.getMinecraft(); + /** * SoundHandler -- a class that handles all Sounds used by Mekanism. */ @@ -59,6 +61,8 @@ public class SoundHandler preloadSound(file.getName()); } } + + mc.sndManager.addSound("mekanism:etc/Click.ogg"); } private void preloadSound(String sound) diff --git a/common/mekanism/common/IActiveState.java b/common/mekanism/common/IActiveState.java index cb5ebcd00..13c8b0baf 100644 --- a/common/mekanism/common/IActiveState.java +++ b/common/mekanism/common/IActiveState.java @@ -23,5 +23,7 @@ public interface IActiveState * Whether or not this block has a visual effect when it is on it's active state. Used for rendering. * @return if the block has a visual effect in it's active state */ - public boolean hasVisual(); + public boolean renderUpdate(); + + public boolean lightUpdate(); } diff --git a/common/mekanism/common/block/BlockMachine.java b/common/mekanism/common/block/BlockMachine.java index 72f7bbb91..da92fd230 100644 --- a/common/mekanism/common/block/BlockMachine.java +++ b/common/mekanism/common/block/BlockMachine.java @@ -187,7 +187,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds public void randomDisplayTick(World world, int x, int y, int z, Random random) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z); - if(MekanismUtils.isActive(world, x, y, z) && !(tileEntity instanceof TileEntityChargepad)) + if(MekanismUtils.isActive(world, x, y, z) && !(tileEntity instanceof TileEntityChargepad) && !(tileEntity instanceof TileEntityLogisticalSorter)) { float xRandom = (float)x + 0.5F; float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F; @@ -225,7 +225,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds if(tileEntity instanceof IActiveState) { - if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).hasVisual()) + if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate()) { return 15; } diff --git a/common/mekanism/common/tileentity/TileEntityBasicMachine.java b/common/mekanism/common/tileentity/TileEntityBasicMachine.java index 09259b630..1811031f8 100644 --- a/common/mekanism/common/tileentity/TileEntityBasicMachine.java +++ b/common/mekanism/common/tileentity/TileEntityBasicMachine.java @@ -96,6 +96,16 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp if(worldObj.isRemote) { Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0) + { + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } } if(!worldObj.isRemote) @@ -161,7 +171,11 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp sideConfig[i] = dataStream.readByte(); } - MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + if(updateDelay == 0) + { + updateDelay = Mekanism.UPDATE_DELAY; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } } @Override @@ -377,7 +391,13 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() { return true; } diff --git a/common/mekanism/common/tileentity/TileEntityChargepad.java b/common/mekanism/common/tileentity/TileEntityChargepad.java index cb82e9c68..9abc230de 100644 --- a/common/mekanism/common/tileentity/TileEntityChargepad.java +++ b/common/mekanism/common/tileentity/TileEntityChargepad.java @@ -297,7 +297,13 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() { return true; } diff --git a/common/mekanism/common/tileentity/TileEntityFactory.java b/common/mekanism/common/tileentity/TileEntityFactory.java index d3af96606..d82fd4746 100644 --- a/common/mekanism/common/tileentity/TileEntityFactory.java +++ b/common/mekanism/common/tileentity/TileEntityFactory.java @@ -111,6 +111,16 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg if(worldObj.isRemote) { Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0) + { + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } } if(!worldObj.isRemote) @@ -414,7 +424,11 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg sideConfig[i] = dataStream.readByte(); } - MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + if(updateDelay == 0) + { + updateDelay = Mekanism.UPDATE_DELAY; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } } @Override @@ -721,7 +735,13 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() { return true; } diff --git a/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java b/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java index 87fdac450..21fc14896 100644 --- a/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java +++ b/common/mekanism/common/tileentity/TileEntityLogisticalSorter.java @@ -61,7 +61,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen { delayTicks = Math.max(0, delayTicks-1); - if(delayTicks == 8) + if(delayTicks == 6) { setActive(false); } @@ -94,6 +94,7 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen if(TransporterUtils.insert(this, transporter, inInventory.itemStack, filterColor)) { inventory.setInventorySlotContents(inInventory.slotID, null); + setActive(true); } else { inventory.setInventorySlotContents(inInventory.slotID, inInventory.itemStack); @@ -361,6 +362,11 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen { PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList()))); + if(active) + { + worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mekanism:etc.Click", 0.3F, 1); + } + clientActive = active; } } @@ -372,11 +378,17 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen } @Override - public boolean hasVisual() + public boolean renderUpdate() { return true; } + @Override + public boolean lightUpdate() + { + return false; + } + @Override protected EnumSet getConsumingSides() { diff --git a/common/mekanism/common/tileentity/TileEntityMetallurgicInfuser.java b/common/mekanism/common/tileentity/TileEntityMetallurgicInfuser.java index 0fbd3e8d4..446a2e957 100644 --- a/common/mekanism/common/tileentity/TileEntityMetallurgicInfuser.java +++ b/common/mekanism/common/tileentity/TileEntityMetallurgicInfuser.java @@ -105,6 +105,16 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem if(worldObj.isRemote) { Mekanism.proxy.registerSound(this); + + if(updateDelay > 0) + { + updateDelay--; + + if(updateDelay == 0) + { + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } + } } if(!worldObj.isRemote) @@ -409,7 +419,11 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem sideConfig[i] = dataStream.readByte(); } - MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + if(updateDelay == 0) + { + updateDelay = Mekanism.UPDATE_DELAY; + MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); + } } @Override @@ -616,7 +630,13 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() { return true; } diff --git a/common/mekanism/common/util/MekanismUtils.java b/common/mekanism/common/util/MekanismUtils.java index c2a9beb0c..a9c699a0d 100644 --- a/common/mekanism/common/util/MekanismUtils.java +++ b/common/mekanism/common/util/MekanismUtils.java @@ -604,13 +604,15 @@ public final class MekanismUtils */ public static void updateBlock(World world, int x, int y, int z) { - if(world.getBlockTileEntity(x, y, z) instanceof IActiveState && !((IActiveState)world.getBlockTileEntity(x, y, z)).hasVisual()) + if(!(world.getBlockTileEntity(x, y, z) instanceof IActiveState) || ((IActiveState)world.getBlockTileEntity(x, y, z)).renderUpdate()) { - return; + world.markBlockForRenderUpdate(x, y, z); } - world.markBlockForRenderUpdate(x, y, z); - world.updateAllLightTypes(x, y, z); + if(!(world.getBlockTileEntity(x, y, z) instanceof IActiveState) || ((IActiveState)world.getBlockTileEntity(x, y, z)).lightUpdate()) + { + world.updateAllLightTypes(x, y, z); + } } /** diff --git a/common/mekanism/generators/common/block/BlockGenerator.java b/common/mekanism/generators/common/block/BlockGenerator.java index 5c45dca60..80ad4f76d 100644 --- a/common/mekanism/generators/common/block/BlockGenerator.java +++ b/common/mekanism/generators/common/block/BlockGenerator.java @@ -149,7 +149,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds if(tileEntity instanceof IActiveState && !(tileEntity instanceof TileEntitySolarGenerator)) { - if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).hasVisual()) + if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate()) { return 15; } diff --git a/common/mekanism/generators/common/tileentity/TileEntityGenerator.java b/common/mekanism/generators/common/tileentity/TileEntityGenerator.java index 9dda96aac..50c2a8164 100644 --- a/common/mekanism/generators/common/tileentity/TileEntityGenerator.java +++ b/common/mekanism/generators/common/tileentity/TileEntityGenerator.java @@ -390,7 +390,13 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return true; + } + + @Override + public boolean lightUpdate() { return true; } diff --git a/common/mekanism/generators/common/tileentity/TileEntitySolarGenerator.java b/common/mekanism/generators/common/tileentity/TileEntitySolarGenerator.java index 25be0adb7..72be49bc3 100644 --- a/common/mekanism/generators/common/tileentity/TileEntitySolarGenerator.java +++ b/common/mekanism/generators/common/tileentity/TileEntitySolarGenerator.java @@ -175,7 +175,13 @@ public class TileEntitySolarGenerator extends TileEntityGenerator } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() { return false; } diff --git a/common/mekanism/generators/common/tileentity/TileEntityWindTurbine.java b/common/mekanism/generators/common/tileentity/TileEntityWindTurbine.java index 5f3b6c383..152012f34 100644 --- a/common/mekanism/generators/common/tileentity/TileEntityWindTurbine.java +++ b/common/mekanism/generators/common/tileentity/TileEntityWindTurbine.java @@ -106,7 +106,13 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound } @Override - public boolean hasVisual() + public boolean renderUpdate() + { + return false; + } + + @Override + public boolean lightUpdate() { return false; } diff --git a/resources/assets/mekanism/render/LogisticalSorter.png b/resources/assets/mekanism/render/LogisticalSorter.png index 566db279a..e784fcf3a 100644 Binary files a/resources/assets/mekanism/render/LogisticalSorter.png and b/resources/assets/mekanism/render/LogisticalSorter.png differ diff --git a/resources/assets/mekanism/render/LogisticalSorterOn.png b/resources/assets/mekanism/render/LogisticalSorterOn.png new file mode 100644 index 000000000..039c46ecb Binary files /dev/null and b/resources/assets/mekanism/render/LogisticalSorterOn.png differ diff --git a/resources/assets/mekanism/sound/etc/Click.ogg b/resources/assets/mekanism/sound/etc/Click.ogg new file mode 100644 index 000000000..8f1721ed1 Binary files /dev/null and b/resources/assets/mekanism/sound/etc/Click.ogg differ