Fixed laggy renderer
This commit is contained in:
parent
23b939d7aa
commit
32317b4b68
5 changed files with 28 additions and 15 deletions
|
@ -6,11 +6,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import resonantinduction.base.Vector3;
|
import resonantinduction.base.Vector3;
|
||||||
import resonantinduction.battery.GuiBattery;
|
|
||||||
import resonantinduction.battery.TileEntityBattery;
|
import resonantinduction.battery.TileEntityBattery;
|
||||||
import resonantinduction.contractor.TileEntityEMContractor;
|
import resonantinduction.contractor.TileEntityEMContractor;
|
||||||
import resonantinduction.fx.FXElectricBolt;
|
import resonantinduction.fx.FXElectricBolt;
|
||||||
import resonantinduction.multimeter.GuiMultimeter;
|
import resonantinduction.gui.GuiBattery;
|
||||||
|
import resonantinduction.gui.GuiMultimeter;
|
||||||
import resonantinduction.multimeter.TileEntityMultimeter;
|
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||||
import resonantinduction.render.BlockRenderingHandler;
|
import resonantinduction.render.BlockRenderingHandler;
|
||||||
import resonantinduction.render.RenderBattery;
|
import resonantinduction.render.RenderBattery;
|
||||||
|
|
|
@ -49,11 +49,6 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
|
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if (playersUsing.size() > 0)
|
|
||||||
{
|
|
||||||
this.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ticks == 5 && !structure.isMultiblock)
|
if (ticks == 5 && !structure.isMultiblock)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
@ -100,13 +95,18 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
player.closeScreen();
|
player.closeScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketHandler.sendTileEntityPacketToClients(this, getNetworkedData(new ArrayList()).toArray());
|
updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
prevStructure = structure;
|
prevStructure = structure;
|
||||||
|
|
||||||
structure.wroteInventory = false;
|
structure.wroteInventory = false;
|
||||||
structure.didTick = false;
|
structure.didTick = false;
|
||||||
|
|
||||||
|
if(playersUsing.size() > 0)
|
||||||
|
{
|
||||||
|
updateInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package resonantinduction.battery;
|
package resonantinduction.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
@ -8,6 +8,8 @@ import net.minecraft.util.StatCollector;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
|
import resonantinduction.battery.ContainerBattery;
|
||||||
|
import resonantinduction.battery.TileEntityBattery;
|
||||||
|
|
||||||
public class GuiBattery extends GuiContainer
|
public class GuiBattery extends GuiContainer
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package resonantinduction.multimeter;
|
package resonantinduction.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
@ -13,6 +13,8 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.PacketHandler;
|
import resonantinduction.PacketHandler;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
|
import resonantinduction.multimeter.ContainerMultimeter;
|
||||||
|
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
|
import resonantinduction.base.Vector3;
|
||||||
import resonantinduction.battery.TileEntityBattery;
|
import resonantinduction.battery.TileEntityBattery;
|
||||||
import resonantinduction.model.ModelBattery;
|
import resonantinduction.model.ModelBattery;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -132,13 +133,21 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||||
this.renderItemSimple(this.fakeBattery);
|
|
||||||
GL11.glPopMatrix();
|
Vector3 sideVec = new Vector3(t).getFromSide(direction);
|
||||||
|
|
||||||
if (--renderAmount == 0)
|
if(t.worldObj.isAirBlock((int)sideVec.x, (int)sideVec.y, (int)sideVec.z))
|
||||||
{
|
{
|
||||||
return;
|
this.renderItemSimple(this.fakeBattery);
|
||||||
|
|
||||||
|
if (--renderAmount <= 0)
|
||||||
|
{
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue