From 5cb4c6e24033cf337812390d99a6817d24d21eab Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sun, 12 Feb 2017 20:43:03 +0300 Subject: Removed explosion radius limitations. Explosion calculation optimized (reduced memory usage). One more detonator and explosive pack recipe. GT6 recipes for both chemical reactors and cryogenic distiller. Max stack size of muffle furnace is limited to 32. A lot of old features are removed. --- ihl/collector/ChargerEjectorBlock.java | 90 --- ihl/collector/ChargerEjectorContainer.java | 92 --- ihl/collector/ChargerEjectorGui.java | 128 ---- ihl/collector/ChargerEjectorModel.java | 150 ----- ihl/collector/ChargerEjectorRender.java | 92 --- ihl/collector/ChargerEjectorTileEntity.java | 522 --------------- ihl/collector/CollectorEntity.java | 959 ---------------------------- ihl/collector/CollectorHeavyEntity.java | 305 --------- ihl/collector/CollectorHeavyItem.java | 35 - ihl/collector/CollectorItem.java | 203 ------ ihl/collector/CollectorItemRender.java | 112 ---- ihl/collector/CollectorModel.java | 110 ---- ihl/collector/CollectorRender.java | 112 ---- ihl/collector/GlassBoxContainer.java | 45 -- ihl/collector/GlassBoxGui.java | 44 -- ihl/collector/GlassBoxRender.java | 47 -- ihl/collector/GlassBoxTileEntity.java | 193 ------ ihl/collector/GuiMultiTextureButton.java | 44 -- ihl/collector/InvSlotMultiCharge.java | 96 --- 19 files changed, 3379 deletions(-) delete mode 100644 ihl/collector/ChargerEjectorBlock.java delete mode 100644 ihl/collector/ChargerEjectorContainer.java delete mode 100644 ihl/collector/ChargerEjectorGui.java delete mode 100644 ihl/collector/ChargerEjectorModel.java delete mode 100644 ihl/collector/ChargerEjectorRender.java delete mode 100644 ihl/collector/ChargerEjectorTileEntity.java delete mode 100644 ihl/collector/CollectorEntity.java delete mode 100644 ihl/collector/CollectorHeavyEntity.java delete mode 100644 ihl/collector/CollectorHeavyItem.java delete mode 100644 ihl/collector/CollectorItem.java delete mode 100644 ihl/collector/CollectorItemRender.java delete mode 100644 ihl/collector/CollectorModel.java delete mode 100644 ihl/collector/CollectorRender.java delete mode 100644 ihl/collector/GlassBoxContainer.java delete mode 100644 ihl/collector/GlassBoxGui.java delete mode 100644 ihl/collector/GlassBoxRender.java delete mode 100644 ihl/collector/GlassBoxTileEntity.java delete mode 100644 ihl/collector/GuiMultiTextureButton.java delete mode 100644 ihl/collector/InvSlotMultiCharge.java (limited to 'ihl/collector') diff --git a/ihl/collector/ChargerEjectorBlock.java b/ihl/collector/ChargerEjectorBlock.java deleted file mode 100644 index cfeb567..0000000 --- a/ihl/collector/ChargerEjectorBlock.java +++ /dev/null @@ -1,90 +0,0 @@ -package ihl.collector; - -import ic2.api.item.IC2Items; -import ihl.IHLModInfo; - -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class ChargerEjectorBlock extends BlockContainer { - - public ChargerEjectorBlock(Material material) { - super(material); - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return IC2Items.getItem("glassFiberCableItem").getItem(); - } - - @Override - public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag) - { - } - - @Override - public TileEntity createNewTileEntity(World world, int var2) { - return new ChargerEjectorTileEntity(); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) - { - this.blockIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":ace"); - } - - @Override - public boolean hasTileEntity(int metadata) - { - return true; - } - - @Override - public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer entityPlayer,int i,float pos_x,float pos_y,float pos_z){ - if(world.getTileEntity(x,y,z) instanceof ChargerEjectorTileEntity) - { - ChargerEjectorTileEntity var10 = (ChargerEjectorTileEntity)world.getTileEntity(x,y,z); - if (var10 == null || entityPlayer.isSneaking()) { - return false; - } - else - { - return var10.getGui(entityPlayer); - } - } - return false; - } - - /** - * The type of render function that is called for this block - */ - @Override - public int getRenderType() - { - return -2; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } -} diff --git a/ihl/collector/ChargerEjectorContainer.java b/ihl/collector/ChargerEjectorContainer.java deleted file mode 100644 index 372f4c5..0000000 --- a/ihl/collector/ChargerEjectorContainer.java +++ /dev/null @@ -1,92 +0,0 @@ -package ihl.collector; - -import ic2.core.ContainerBase; -import ic2.core.slot.SlotInvSlot; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ChargerEjectorContainer extends ContainerBase { - - protected ChargerEjectorTileEntity tileEntity; - public int lastStorage = -1; - private final static int height=166; - - public ChargerEjectorContainer(EntityPlayer entityPlayer, ChargerEjectorTileEntity tileEntity1){ - super(tileEntity1); - this.tileEntity = tileEntity1; - int col; - - for (col = 0; col < 3; ++col) - { - for (int col1 = 0; col1 < 9; ++col1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); - } - } - - for (col = 0; col < 9; ++col) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); - } - - this.addSlotToContainer(new SlotInvSlot(tileEntity1.dischargeSlot, 0, 26, 35)); - - for(col=0;col<=2;col++) - { - for(int row=0;row<=2;row++) - { - this.addSlotToContainer(new SlotInvSlot(tileEntity1.chargeSlot, col+row*3, 66+26*col, 11+24*row)); - } - } - } - - @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { - ICrafting icrafting = (ICrafting)this.crafters.get(i); - - if (this.tileEntity.getStored() != this.lastStorage) - { - icrafting.sendProgressBarUpdate(this, 0, (this.tileEntity.getStored()>>15) & Short.MAX_VALUE); - icrafting.sendProgressBarUpdate(this, 1, (short)(this.tileEntity.getStored() & Short.MAX_VALUE)); - } - } - - this.lastStorage = this.tileEntity.getStored(); - } - - @Override - public void updateProgressBar(int index, int value) - { - super.updateProgressBar(index, value); - - switch (index) - { - case 0: - this.tileEntity.setStored((value<<15)); - break; - case 1: - this.tileEntity.setStored(this.tileEntity.getStored()+value); - break; - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) { - return tileEntity.isUseableByPlayer(var1); - } - - @Override - public void putStackInSlot(int par1, ItemStack par2ItemStack) - { - if(par1<44) - { - this.getSlot(par1).putStack(par2ItemStack); - } - } -} diff --git a/ihl/collector/ChargerEjectorGui.java b/ihl/collector/ChargerEjectorGui.java deleted file mode 100644 index 1836dc9..0000000 --- a/ihl/collector/ChargerEjectorGui.java +++ /dev/null @@ -1,128 +0,0 @@ -package ihl.collector; - -import cpw.mods.fml.relauncher.Side; - -import cpw.mods.fml.relauncher.SideOnly; -import ic2.core.IC2; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import org.lwjgl.opengl.GL11; -import ic2.core.util.GuiTooltipHelper; - -@SideOnly(Side.CLIENT) -public class ChargerEjectorGui extends GuiContainer { - private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIChargerEjector.png"); - private ChargerEjectorContainer container; - private String title = StatCollector.translateToLocal("ihl.gui.charger_ejector"); - private GuiMultiTextureButton button1; - private GuiMultiTextureButton button2; - private GuiMultiTextureButton button3; - private GuiMultiTextureButton button4; - private int timer=10; - - public ChargerEjectorGui (ChargerEjectorContainer container1) { - //the container is instanciated and passed to the superclass for handling - super(container1); - this.container=container1; - } - - @SuppressWarnings("unchecked") - @Override - public void initGui() - { - super.initGui(); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - button1=new GuiMultiTextureButton(0, x+138, y+8, 16, 20, background,183,0,216,0); - button1.isActive=this.container.tileEntity.autoEject; - button2=new GuiMultiTextureButton(1, x+155, y+8, 16, 20, background,200,0,233,0); - button2.isActive=!this.container.tileEntity.autoEject; - button3=new GuiMultiTextureButton(2, x+138, y+29, 16, 20, background,183,21,216,21); - button4=new GuiMultiTextureButton(3, x+155, y+29, 16, 20, background,200,21,233,21); - this.buttonList.add(button1); - this.buttonList.add(button2); - this.buttonList.add(button3); - this.buttonList.add(button4); - } - - @Override - public void actionPerformed(GuiButton button) - { - super.actionPerformed(button); - IC2.network.get().initiateClientTileEntityEvent(this.container.tileEntity, button.id); - if (button.id == 2) - { - button3.isActive=true; - timer=10; - } - if (button.id == 3) - { - button4.isActive=true; - timer=10; - } - - } - - @Override - protected void drawGuiContainerForegroundLayer(int param1, int param2) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - fontRendererObj.drawString(title, 8, 8, 6171880); - int e = Math.min(this.container.tileEntity.getStored(), this.container.tileEntity.maxStorage)/1000; - String eStr = String.valueOf(e); - int w = this.fontRendererObj.getStringWidth(eStr); - this.fontRendererObj.drawString(eStr + "kEU", 40-w, 62, 4210752); - this.fontRendererObj.drawString("/" + this.container.tileEntity.maxStorage/1000 + "kEU", 12, 72, 4210752); - String tooltip1 = StatCollector.translateToLocal("ihl.gui.charger_ejector_auto_eject"); - String tooltip2 = StatCollector.translateToLocal("ihl.gui.charger_ejector_do_not_auto_eject"); - String tooltip3 = StatCollector.translateToLocal("ihl.gui.charger_ejector_call_collectors"); - String tooltip4 = StatCollector.translateToLocal("ihl.gui.charger_ejector_erase_memory"); - GuiTooltipHelper.drawAreaTooltip(param1-90, param2-32, tooltip1, x+46, y-24, x+62, y-4); - GuiTooltipHelper.drawAreaTooltip(param1-90, param2-32, tooltip2, x+63, y-24, x+79, y-4); - GuiTooltipHelper.drawAreaTooltip(param1-90, param2-32, tooltip3, x+46, y-2, x+62, y+18); - GuiTooltipHelper.drawAreaTooltip(param1-90, param2-32, tooltip4, x+63, y-2, x+79, y+18); - //GuiTooltiphelper.drawAreaTooltip(param1-90, param2-32, tooltip1, x+120, 16, 132, 34); - //GuiTooltiphelper.drawAreaTooltip(param1-90, param2-32, tooltip2, x+137, 16, 149, 34); - //GuiTooltiphelper.drawAreaTooltip(param1-90, param2-32, tooltip3, x+120, 37, 132, 55); - //GuiTooltiphelper.drawAreaTooltip(param1-90, param2-32, tooltip4, 137, 37, 149, 55); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, - int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(background); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - button1.isActive=this.container.tileEntity.autoEject; - button2.isActive=!this.container.tileEntity.autoEject; - if(timer>0) - { - timer--; - } - if(timer==1) - { - button3.isActive=false; - button4.isActive=false; - } - //charge - if (this.container.tileEntity.getStored() > 0) - { - int chargeLevel=Math.min(Math.round(this.container.tileEntity.getStored()*23.0F/this.container.tileEntity.maxStorage),23); - this.drawTexturedModalRect(x+12, y+32+23-chargeLevel, xSize, 23-chargeLevel, 7, chargeLevel); - } - - } - - @Override - public void onGuiClosed() - { - super.onGuiClosed(); - this.container.tileEntity.isGuiScreenOpened=false; - } -} \ No newline at end of file diff --git a/ihl/collector/ChargerEjectorModel.java b/ihl/collector/ChargerEjectorModel.java deleted file mode 100644 index 5177fee..0000000 --- a/ihl/collector/ChargerEjectorModel.java +++ /dev/null @@ -1,150 +0,0 @@ -package ihl.collector; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class ChargerEjectorModel extends ModelBase { - //fields - ModelRenderer Base; - ModelRenderer ItemPieces; - ModelRenderer LightOnA; - ModelRenderer LightOnB; - ModelRenderer LightOnC; - ModelRenderer LightOffA; - ModelRenderer LightOffB; - ModelRenderer LightOffC; - - public ChargerEjectorModel() - { - textureWidth = 64; - textureHeight = 64; - setTextureOffset("Base.Shape1", 0, 0); - setTextureOffset("Base.Shape2", 0, 0); - setTextureOffset("Base.Shape3", 44, 17); - setTextureOffset("Base.Shape4", 28, 17); - setTextureOffset("Base.Shape6", 0, 0); - setTextureOffset("Base.Shape15", 0, 0); - setTextureOffset("Base.Shape16", 0, 0); - setTextureOffset("Base.Shape17", 0, 0); - setTextureOffset("Base.Shape18", 0, 0); - setTextureOffset("Base.Shape19", 0, 0); - setTextureOffset("Base.Shape20", 0, 0); - setTextureOffset("Base.Shape21", 0, 0); - setTextureOffset("Base.Shape22", 0, 0); - setTextureOffset("Base.Shape23", 0, 0); - setTextureOffset("Base.Shape24", 0, 0); - setTextureOffset("Base.Shape25", 0, 0); - setTextureOffset("Base.Shape26", 0, 0); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape28", 0, 0); - setTextureOffset("Base.Shape29", 0, 0); - setTextureOffset("Base.Shape30", 0, 0); - setTextureOffset("Base.Shape31", 0, 0); - setTextureOffset("Base.Shape32", 0, 0); - setTextureOffset("Base.Shape33", 0, 0); - setTextureOffset("Base.Shape34", 0, 0); - setTextureOffset("Base.Shape35", 0, 0); - setTextureOffset("Base.Shape36", 0, 0); - - setTextureOffset("ItemPieces.Shape37", 0, 32); - setTextureOffset("ItemPieces.Shape38", 0, 32); - setTextureOffset("ItemPieces.Shape39", 0, 32); - - setTextureOffset("LightOnA.Shape7", 0, 17); - setTextureOffset("LightOnA.Shape5", 0, 24); - setTextureOffset("LightOnA.Shape8", 14, 19); - setTextureOffset("LightOnA.Shape9", 14, 17); - setTextureOffset("LightOnB.Shape10", 14, 21); - setTextureOffset("LightOnB.Shape11", 14, 23); - setTextureOffset("LightOnB.Shape12", 14, 25); - setTextureOffset("LightOnB.Shape13", 14, 28); - setTextureOffset("LightOnC.Shape14", 20, 25); - - setTextureOffset("LightOffA.ShapeA7", 0, 17+14); - setTextureOffset("LightOffA.ShapeA5", 0, 24+14); - setTextureOffset("LightOffA.ShapeA8", 14, 19+14); - setTextureOffset("LightOffA.ShapeA9", 14, 17+14); - setTextureOffset("LightOffB.ShapeA10", 14, 21+14); - setTextureOffset("LightOffB.ShapeA11", 14, 23+14); - setTextureOffset("LightOffB.ShapeA12", 14, 25+14); - setTextureOffset("LightOffB.ShapeA13", 14, 28+14); - setTextureOffset("LightOffC.ShapeA14", 20, 25+14); - - Base = new ModelRenderer(this, "Base"); - Base.setRotationPoint(0F, 0F, 0F); - Base.mirror = true; - Base.addBox("Shape1", -8F, 23F, -8F, 16, 1, 16); - Base.addBox("Shape2", -8F, 11F, -8F, 16, 1, 16); - Base.addBox("Shape3", -1F, 0F, -1F, 2, 10, 2); - Base.addBox("Shape4", -2F, 12F, -2F, 4, 10, 4); - Base.addBox("Shape6", -4F, -1F, -4F, 8, 1, 8); - Base.addBox("Shape15", -1F, 22F, -8F, 2, 1, 16); - Base.addBox("Shape16", 7F, 22F, -8F, 1, 1, 16); - Base.addBox("Shape17", -8F, 22F, -8F, 1, 1, 16); - Base.addBox("Shape18", 2F, 22F, -1F, 5, 1, 2); - Base.addBox("Shape19", -7F, 22F, -1F, 5, 1, 2); - Base.addBox("Shape20", 1F, 22F, 7F, 6, 1, 1); - Base.addBox("Shape21", -7F, 22F, 7F, 6, 1, 1); - Base.addBox("Shape22", 1F, 22F, -8F, 6, 1, 1); - Base.addBox("Shape23", -7F, 22F, -8F, 6, 1, 1); - Base.addBox("Shape24", -8F, 10F, -1F, 16, 1, 2); - Base.addBox("Shape25", -8F, 10F, -8F, 16, 1, 1); - Base.addBox("Shape26", -8F, 10F, 7F, 16, 1, 1); - Base.addBox("Shape27", -1F, 10F, 1F, 2, 1, 6); - Base.addBox("Shape28", -1F, 10F, -7F, 2, 1, 6); - Base.addBox("Shape29", -8F, 10F, -7F, 1, 1, 6); - Base.addBox("Shape30", -8F, 10F, 1F, 1, 1, 6); - Base.addBox("Shape31", 7F, 10F, 1F, 1, 1, 6); - Base.addBox("Shape32", 7F, 10F, -7F, 1, 1, 6); - Base.addBox("Shape33", 3F, -2F, -4F, 1, 1, 8); - Base.addBox("Shape34", -4F, -2F, -4F, 1, 1, 8); - Base.addBox("Shape35", -3F, -2F, -4F, 6, 1, 1); - Base.addBox("Shape36", -3F, -2F, 3F, 6, 1, 1); - - ItemPieces = new ModelRenderer(this, "ItemPieces"); - ItemPieces.setRotationPoint(0F, 0F, 0F); - ItemPieces.mirror = true; - ItemPieces.addBox("Shape37", -3F, -2F, -3F, 6, 1, 6); - ItemPieces.addBox("Shape38", -7F, 10.1F, -7F, 14, 1, 14); - ItemPieces.addBox("Shape39", -7F, 22.1F, -7F, 14, 1, 14); - - LightOnA = new ModelRenderer(this, "LightOnA"); - LightOnA.setRotationPoint(0F, 0F, 0F); - LightOnA.mirror = true; - LightOnA.addBox("Shape7", 6F, 22F, 1F, 1, 1, 6); - LightOnA.addBox("Shape5", 1F, 22F, 1F, 1, 1, 6); - LightOnA.addBox("Shape8", 2F, 22F, 1F, 4, 1, 1); - LightOnA.addBox("Shape9", 2F, 22F, 6F, 4, 1, 1); - LightOnB = new ModelRenderer(this, "LightOnB"); - LightOnB.setRotationPoint(0F, 0F, 0F); - LightOnB.mirror = true; - LightOnB.addBox("Shape10", 2F, 22F, 2F, 4, 1, 1); - LightOnB.addBox("Shape11", 2F, 22F, 5F, 4, 1, 1); - LightOnB.addBox("Shape12", 2F, 22F, 3F, 1, 1, 2); - LightOnB.addBox("Shape13", 5F, 22F, 3F, 1, 1, 2); - LightOnC = new ModelRenderer(this, "LightOnC"); - LightOnC.setRotationPoint(0F, 0F, 0F); - LightOnC.mirror = true; - LightOnC.addBox("Shape14", 3F, 22F, 3F, 2, 1, 2); - - LightOffA = new ModelRenderer(this, "LightOffA"); - LightOffA.setRotationPoint(0F, 0F, 0F); - LightOffA.mirror = true; - LightOffA.addBox("ShapeA7", 6F, 22F, 1F, 1, 1, 6); - LightOffA.addBox("ShapeA5", 1F, 22F, 1F, 1, 1, 6); - LightOffA.addBox("ShapeA8", 2F, 22F, 1F, 4, 1, 1); - LightOffA.addBox("ShapeA9", 2F, 22F, 6F, 4, 1, 1); - LightOffB = new ModelRenderer(this, "LightOffB"); - LightOffB.setRotationPoint(0F, 0F, 0F); - LightOffB.mirror = true; - LightOffB.addBox("ShapeA10", 2F, 22F, 2F, 4, 1, 1); - LightOffB.addBox("ShapeA11", 2F, 22F, 5F, 4, 1, 1); - LightOffB.addBox("ShapeA12", 2F, 22F, 3F, 1, 1, 2); - LightOffB.addBox("ShapeA13", 5F, 22F, 3F, 1, 1, 2); - LightOffC = new ModelRenderer(this, "LightOffC"); - LightOffC.setRotationPoint(0F, 0F, 0F); - LightOffC.mirror = true; - LightOffC.addBox("ShapeA14", 3F, 22F, 3F, 2, 1, 2); - } - -} diff --git a/ihl/collector/ChargerEjectorRender.java b/ihl/collector/ChargerEjectorRender.java deleted file mode 100644 index 07ed0af..0000000 --- a/ihl/collector/ChargerEjectorRender.java +++ /dev/null @@ -1,92 +0,0 @@ -package ihl.collector; - -import org.lwjgl.opengl.GL11; - -import ihl.IHLModInfo; -import ihl.utils.IHLItemRenderer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; - -public class ChargerEjectorRender extends TileEntitySpecialRenderer { - private ChargerEjectorModel model = new ChargerEjectorModel(); - private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/chargerEjector.png"); - private int blink=0; - private IHLItemRenderer itemRenderer=new IHLItemRenderer(); - - @Override - public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) - { - this.renderAModelAt((ChargerEjectorTileEntity)par1TileEntity, par2, par4, par6, par8); - } - - private void renderAModelAt(ChargerEjectorTileEntity te, - double x, double y, double z, float par8) { - if(blink<60) - { - blink++; - } - else - { - blink=0; - } - int[] x0={0,-8,0,8,0,-8,0,8,-4}; - int[] z0={0,0,-8,0,0,0,8,0,-4}; - int[] y0={0,0,0,0,-12,0,0,0,-12}; - int[] x1={0,-8,-8,0,0,-8,-8, 0,-4}; - int[] z1={0, 0, 8,8,8, 8, 0, 0, 4}; - int[] y1={0, 0, 0,0,6, 6, 6, 6,12}; - for(int i=0;i<9;i++) - { - this.itemRenderer.doRender(RenderManager.instance, te.chargeSlot.get(i), x+x1[i]/16F+0.75D, y+y1[i]/16F+0.25D, z+z1[i]/16F+0.25D); - } - bindTexture(tex); //texture - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 12F/16F, (float)z + 0.5F); - GL11.glScalef(1.0F, -0.5F, -1F); - model.Base.render(1.0F/16.0F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 0xf0, 0xf0); - for(int i=0;i<9;i++) - { - - GL11.glTranslatef(x0[i]/16F, y0[i]/16F, z0[i]/16F); - if(te.chargeSlotStatus[i]<=0) - { - model.LightOffA.render(1F/16F); - model.LightOffB.render(1F/16F); - model.LightOffC.render(1F/16F); - } - else if(te.chargeSlotStatus[i]==2) - { - model.LightOnA.render(1F/16F); - model.LightOnB.render(1F/16F); - model.LightOnC.render(1F/16F); - } - else - { - if(blink<20) - { - model.LightOnA.render(1F/16F); - model.LightOffB.render(1F/16F); - model.LightOffC.render(1F/16F); - } - else if(blink>=20 && blink<40) - { - model.LightOffA.render(1F/16F); - model.LightOnB.render(1F/16F); - model.LightOffC.render(1F/16F); - } - else - { - model.LightOffA.render(1F/16F); - model.LightOffB.render(1F/16F); - model.LightOnC.render(1F/16F); - } - } - } - GL11.glPopMatrix(); //end - } - -} diff --git a/ihl/collector/ChargerEjectorTileEntity.java b/ihl/collector/ChargerEjectorTileEntity.java deleted file mode 100644 index cda75f4..0000000 --- a/ihl/collector/ChargerEjectorTileEntity.java +++ /dev/null @@ -1,522 +0,0 @@ -package ihl.collector; - -import java.util.Iterator; -import java.util.List; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.item.ElectricItem; -import ic2.api.network.INetworkClientTileEntityEventListener; -import ic2.core.ContainerBase; -import ic2.core.IC2; -import ic2.core.IHasGui; -import ic2.core.block.TileEntityInventory; -import ic2.core.block.invslot.InvSlot; -import ic2.core.block.invslot.InvSlot.Access; -import ihl.IHLMod; -import ihl.utils.IHLInvSlotDischarge; - -public class ChargerEjectorTileEntity extends TileEntityInventory implements IEnergySink, IHasGui, INetworkClientTileEntityEventListener { - - private int tier; - public int maxStorage=10000000; - private double energy=0D; - public final IHLInvSlotDischarge dischargeSlot; - public final InvSlotMultiCharge chargeSlot; - public boolean addedToEnergyNet = false; - public int[] chargeSlotStatus = new int[9]; - public int[] prevChargeSlotStatus = new int[9]; - public ItemStack chargeItemStack0; - public ItemStack chargeItemStack1; - public ItemStack chargeItemStack2; - public ItemStack chargeItemStack3; - public ItemStack chargeItemStack4; - public ItemStack chargeItemStack5; - public ItemStack chargeItemStack6; - public ItemStack chargeItemStack7; - public ItemStack chargeItemStack8; - private int slotNumNet=0; - public boolean isGuiScreenOpened=false; - public boolean autoEject=true; - public boolean firstTickUpdate=true; - - public ChargerEjectorTileEntity() - { - super(); - this.tier=4; - this.dischargeSlot = new IHLInvSlotDischarge(this, 0, Access.IO, this.tier, InvSlot.InvSide.BOTTOM); - this.chargeSlot = new InvSlotMultiCharge(this, 1, this.tier,9); - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) - { - if(this.dischargeSlot.get()!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.dischargeSlot.get())); - for(int i=0;i getNetworkedFields() - { - List fields = super.getNetworkedFields(); - for(int i=0;i0) - { - this.chargeSlotStatus[i]=1; - } - else - { - this.chargeSlotStatus[i]=2; - } - } - } - - } - - @Override - public void updateEntityServer() - { - if(this.firstTickUpdate && this.isGuiScreenOpened) - { - IC2.network.get().updateTileEntityField(this, "autoEject"); - this.firstTickUpdate=false; - } - if(this.energy < 1.0D && this.getActive()) - { - this.setActive(false); - } - else if(this.energy >= 1.0D && !this.getActive()) - { - this.setActive(true); - } - updateChargerSlotStatus(); - { - List eItemsList = this.getEItemsList(); - if(eItemsList!=null && eItemsList.size()>0) - { - Iterator ei = eItemsList.iterator(); - while(ei.hasNext()) - { - EntityItem entity=(EntityItem) ei.next(); - if(!entity.isDead && entity.getEntityItem()!=null && entity.getEntityItem().stackSize>0) - { - if(this.chargeSlot.addItemStackToFirstEmptyStack(entity.getEntityItem())) - { - entity.setDead(); - } - } - else - { - entity.setDead(); - } - } - } - EntityPlayer player = this.worldObj.getClosestPlayer(this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 1.1D); - if(player!=null && player instanceof EntityPlayerMP) - { - for(int i=0;i=0 && player.inventory.addItemStackToInventory(this.chargeSlot.get(i))) - { - this.chargeSlot.put(i, null); - } - } - } - } - - if(this.slotNumNet= 1.0D) - { - for(int i=0;i 1.0D) - { - amount = this.dischargeSlot.discharge(this.getDemandedEnergy(), false); - this.energy += amount; - } - } - - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - try - { - this.energy = nbttagcompound.getDouble("energy"); - } - catch (Exception var3) - { - this.energy = nbttagcompound.getInteger("energy"); - - if (this.maxStorage > Integer.MAX_VALUE) - { - this.energy *= 10.0D; - } - } - this.autoEject=nbttagcompound.getBoolean("autoeject"); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - nbttagcompound.setDouble("energy", this.energy); - nbttagcompound.setBoolean("autoeject", this.autoEject); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity emitter, - ForgeDirection direction) { - return direction==ForgeDirection.DOWN; - } - - @Override - @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer arg0, boolean arg1) - { - return new ChargerEjectorGui(new ChargerEjectorContainer(arg0, this)); - } - - @Override - public ContainerBase getGuiContainer(EntityPlayer arg0) { - return new ChargerEjectorContainer(arg0, this); - } - - @Override - public void onGuiClosed(EntityPlayer arg0) - { - this.isGuiScreenOpened=false; - } - - @Override - public String getInventoryName() { - return "charger_ejector"; - } - - public int getStored() { - return Math.round((float)this.energy); - } - - public void setStored(double value) { - this.energy=value; - } - - public boolean getGui(EntityPlayer player) - { - this.isGuiScreenOpened = this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false; - return this.isGuiScreenOpened; - } - - private ItemStack getChargeISByNum(int num) - { - switch(num) - { - case 0: - return this.chargeItemStack0; - case 1: - return this.chargeItemStack1; - case 2: - return this.chargeItemStack2; - case 3: - return this.chargeItemStack3; - case 4: - return this.chargeItemStack4; - case 5: - return this.chargeItemStack5; - case 6: - return this.chargeItemStack6; - case 7: - return this.chargeItemStack7; - case 8: - return this.chargeItemStack8; - default: - return this.chargeItemStack0; - } - } - - private void setChargeISByNum(int num, ItemStack stack) - { - switch(num) - { - case 0: - this.chargeItemStack0=stack; - break; - case 1: - this.chargeItemStack1=stack; - break; - case 2: - this.chargeItemStack2=stack; - break; - case 3: - this.chargeItemStack3=stack; - break; - case 4: - this.chargeItemStack4=stack; - break; - case 5: - this.chargeItemStack5=stack; - break; - case 6: - this.chargeItemStack6=stack; - break; - case 7: - this.chargeItemStack7=stack; - break; - case 8: - this.chargeItemStack8=stack; - break; - default: - this.chargeItemStack0=stack; - } - } - - @SuppressWarnings("unchecked") - protected List getEItemsList() - { - double range = 0.2D; - AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.xCoord-range,this.yCoord,this.zCoord-range,this.xCoord+1.0D+range,this.yCoord+1.0D+range,this.zCoord+1.0D+range); - List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); - return eItemsList; - } - //1.7.10 API - @Override - public double getDemandedEnergy() - { - return this.maxStorage - this.energy; - } - - @Override - public int getSinkTier() - { - return this.tier; - } - - @Override - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) - { - if (this.energy >= this.maxStorage) - { - return amount; - } - else - { - this.energy += amount; - return 0.0D; - } - } - - @Override - public void onNetworkEvent(EntityPlayer player, int event) - { - switch(event) - { - case 0: - if(!this.autoEject) - { - this.autoEject=true; - IC2.network.get().updateTileEntityField(this, "autoEject"); - } - break; - case 1: - if(this.autoEject) - { - this.autoEject=false; - IC2.network.get().updateTileEntityField(this, "autoEject"); - } - break; - case 2: - callCollectors(); - break; - case 3: - eraseMemory(); - break; - default: - break; - } - } - - @SuppressWarnings("unchecked") - private void callCollectors() - { - double range = 64D; - AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.xCoord-range,this.yCoord,this.zCoord-range,this.xCoord+1.0D+range,this.yCoord+1.0D+range,this.zCoord+1.0D+range); - List eList = this.worldObj.getEntitiesWithinAABB(CollectorEntity.class, searchArea); - if(!eList.isEmpty()) - { - Iterator eListIterator=eList.iterator(); - while(eListIterator.hasNext()) - { - CollectorEntity fbbe = eListIterator.next(); - fbbe.currentTask=CollectorEntity.Tasks.RECHARGE; - fbbe.charger=this; - } - } - } - - private void eraseMemory() - { - for(int i=0;i eItemIgnoreList = new ArrayList(); - public Tasks currentTask=Tasks.IDLE; - private int teUpdateTimer = 0; - private double[] last5TickPosX = new double[5]; - private double[] last5TickPosY = new double[5]; - private double[] last5TickPosZ = new double[5]; - - public CollectorEntity(World par1World) - { - super(par1World); - //this.preventEntitySpawning = true; - this.setSize(0.9F, 0.25F); - this.pathFinder3D=new IHL3dPathFinder(this); - this.isImmuneToFire=true; - this.waypointX=this.posX; - this.waypointY=this.posY; - this.waypointZ=this.posZ; - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - } - - @Override - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D); - } - - @Override - protected void entityInit() - { - super.entityInit(); - this.dataWatcher.addObject(16, Integer.valueOf(this.maxEnergy)); - this.dataWatcher.addObject(17, Integer.valueOf(this.energy)); - this.dataWatcher.addObjectByDataType(18, 5); - } - - /** - * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be - * pushable on contact, like boats or minecarts. - */ - @Override - public AxisAlignedBB getCollisionBox(Entity par1Entity) - { - return par1Entity.boundingBox; - } - - /** - * returns the bounding box for this entity - */ - @Override - public AxisAlignedBB getBoundingBox() - { - return this.boundingBox; - } - - /** - * Returns true if this entity should push and be pushed by other entities when colliding. - */ - @Override - public boolean canBePushed() - { - return true; - } - - public CollectorEntity(World par1World, double par2, double par4, double par6) - { - this(par1World); - this.setPosition(par2, par4, par6); - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.prevPosX = par2; - this.prevPosY = par4; - this.prevPosZ = par6; - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - this.waypointX=this.posX; - this.waypointY=this.posY; - this.waypointZ=this.posZ; - } - - - /** - * Returns true if other Entities should be prevented from moving through this Entity. - */ - @Override - public boolean canBeCollidedWith() - { - return !this.isDead; - } - - @SuppressWarnings("unchecked") - @Override - public void onUpdate() - { - super.onUpdate(); - if(teUpdateTimer<120) - { - teUpdateTimer++; - } - else - { - teUpdateTimer=0; - } - if(teUpdateTimer % 5 ==0) - { - this.last5TickPosX[0]=this.posX; - this.last5TickPosY[0]=this.posY; - this.last5TickPosZ[0]=this.posZ; - } - else - { - this.last5TickPosX[teUpdateTimer % 5]=this.last5TickPosX[teUpdateTimer % 5-1]; - this.last5TickPosY[teUpdateTimer % 5]=this.last5TickPosY[teUpdateTimer % 5-1]; - this.last5TickPosZ[teUpdateTimer % 5]=this.last5TickPosZ[teUpdateTimer % 5-1]; - } - if(this.worldObj.isRemote && this.clientSideNeedEnergyUpdate) - { - this.energy=this.dataWatcher.getWatchableObjectInt(17); - this.maxEnergy=this.dataWatcher.getWatchableObjectInt(16); - this.clientSideNeedEnergyUpdate=false; - } - if(this.energy>=1) - { - this.energy-=this.energyConsume; - } - else if(!this.worldObj.isRemote) - { - this.dropAsItem(); - } - if(this.charger==null && teUpdateTimer==20) - { - List teList = this.worldObj.loadedTileEntityList; - Iterator teIterator=teList.iterator(); - while(teIterator.hasNext()) - { - TileEntity te = (TileEntity) teIterator.next(); - if(!te.isInvalid() && this.charger==null && (te instanceof ChargerEjectorTileEntity || te instanceof TileEntityElectricBlock || te instanceof TileEntityBaseGenerator)) - { - double dist1 =this.getDistanceSq(te.xCoord,te.yCoord,te.zCoord); - if(dist1<4096D) - { - if(te instanceof TileEntityElectricBlock) - { - TileEntityElectricBlock charger1 = (TileEntityElectricBlock) te; - if(charger1.chargeSlot.isEmpty()) - { - this.charger=charger1; - } - } - else if(te instanceof TileEntityBaseGenerator) - { - TileEntityBaseGenerator charger1 = (TileEntityBaseGenerator) te; - if(charger1.chargeSlot.isEmpty()) - { - this.charger=charger1; - } - } - else if(te instanceof ChargerEjectorTileEntity) - { - ChargerEjectorTileEntity charger1 = (ChargerEjectorTileEntity) te; - if(charger1.chargeSlot.getFirstEmptyStack()>=0) - { - this.charger=charger1; - } - } - } - } - else if(!te.isInvalid() && this.charger!=null && (te instanceof ChargerEjectorTileEntity || te instanceof TileEntityElectricBlock || te instanceof TileEntityBaseGenerator)) - { - double dist1 =this.getDistanceSq(this.charger.xCoord,this.charger.yCoord,this.charger.zCoord); - double dist2 =this.getDistanceSq(te.xCoord,te.yCoord,te.zCoord); - if(this.charger instanceof ChargerEjectorTileEntity) - { - if(te instanceof ChargerEjectorTileEntity) - { - ChargerEjectorTileEntity charger1 = (ChargerEjectorTileEntity) te; - if(dist2=0) - { - this.charger=charger1; - } - } - } - else - { - if(te instanceof TileEntityElectricBlock) - { - TileEntityElectricBlock charger1 = (TileEntityElectricBlock) te; - if(dist2=0) - { - this.charger=charger1; - } - } - - } - } - } - - } - - if(!this.worldObj.isRemote && hopperx!=0 || hoppery!=0 || hopperz!=0) - { - TileEntity te = this.worldObj.getTileEntity(hopperx, hoppery, hopperz); - if(te!=null && te instanceof IInventory) - { - this.hopper=te; - } - hopperx=0; - hoppery=0; - hopperz=0; - } - if(this.hopper==null && teUpdateTimer==10) - { - List teList = this.worldObj.loadedTileEntityList; - Iterator teIterator=teList.iterator(); - while(teIterator.hasNext()) - { - TileEntity te = (TileEntity) teIterator.next(); - if(this.hopper==null && te instanceof IInventory) - { - this.hopper=te; - } - else if(te instanceof IInventory) - { - double dist1 =this.getDistanceSq(this.hopper.xCoord,this.hopper.yCoord,this.hopper.zCoord); - double dist2 =this.getDistanceSq(te.xCoord,te.yCoord,te.zCoord); - if(dist2=12) - { - if(this.randomWaypoints()) - { - currentTask=Tasks.SEARCH_ITEM; - var7 = 0.5D; - } - } - return; - } - - if(var7 < 1.0D || var7 > 3600.0D) - { - if(var7 < 1.0D) - { - if(this.energy<1000*this.energyConsume) - { - currentTask=Tasks.RECHARGE; - } - switch(currentTask) - { - case RECHARGE: - this.rechargeMe(); - if(this.charger!=null) - { - if(this.pathFinder3D.findPath(this.charger.xCoord+0.5D,this.charger.yCoord+1.5D, this.charger.zCoord+0.5D)) - { - this.waypointX=this.pathFinder3D.waypointX; - this.waypointY=this.pathFinder3D.waypointY; - this.waypointZ=this.pathFinder3D.waypointZ; - } - else - { - this.charger=null; - this.randomWaypoints(); - } - } - break; - case SEARCH_ITEM: - this.harvest(); - List eItemsList=this.getEItemsList(); - if(this.target==null) - { - if(eItemsList.isEmpty()) - { - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - } - else - { - Iterator ei = eItemsList.iterator(); - while(ei.hasNext()) - { - EntityItem newTarget=(EntityItem) ei.next(); - if(!newTarget.isDead && newTarget.getEntityItem()!=null && newTarget.getEntityItem().stackSize>0 && this.canAdd(newTarget.getEntityItem()) && !this.eItemIgnoreList.contains(newTarget)) - { - if(this.pathFinder3D.findPath(newTarget.posX, newTarget.posY+1.0D, newTarget.posZ)) - { - this.target=newTarget; - this.waypointX=this.pathFinder3D.waypointX; - this.waypointY=this.pathFinder3D.waypointY; - this.waypointZ=this.pathFinder3D.waypointZ; - break; - } - else - { - this.eItemIgnoreList.add(newTarget); - } - } - } - } - } - else - { - if(this.target.isDead) - { - this.target=null; - } - else if(this.pathFinder3D.findPath(target.posX, target.posY+1.0D, target.posZ)) - { - this.waypointX=this.pathFinder3D.waypointX; - this.waypointY=this.pathFinder3D.waypointY; - this.waypointZ=this.pathFinder3D.waypointZ; - break; - } - else - { - this.eItemIgnoreList.add(target); - this.target=null; - } - } - if(this.target==null && this.capturedStack!=null) - { - currentTask=Tasks.DROP_ITEM; - this.waypointX=this.posX; - this.waypointY=this.posY; - this.waypointZ=this.posZ; - } - else if(this.target==null) - { - this.randomWaypoints(); - } - break; - case DROP_ITEM: - this.dropItem(); - if(this.hopper!=null && this.capturedStack!=null) - { - this.pathFinder3D.findPath(this.hopper.xCoord,this.hopper.yCoord+2.0D, this.hopper.zCoord); - this.waypointX=this.pathFinder3D.waypointX; - this.waypointY=this.pathFinder3D.waypointY; - this.waypointZ=this.pathFinder3D.waypointZ; - } - else - { - currentTask=Tasks.SEARCH_ITEM; - this.waypointX=this.posX; - this.waypointY=this.posY; - this.waypointZ=this.posZ; - } - break; - default: - break; - } - } - } - if(this.isEntityInsideOpaqueBlock()) - { - this.noClip=true; - int xyz[] = {0,0,1,0,0,-1,0,0}; - Block block; - int x,y,z; - for(int i=0;i<=5;i++) - { - x=MathHelper.floor_double(this.posX)+xyz[i]; - y=MathHelper.floor_double(this.posY)+xyz[i+1]; - z=MathHelper.floor_double(this.posZ)+xyz[i+2]; - block = this.worldObj.getBlock(x,y,z); - if(block.isAir(this.worldObj, x,y,z)) - { - double varx=x+0.5D; - double vary=y+0.5D; - double varz=z+0.5D; - this.setPosition(varx, vary, varz); - this.setHealth(this.getMaxHealth()); - this.noClip=false; - break; - } - } - } - - if(var7>0.01D) - { - var7 = MathHelper.sqrt_double(var7); - this.motionX += var1 / var7 * 0.02D; - this.motionY += var3 / var7 * 0.02D; - this.motionZ += var5 / var7 * 0.02D; - } - if (this.courseChangeCooldown-- <= 0) - { - this.courseChangeCooldown += this.rand.nextInt(5) + 2; - - } - float rYaw=-((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; - float rYawD=this.rotationYaw-rYaw; - this.renderYawOffset = this.rotationYaw -= rYawD*0.1F; - } - - protected boolean canAdd(ItemStack stack) - { - if(this.capturedStack==null) - { - return true; - } - else - { - if(this.capturedStack.stackSize eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); - if(eItemsList!=null && eItemsList.size()>0) - { - Iterator itemIterator = eItemsList.iterator(); - while(itemIterator.hasNext()) - { - EntityItem eItem = (EntityItem) itemIterator.next(); - if(eItem.getEntityItem()!=null && eItem.getEntityItem().stackSize>0) - { - if(this.canAdd(eItem.getEntityItem())) - { - this.harvest(eItem); - } - } - else if(eItem.getEntityItem().stackSize<=0) - { - if(!this.worldObj.isRemote)eItem.setDead(); - } - else if(eItem.getEntityItem()==null) - { - if(!this.worldObj.isRemote)eItem.setDead(); - } - } - } - } - - protected void dropItem() - { - if(this.hopper!=null && this.capturedStack!=null) - { - double var1 = this.hopper.xCoord - this.posX; - double var3 = this.hopper.yCoord - this.posY + 2D; - double var5 = this.hopper.zCoord - this.posZ; - double var7 = var1 * var1 + var3 * var3 + var5 * var5; - if (var7 < 2.0D) - { - if(this.addItemStackToInventory((IInventory)this.hopper, this.capturedStack)) - { - this.capturedStack=null; - this.dataWatcher.updateObject(18, this.capturedStack); - } - } - } - } - - private void rechargeMe() - { - if(this.charger!=null) - { - double var1 = this.charger.xCoord - this.posX; - double var3 = this.charger.yCoord - this.posY + 2D; - double var5 = this.charger.zCoord - this.posZ; - double var7 = var1 * var1 + var3 * var3 + var5 * var5; - if (var7 < 2.0D) - { - if(this.charger instanceof TileEntityElectricBlock) - { - InvSlotCharge chargeSlot =((TileEntityElectricBlock) this.charger).chargeSlot; - if(chargeSlot.isEmpty()) - { - ItemStack itemStack = this.getItemStack(this.energy); - if(this.hopper!=null) - { - int[] hopperxyz = {this.hopper.xCoord,this.hopper.yCoord,this.hopper.zCoord}; - if(itemStack.stackTagCompound==null) - { - itemStack.stackTagCompound=new NBTTagCompound(); - } - itemStack.stackTagCompound.setIntArray("hopperxyz", hopperxyz); - } - - chargeSlot.put(itemStack); - if(this.capturedStack!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack)); - } - this.setDead(); - } - else - { - this.charger=null; - } - } - else if(this.charger instanceof TileEntityBaseGenerator) - { - InvSlotCharge chargeSlot =((TileEntityBaseGenerator) this.charger).chargeSlot; - if(chargeSlot.isEmpty()) - { - ItemStack itemStack = this.getItemStack(this.energy); - if(this.hopper!=null) - { - int[] hopperxyz = {this.hopper.xCoord,this.hopper.yCoord,this.hopper.zCoord}; - if(itemStack.stackTagCompound==null) - { - itemStack.stackTagCompound=new NBTTagCompound(); - } - itemStack.stackTagCompound.setIntArray("hopperxyz", hopperxyz); - } - - chargeSlot.put(itemStack); - if(this.capturedStack!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack)); - } - this.setDead(); - } - else - { - this.charger=null; - } - } - else if(this.charger instanceof ChargerEjectorTileEntity) - { - InvSlotMultiCharge chargeSlot =((ChargerEjectorTileEntity) this.charger).chargeSlot; - if(chargeSlot.isEmpty()) - { - ItemStack itemStack = this.getItemStack(this.energy); - if(this.hopper!=null) - { - int[] hopperxyz = {this.hopper.xCoord,this.hopper.yCoord,this.hopper.zCoord}; - if(itemStack.stackTagCompound==null) - { - itemStack.stackTagCompound=new NBTTagCompound(); - } - itemStack.stackTagCompound.setIntArray("hopperxyz", hopperxyz); - } - chargeSlot.put(itemStack); - spawnContainedItems(); - this.setDead(); - } - else - { - this.charger=null; - } - } - else - { - this.charger=null; - return; - } - } - } - } - - private boolean randomWaypoints() - { - double wx,wy,wz; - if(this.hopper!=null) - { - double var1 = this.hopper.xCoord - this.posX; - double var3 = this.hopper.yCoord - this.posY + 1.5D; - double var5 = this.hopper.zCoord - this.posZ; - double var7 = var1 * var1 + var3 * var3 + var5 * var5; - if(var7>4096D) - { - wx = (double)this.hopper.xCoord + (double)(this.rand.nextFloat() * 8.0F - 4.0F); - wy = (double)this.hopper.yCoord + (double)(this.rand.nextFloat() * 8.0F - 4.0F); - wz = (double)this.hopper.zCoord + (double)(this.rand.nextFloat() * 8.0F - 4.0F); - } - else if(var3>16D) - { - wx = this.posX + (this.rand.nextFloat() * 8.0F - 4.0F); - wy = (double)this.hopper.yCoord + (double)(this.rand.nextFloat() * 8.0F - 4.0F); - wz = this.posZ + (this.rand.nextFloat() * 8.0F - 4.0F); - } - else - { - wx = this.posX + (this.rand.nextFloat() * 8.0F - 4.0F); - wy = this.posY + (this.rand.nextFloat() * 8.0F - 4.0F); - wz = this.posZ + (this.rand.nextFloat() * 8.0F - 4.0F); - } - } - else - { - wx = this.posX + (this.rand.nextFloat() * 8.0F - 4.0F); - wy = this.posY + (this.rand.nextFloat() * 2.0F - 1.0F); - wz = this.posZ + (this.rand.nextFloat() * 8.0F - 4.0F); - } - if(this.pathFinder3D.findPath(wx, wy, wz)) - { - this.waypointX=this.pathFinder3D.waypointX; - this.waypointY=this.pathFinder3D.waypointY; - this.waypointZ=this.pathFinder3D.waypointZ; - return true; - } - else - { - return false; - } - } - - - protected boolean addItemStackToInventory(IInventory hopper, ItemStack stack) - { - int startFrom=0; - int endWith=hopper.getSizeInventory()-1; - if(IHLMod.isGregTechModLoaded && IHLMod.isGT_API_Version_5 && hopper instanceof gregtech.api.metatileentity.BaseMetaTileEntity) - { - startFrom=endWith=4; - } - for(int i=startFrom;i<=endWith;++i) - { - if(hopper.isItemValidForSlot(i, stack)) - { - ItemStack hopperSlot = hopper.getStackInSlot(i); - if(hopperSlot!=null && hopperSlot.stackSize getEItemsList() - { - double range = 32D; - AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.lastItemX-range,this.lastItemY-range,this.lastItemZ-range,this.lastItemX+range,this.lastItemY+range,this.lastItemZ+range); - List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); - return eItemsList; - } - - public ItemStack getItemStack(int charge) - { - ItemStack ret = new ItemStack(this.thisItem); - ElectricItem.manager.charge(ret, charge, this.maxEnergy, true, false); - return ret; - } - - public enum Tasks - { - RECHARGE, - SEARCH_ITEM, - DROP_ITEM, - IDLE - } - - protected void spawnContainedItems() - { - if(this.capturedStack!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack)); - } - } - - protected void harvest(EntityItem eItem) - { - if(this.capturedStack==null) - { - this.capturedStack=eItem.getEntityItem(); - if(!this.worldObj.isRemote)eItem.setDead(); - this.target=null; - if(this.capturedStack!=null) - { - this.dataWatcher.updateObject(18, this.capturedStack.copy()); - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - } - } - else if(this.capturedStack.getItem() == eItem.getEntityItem().getItem() && this.capturedStack.getItemDamage() == eItem.getEntityItem().getItemDamage()) - { - this.capturedStack.stackSize+=eItem.getEntityItem().stackSize; - if(!this.worldObj.isRemote)eItem.setDead(); - this.target=null; - this.dataWatcher.updateObject(18, this.capturedStack.copy()); - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - } - } - -} \ No newline at end of file diff --git a/ihl/collector/CollectorHeavyEntity.java b/ihl/collector/CollectorHeavyEntity.java deleted file mode 100644 index 510e28b..0000000 --- a/ihl/collector/CollectorHeavyEntity.java +++ /dev/null @@ -1,305 +0,0 @@ -package ihl.collector; - -import ihl.IHLMod; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.World; - -public class CollectorHeavyEntity extends CollectorEntity { - private ItemStack capturedStack2; - private ItemStack capturedStack3; - private ItemStack capturedStack4; - - public CollectorHeavyEntity(World par1World) - { - super(par1World); - this.setSize(0.98F, 0.25F); - this.energyConsume=4; - this.thisItem=IHLMod.collectorHeavyItem; - this.waypointX=this.posX; - this.waypointY=this.posY; - this.waypointZ=this.posZ; - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - } - - public CollectorHeavyEntity(World par1World, double par2, double par4, double par6) - { - this(par1World); - this.setPosition(par2, par4, par6); - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.prevPosX = par2; - this.prevPosY = par4; - this.prevPosZ = par6; - this.lastItemX=this.posX; - this.lastItemY=this.posY; - this.lastItemZ=this.posZ; - this.energyConsume=4; - this.thisItem=IHLMod.collectorHeavyItem; - } - - - @Override - protected void entityInit() - { - super.entityInit(); - this.dataWatcher.addObjectByDataType(19, 5); - this.dataWatcher.addObjectByDataType(20, 5); - this.dataWatcher.addObjectByDataType(21, 5); - } - - @Override - protected void dropItem() - { - if(this.hopper!=null) - { - double var1 = this.hopper.xCoord - this.posX; - double var3 = this.hopper.yCoord - this.posY + 2D; - double var5 = this.hopper.zCoord - this.posZ; - double var7 = var1 * var1 + var3 * var3 + var5 * var5; - - if (var7 < 2.0D) - { - for(int i=0;i<4;i++) - { - if(getItemStackNum(i)!=null && this.addItemStackToInventory((IInventory)this.hopper, getItemStackNum(i))) - { - setItemStackSlotContent(i,null); - } - } - } - } - } - - public ItemStack getVisibleItemStack(int num) - { - return this.dataWatcher.getWatchableObjectItemStack(18+num); - } - - @Override - public void readEntityFromNBT(NBTTagCompound nbt) - { - super.readEntityFromNBT(nbt); - try - { - NBTTagList var2 = nbt.getTagList("Items", 10); - if(var2!=null) - { - for(int i=1;i<4;i++) - { - NBTTagCompound var4 = var2.getCompoundTagAt(i); - if(var4!=null) - { - this.setItemStackSlotContent(i, ItemStack.loadItemStackFromNBT(var4)); - if(this.getItemStackNum(i)!=null) - { - this.dataWatcher.updateObject(18+i, this.getItemStackNum(i).copy()); - } - } - } - } - } - catch(Throwable e) - { - e.printStackTrace(); - } - } - - @Override - public void writeEntityToNBT(NBTTagCompound nbt) - { - super.writeEntityToNBT(nbt); - try - { - NBTTagList var2 = nbt.getTagList("Items", 10); - if(var2!=null) - { - for(int i=1;i<4;i++) - { - if(this.getItemStackNum(i)!=null) - { - NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte)i); - this.getItemStackNum(i).writeToNBT(var4); - var2.appendTag(var4); - } - } - } - } - catch(Throwable e) - { - e.printStackTrace(); - } - } - - @Override - protected void spawnContainedItems() - { - if(this.capturedStack!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack)); - } - if(this.capturedStack2!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack2)); - } - if(this.capturedStack3!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack3)); - } - if(this.capturedStack4!=null) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.capturedStack4)); - } - } - - private ItemStack getItemStackNum(int num) - { - switch(num) - { - case 0: - return this.capturedStack; - case 1: - return this.capturedStack2; - case 2: - return this.capturedStack3; - case 3: - return this.capturedStack4; - default: - return this.capturedStack; - } - } - - private void setItemStackSlotContent(int num, ItemStack itemStack) - { - switch(num) - { - case 0: - this.capturedStack=itemStack; - if(this.capturedStack!=null) - { - this.dataWatcher.updateObject(18, this.capturedStack.copy()); - } - else - { - this.dataWatcher.updateObject(18, this.capturedStack); - } - break; - case 1: - this.capturedStack2=itemStack; - if(this.capturedStack2!=null) - { - this.dataWatcher.updateObject(19, this.capturedStack2.copy()); - } - else - { - this.dataWatcher.updateObject(19, this.capturedStack2); - } - break; - case 2: - this.capturedStack3=itemStack; - if(this.capturedStack3!=null) - { - this.dataWatcher.updateObject(20, this.capturedStack3.copy()); - } - else - { - this.dataWatcher.updateObject(20, this.capturedStack3); - } - break; - case 3: - this.capturedStack4=itemStack; - if(this.capturedStack4!=null) - { - this.dataWatcher.updateObject(21, this.capturedStack4.copy()); - } - else - { - this.dataWatcher.updateObject(21, this.capturedStack4); - } - break; - default: - break; - } - } - - private void addItemStackSlotContent(int num, ItemStack itemStack) - { - switch(num) - { - case 0: - this.capturedStack.stackSize+=itemStack.stackSize; - break; - case 1: - this.capturedStack2.stackSize+=itemStack.stackSize; - break; - case 2: - this.capturedStack3.stackSize+=itemStack.stackSize; - break; - case 3: - this.capturedStack4.stackSize+=itemStack.stackSize; - break; - default: - break; - } - } - - @Override - protected boolean canAdd(ItemStack stack) - { - for(int i=0;i<4;i++) - { - if(getItemStackNum(i)==null) - { - return true; - } - else - { - if(getItemStackNum(i).stackSize getHudInfo(ItemStack itemStack) { - LinkedList info = new LinkedList(); - info.add(ElectricItem.manager.getToolTip(itemStack)); - info.add("Power Tier: " + this.tier); - return info; - } - - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b) - { - info.add("PowerTier: " + this.tier); - } - - @Override - @SideOnly(Side.CLIENT) - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void getSubItems(Item item, CreativeTabs tabs, List itemList) - { - itemList.add(this.getItemStack(this.maxCharge)); - itemList.add(this.getItemStack(0)); - } - - public ItemStack getItemStack(int charge) - { - ItemStack ret = new ItemStack(this); - ElectricItem.manager.charge(ret, charge, this.maxCharge, true, false); - return ret; - } - - - @Override - public double getDurabilityForDisplay(ItemStack stack) - { - return (this.maxCharge-ElectricItem.manager.getCharge(stack))/this.maxCharge; - } - - -} diff --git a/ihl/collector/CollectorItemRender.java b/ihl/collector/CollectorItemRender.java deleted file mode 100644 index 39040bb..0000000 --- a/ihl/collector/CollectorItemRender.java +++ /dev/null @@ -1,112 +0,0 @@ -package ihl.collector; - -import ihl.IHLModInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.model.ModelBox; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -public class CollectorItemRender implements IItemRenderer{ - private CollectorModel model = new CollectorModel(); - private ResourceLocation tex; - private float scale; - -public CollectorItemRender(boolean heavy) -{ - super(); - if(heavy) - { - scale = 1F/80F; - tex = new ResourceLocation(IHLModInfo.MODID+":textures/entities/collectorHeavy.png"); - } - else - { - scale = 1F/100F; - tex = new ResourceLocation(IHLModInfo.MODID+":textures/entities/collector.png"); - } -} - -@Override -public void renderItem(ItemRenderType type, ItemStack item, Object... data) -{ - int levelBar = Math.max(0,model.Indicator.cubeList.size()-2-Math.round((float)(27-item.getItemDamageForDisplay())*(float)model.Indicator.cubeList.size()/27F)); - RenderPlayer var25; - EntityClientPlayerMP var3 = Minecraft.getMinecraft().thePlayer; - GL11.glPushMatrix(); - switch(type) - { - case EQUIPPED_FIRST_PERSON: - GL11.glTranslatef(0F, 0.5F, 0.5F); - GL11.glScalef(1.0F, -1F, -1F); - Minecraft.getMinecraft().getTextureManager().bindTexture(var3.getLocationSkin()); - var25 = (RenderPlayer)RenderManager.instance.getEntityRenderObject(Minecraft.getMinecraft().thePlayer); - GL11.glRotatef(135F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(35F, 0.0F, 1.0F, 0.0F); - var25.renderFirstPersonArm(Minecraft.getMinecraft().thePlayer); - GL11.glRotatef(-35F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-135F, 1.0F, 0.0F, 0.0F); - GL11.glTranslatef(-0.5F, -1.0F, 0.5F); - break; - case ENTITY: - GL11.glTranslatef(0F, 1.0F, 0F); - GL11.glScalef(1.0F, -1F, -1F); - break; - case INVENTORY: - GL11.glScalef(1.0F, -1F, -1F); - break; - case EQUIPPED: - GL11.glTranslatef(0.5F,0.5F,0.25F); - GL11.glScalef(1.0F, -1F, -1F); - break; - default: - break; - } - Minecraft.getMinecraft().renderEngine.bindTexture(tex); - model.Base.render(scale); - for(int i=0;i<4;i++) - { - model.Eleron.rotateAngleY=i*(float)Math.PI/2; - model.Eleron.render(scale); - } - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 0xf0, 0xf0); - for(int i=0;i<4;i++) - { - GL11.glRotatef(i* 90F, 0.0F, 1.0F, 0.0F); - model.Flares.render(scale); - ModelBox box = (ModelBox) model.Indicator.cubeList.get(levelBar); - box.render(Tessellator.instance,scale); - } - GL11.glPopMatrix(); -} - -/** - * IItemRenderer implementation * - */ -@Override -public boolean handleRenderType(ItemStack item, ItemRenderType type) { - switch (type) { - case ENTITY: - return true; - case EQUIPPED: - return true; - case EQUIPPED_FIRST_PERSON: - return true; - case INVENTORY: - return true; - default: - return false; - } -} - -@Override -public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; -} -} \ No newline at end of file diff --git a/ihl/collector/CollectorModel.java b/ihl/collector/CollectorModel.java deleted file mode 100644 index a1bada9..0000000 --- a/ihl/collector/CollectorModel.java +++ /dev/null @@ -1,110 +0,0 @@ -package ihl.collector; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -public class CollectorModel extends ModelBase { - //fields - ModelRenderer Base; - ModelRenderer Eleron; - ModelRenderer Indicator; - ModelRenderer Flares; - - public CollectorModel() - { - textureWidth = 256; - textureHeight = 128; - int barSize=31; - setTextureOffset("Base.Shape1", 34, 10); - setTextureOffset("Base.Shape6", 74, 41); - setTextureOffset("Base.Shape8", 22, 6); - setTextureOffset("Base.Shape27", 0, 0); - setTextureOffset("Base.Shape9", 13, 3); - setTextureOffset("Eleron.Shape4", 0, 6); - setTextureOffset("Eleron.Shape2", 0, 7); - setTextureOffset("Eleron.Shape3", 0, 0); - setTextureOffset("Eleron.Shape5", 0, 0); - setTextureOffset("Eleron.Shape7", 74, 0); - setTextureOffset("Eleron.Shape14", 56, 0); - setTextureOffset("Eleron.Shape11", 48, 0); - setTextureOffset("Eleron.Shape10", 52, 0); - setTextureOffset("Eleron.Shape12", 50, 0); - setTextureOffset("Eleron.Shape13", 54, 0); - setTextureOffset("Eleron.Shape15", 58, 0); - setTextureOffset("Eleron.Shape18", 0, 0); - setTextureOffset("Eleron.Shape16", 0, 3); - setTextureOffset("Eleron.Shape17", 0, 4); - for(int i=0;i 15) - { - ModelBox box = (ModelBox) model.Indicator.cubeList.get(levelBar); - box.render(Tessellator.instance,scale); - } - else if(blink < 15) - { - ModelBox box = (ModelBox) model.Indicator.cubeList.get(model.Indicator.cubeList.size()-1); - box.render(Tessellator.instance,scale); - } - } - GL11.glPopMatrix(); //end - - } - - @Override - protected ResourceLocation getEntityTexture(Entity arg0) { - return this.tex; - } - -} \ No newline at end of file diff --git a/ihl/collector/GlassBoxContainer.java b/ihl/collector/GlassBoxContainer.java deleted file mode 100644 index 8f6e52a..0000000 --- a/ihl/collector/GlassBoxContainer.java +++ /dev/null @@ -1,45 +0,0 @@ -package ihl.collector; - -import ic2.core.ContainerBase; -import ic2.core.slot.SlotInvSlot; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Slot; - -public class GlassBoxContainer extends ContainerBase { - - protected GlassBoxTileEntity tileEntity; - public int lastStorage = -1; - private final static int height=166; - - public GlassBoxContainer(EntityPlayer entityPlayer, GlassBoxTileEntity tileEntity1){ - super(tileEntity1); - this.tileEntity = tileEntity1; - int col; - - for (col = 0; col < 3; ++col) - { - for (int col1 = 0; col1 < 9; ++col1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col1 + col * 9 + 9, 8 + col1 * 18, height + -82 + col * 18)); - } - } - - for (col = 0; col < 9; ++col) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 8 + col * 18, height + -24)); - } - - for(col=0;col<=3;col++) - { - for(int row=0;row<=3;row++) - { - this.addSlotToContainer(new SlotInvSlot(tileEntity1.invSlot, col+row*4, 55+17*col, 7+17*row)); - } - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) { - return tileEntity.isUseableByPlayer(var1); - } -} diff --git a/ihl/collector/GlassBoxGui.java b/ihl/collector/GlassBoxGui.java deleted file mode 100644 index 2210d06..0000000 --- a/ihl/collector/GlassBoxGui.java +++ /dev/null @@ -1,44 +0,0 @@ -package ihl.collector; - -import cpw.mods.fml.relauncher.Side; - -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class GlassBoxGui extends GuiContainer { - private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIGlassBox.png"); - private GlassBoxContainer container; - - public GlassBoxGui (GlassBoxContainer container1) { - //the container is instanciated and passed to the superclass for handling - super(container1); - this.container=container1; - } - - @Override - protected void drawGuiContainerForegroundLayer(int param1, int param2) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(background); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, - int par3) { - //draw your Gui here, only thing you need to change is the path - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.renderEngine.bindTexture(background); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } - - @Override - public void onGuiClosed() - { - super.onGuiClosed(); - this.container.tileEntity.isGuiScreenOpened=false; - } -} \ No newline at end of file diff --git a/ihl/collector/GlassBoxRender.java b/ihl/collector/GlassBoxRender.java deleted file mode 100644 index 305c6bd..0000000 --- a/ihl/collector/GlassBoxRender.java +++ /dev/null @@ -1,47 +0,0 @@ -package ihl.collector; - -import java.util.Random; - -import org.lwjgl.opengl.GL11; - -import ihl.utils.IHLItemRenderer; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; - -public class GlassBoxRender extends TileEntitySpecialRenderer { - private IHLItemRenderer itemRenderer=new IHLItemRenderer(); - private Random rand = new Random(); - private float[] randomPosMatrix={rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat(),rand.nextFloat()}; - - @Override - public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) - { - this.renderAModelAt((GlassBoxTileEntity)par1TileEntity, par2, par4, par6, par8); - } - - private void renderAModelAt(GlassBoxTileEntity te, - double x, double y, double z, float par8) { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y+0.5F, (float)z + 0.5F); - for(int i=0;i getNetworkedFields() - { - List fields = super.getNetworkedFields(); - fields.add("invSlot"); - return fields; - } - - public boolean enableUpdateEntity() - { - return IC2.platform.isSimulating(); - } - - @Override - public void updateEntityServer() - { - boolean needInvUpdate=false; - List eItemList = new ArrayList(); - for(int i=0;i=0 && player.inventory.addItemStackToInventory(this.invSlot.get(i))) - { - this.invSlot.put(i, null); - needInvUpdate=true; - } - } - } - } - if(needInvUpdate) - { - IC2.network.get().updateTileEntityField(this, "invSlot"); - } - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - } - - @Override - @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer arg0, boolean arg1) - { - return new GlassBoxGui(new GlassBoxContainer(arg0, this)); - } - - @Override - public ContainerBase getGuiContainer(EntityPlayer arg0) { - return new GlassBoxContainer(arg0, this); - } - - @Override - public void onGuiClosed(EntityPlayer arg0) - { - this.isGuiScreenOpened=false; - } - - @Override - public String getInventoryName() { - return "glass_box"; - } - - public boolean getGui(EntityPlayer player) - { - this.isGuiScreenOpened = this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false; - return this.isGuiScreenOpened; - } - - @SuppressWarnings("unchecked") - protected List getEItemsList() - { - double range = 0.2D; - AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.xCoord,this.yCoord,this.zCoord,this.xCoord+1.0D,this.yCoord+1.0D+range,this.zCoord+1.0D); - List eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea); - return eItemsList; - } - - @Override - public void setInventorySlotContents(int var1, ItemStack var2) - { - super.setInventorySlotContents(var1, var2); - IC2.network.get().updateTileEntityField(this, "invSlot"); - } - - public void dropContents() - { - for(int i=0;i=this.size()) - { - return false; - } - else - { - if(this.accepts(stack)) - { - this.put(slotNum, stack); - return true; - } - else - { - return false; - } - } - } - - @Override - public void put(ItemStack stack) - { - this.addItemStackToFirstEmptyStack(stack); - } - - public int getFirstEmptyStack() - { - for(int i=0;i=0; - } -} -- cgit v1.2.3