Fixed ridiculous client updates when GUI is open, fancy active sorter rendering, sorter eject sound effect :)
This commit is contained in:
parent
8db9c734d7
commit
799142198a
19 changed files with 141 additions and 24 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<ForgeDirection> getConsumingSides()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,13 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasVisual()
|
||||
public boolean renderUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lightUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 6.7 KiB |
BIN
resources/assets/mekanism/render/LogisticalSorterOn.png
Normal file
BIN
resources/assets/mekanism/render/LogisticalSorterOn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
resources/assets/mekanism/sound/etc/Click.ogg
Normal file
BIN
resources/assets/mekanism/sound/etc/Click.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue