diff options
Diffstat (limited to 'ihl/collector')
| -rw-r--r-- | ihl/collector/ChargerEjectorBlock.java | 90 | ||||
| -rw-r--r-- | ihl/collector/ChargerEjectorContainer.java | 92 | ||||
| -rw-r--r-- | ihl/collector/ChargerEjectorGui.java | 128 | ||||
| -rw-r--r-- | ihl/collector/ChargerEjectorModel.java | 150 | ||||
| -rw-r--r-- | ihl/collector/ChargerEjectorRender.java | 92 | ||||
| -rw-r--r-- | ihl/collector/ChargerEjectorTileEntity.java | 522 | ||||
| -rw-r--r-- | ihl/collector/CollectorEntity.java | 959 | ||||
| -rw-r--r-- | ihl/collector/CollectorHeavyEntity.java | 305 | ||||
| -rw-r--r-- | ihl/collector/CollectorHeavyItem.java | 35 | ||||
| -rw-r--r-- | ihl/collector/CollectorItem.java | 203 | ||||
| -rw-r--r-- | ihl/collector/CollectorItemRender.java | 112 | ||||
| -rw-r--r-- | ihl/collector/CollectorModel.java | 110 | ||||
| -rw-r--r-- | ihl/collector/CollectorRender.java | 112 | ||||
| -rw-r--r-- | ihl/collector/GlassBoxContainer.java | 45 | ||||
| -rw-r--r-- | ihl/collector/GlassBoxGui.java | 44 | ||||
| -rw-r--r-- | ihl/collector/GlassBoxRender.java | 47 | ||||
| -rw-r--r-- | ihl/collector/GlassBoxTileEntity.java | 193 | ||||
| -rw-r--r-- | ihl/collector/GuiMultiTextureButton.java | 44 | ||||
| -rw-r--r-- | ihl/collector/InvSlotMultiCharge.java | 96 |
19 files changed, 0 insertions, 3379 deletions
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<ChargerEjectorTileEntity> {
-
- 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<this.chargeSlot.size();i++)
- {
- if(this.chargeSlot.get(i)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.chargeSlot.get(i)));
- }
- ItemStack stack = new ItemStack(IHLMod.chargerEjectorBlock,1);
- stack.stackTagCompound = new NBTTagCompound();
- stack.stackTagCompound.setDouble("energy", this.energy);
- return stack;
- }
-
- @Override
- public List<String> getNetworkedFields()
- {
- List<String> fields = super.getNetworkedFields();
- for(int i=0;i<this.chargeSlot.size();i++)
- {
- fields.add("chargeItemStack"+i);
- }
- return fields;
- }
-
-
- @Override
- public void onLoaded()
- {
- super.onLoaded();
- if (IC2.platform.isSimulating())
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
- this.addedToEnergyNet = true;
-
- }
- }
-
- @Override
- public void onUnloaded()
- {
- if (IC2.platform.isSimulating() && this.addedToEnergyNet)
- {
- MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
- this.addedToEnergyNet = false;
- }
- super.onUnloaded();
- }
-
- public boolean enableUpdateEntity()
- {
- return true;
- }
-
- @Override
- public void updateEntityClient()
- {
- updateChargerSlotStatus();
- if(!this.isGuiScreenOpened)
- {
- for(int i=0;i<this.chargeSlot.size();i++)
- {
- if(this.chargeSlot.get(i)!=this.getChargeISByNum(i))
- {
- this.chargeSlot.put(i,this.getChargeISByNum(i));
- }
- }
- }
- }
-
- public void updateChargerSlotStatus()
- {
- for(int i=0;i<this.chargeSlotStatus.length;i++)
- {
- if(!this.getActive() && this.chargeSlot.get(i)==null)
- {
- this.chargeSlotStatus[i]=0;
- }
- else if(!this.getActive() && this.chargeSlot.get(i)!=null)
- {
- this.chargeSlotStatus[i]=-1;
- }
- else if(this.getActive() && this.chargeSlot.get(i)==null)
- {
- this.chargeSlotStatus[i]=-2;
- }
- else if(this.getActive() && this.chargeSlot.get(i)!=null)
- {
- if(ElectricItem.manager.charge(this.chargeSlot.get(i), 1, this.tier, false, true)>0)
- {
- 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<EntityItem> eItemsList = this.getEItemsList();
- if(eItemsList!=null && eItemsList.size()>0)
- {
- Iterator<EntityItem> 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<this.chargeSlot.size();i++)
- {
- if(this.chargeSlotStatus[i]==2)
- {
- if(player.inventory.getFirstEmptyStack()>=0 && player.inventory.addItemStackToInventory(this.chargeSlot.get(i)))
- {
- this.chargeSlot.put(i, null);
- }
- }
- }
- }
-
- if(this.slotNumNet<this.chargeSlotStatus.length-1)
- {
- this.slotNumNet++;
- }
- else
- {
- this.slotNumNet=0;
- }
- if(this.chargeSlotStatus[slotNumNet]!=this.prevChargeSlotStatus[slotNumNet])
- {
- ItemStack stack1 = this.chargeSlot.get(slotNumNet);
- if(stack1!=null)
- {
- if(this.chargeSlotStatus[slotNumNet]==2 && this.chargeSlot.get(slotNumNet).getItem() instanceof CollectorItem)
- {
- if(this.autoEject)
- {
- CollectorItem item = (CollectorItem) this.chargeSlot.get(slotNumNet).getItem();
- if(item.spawnEntityInWorld(this.worldObj, this.chargeSlot.get(slotNumNet), this.xCoord, this.yCoord, this.zCoord))
- {
- this.setChargeISByNum(slotNumNet, null);
- this.chargeSlot.put(slotNumNet, null);
- }
- else
- {
- this.setChargeISByNum(slotNumNet, this.chargeSlot.get(slotNumNet).copy());
- }
- }
- else
- {
- this.setChargeISByNum(slotNumNet, this.chargeSlot.get(slotNumNet).copy());
- }
- }
- else
- {
- this.setChargeISByNum(slotNumNet, this.chargeSlot.get(slotNumNet).copy());
- }
- }
- else
- {
- this.setChargeISByNum(slotNumNet, null);
- }
- IC2.network.get().updateTileEntityField(this, "chargeItemStack"+slotNumNet);
- this.prevChargeSlotStatus[slotNumNet]=this.chargeSlotStatus[slotNumNet];
- }
- double amount;
- if (this.energy >= 1.0D)
- {
- for(int i=0;i<this.chargeSlotStatus.length;i++)
- {
- amount = this.chargeSlot.charge((int)this.energy,i);
- this.energy -= amount;
- }
- }
- if (this.getDemandedEnergy() > 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<EntityItem> 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<EntityItem> 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<CollectorEntity> eList = this.worldObj.getEntitiesWithinAABB(CollectorEntity.class, searchArea);
- if(!eList.isEmpty())
- {
- Iterator<CollectorEntity> 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<this.chargeSlot.size();i++)
- {
- if(this.chargeSlot.get(i)!=null)
- {
- ItemStack item = this.chargeSlot.get(i);
- if(item.getItem() instanceof CollectorItem)
- {
- if(item.stackTagCompound!=null && item.stackTagCompound.hasKey("hopperxyz"))
- {
- int[] clearCoord={0,0,0};
- item.stackTagCompound.setIntArray("hopperxyz",clearCoord);
- }
- }
- }
- }
- }
-
- @Override
- public boolean shouldRenderInPass(int pass)
- {
- return pass==0;
- }
-}
diff --git a/ihl/collector/CollectorEntity.java b/ihl/collector/CollectorEntity.java deleted file mode 100644 index 55e89c8..0000000 --- a/ihl/collector/CollectorEntity.java +++ /dev/null @@ -1,959 +0,0 @@ -package ihl.collector;
-
-import ic2.api.item.ElectricItem;
-import ic2.core.block.generator.tileentity.TileEntityBaseGenerator;
-import ic2.core.block.invslot.InvSlotCharge;
-import ic2.core.block.wiring.TileEntityElectricBlock;
-import ihl.IHL3dPathFinder;
-import ihl.IHLMod;
-import ihl.IHLModInfo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityFlying;
-import net.minecraft.entity.SharedMonsterAttributes;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.MathHelper;
-import net.minecraft.world.World;
-
-public class CollectorEntity extends EntityFlying {
- protected int energy = 300;
- private int maxEnergy = 1000;
- public EntityItem target;
- public TileEntity hopper;
- public TileEntity charger;
- protected double lastItemX=0;
- protected double lastItemY=0;
- protected double lastItemZ=0;
- protected ItemStack capturedStack;
- public int courseChangeCooldown;
- public double waypointX;
- public double waypointY;
- public double waypointZ;
- private IHL3dPathFinder pathFinder3D;
- private boolean clientSideNeedEnergyUpdate = true;
- public int hopperx;
- public int hoppery;
- public int hopperz;
- protected int energyConsume=1;
- protected Item thisItem=IHLMod.collectorItem;
- protected List<EntityItem> eItemIgnoreList = new ArrayList<EntityItem>();
- 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<TileEntity> teList = this.worldObj.loadedTileEntityList;
- Iterator<TileEntity> 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<dist1 && charger1.chargeSlot.getFirstEmptyStack()>=0)
- {
- this.charger=charger1;
- }
- }
- }
- else
- {
- if(te instanceof TileEntityElectricBlock)
- {
- TileEntityElectricBlock charger1 = (TileEntityElectricBlock) te;
- if(dist2<dist1 && charger1.chargeSlot.isEmpty())
- {
- this.charger=charger1;
- }
- }
- else if(te instanceof TileEntityBaseGenerator)
- {
- TileEntityBaseGenerator charger1 = (TileEntityBaseGenerator) te;
- if(dist2<dist1 && charger1.chargeSlot.isEmpty())
- {
- this.charger=charger1;
- }
- }
- else if(te instanceof ChargerEjectorTileEntity)
- {
- ChargerEjectorTileEntity charger1 = (ChargerEjectorTileEntity) te;
- if(dist2<dist1 && charger1.chargeSlot.getFirstEmptyStack()>=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<TileEntity> teList = this.worldObj.loadedTileEntityList;
- Iterator<TileEntity> 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<dist1)
- {
- this.hopper=te;
- }
- }
- }
- }
- }
-
- @Override
- public void readEntityFromNBT(NBTTagCompound nbt)
- {
- try{
- super.readEntityFromNBT(nbt);
- this.energy = nbt.getInteger("energy");
- this.maxEnergy = nbt.getInteger("maxEnergy");
- this.hopperx = nbt.getInteger("hopperx");
- this.hoppery = nbt.getInteger("hoppery");
- this.hopperz = nbt.getInteger("hopperz");
- NBTTagList var2 = nbt.getTagList("Items", 10);
- if(var2!=null)
- {
- NBTTagCompound var4 = var2.getCompoundTagAt(0);
- this.capturedStack = ItemStack.loadItemStackFromNBT(var4);
- if(this.capturedStack!=null)
- {
- this.dataWatcher.updateObject(18, this.capturedStack.copy());
- }
- }
- }
- catch(Throwable e)
- {
- e.printStackTrace();
- }
- }
-
- @Override
- public void writeEntityToNBT(NBTTagCompound nbt)
- {
- try{
- super.writeEntityToNBT(nbt);
- nbt.setInteger("energy", this.energy);
- nbt.setInteger("maxEnergy", this.maxEnergy);
- if(hopper!=null)
- {
- nbt.setInteger("hopperx", hopper.xCoord);
- nbt.setInteger("hoppery", hopper.yCoord);
- nbt.setInteger("hopperz", hopper.zCoord);
- }
- else
- {
- nbt.setInteger("hopperx", hopperx);
- nbt.setInteger("hoppery", hoppery);
- nbt.setInteger("hopperz", hopperz);
- }
- if(this.capturedStack!=null)
- {
- NBTTagList var2 = new NBTTagList();
- NBTTagCompound var4 = new NBTTagCompound();
- var4.setByte("Slot", (byte)0);
- this.capturedStack.writeToNBT(var4);
- var2.appendTag(var4);
- nbt.setTag("Items", var2);
- }
- }
- catch(Throwable e)
- {
- e.printStackTrace();
- }
- }
-
- @Override
- public float getShadowSize()
- {
- return 0.5F;
- }
-
- @Override
- protected String getHurtSound()
- {
- return IHLModInfo.MODID+":collectorHurt";
- }
-
- @Override
- protected String getDeathSound()
- {
- return IHLModInfo.MODID+":collectorHurt";
- }
-
- @Override
- public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
- {
- return super.attackEntityFrom(par1DamageSource, par2);
- }
-
- @Override
- protected void updateEntityActionState()
- {
- double var1 = this.waypointX - this.posX;
- double var3 = this.waypointY - this.posY;
- double var5 = this.waypointZ - this.posZ;
- double var7 = var1 * var1 + var3 * var3 + var5 * var5;
- if(currentTask==Tasks.IDLE)
- {
- if(teUpdateTimer>=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<EntityItem> eItemsList=this.getEItemsList();
- if(this.target==null)
- {
- if(eItemsList.isEmpty())
- {
- this.lastItemX=this.posX;
- this.lastItemY=this.posY;
- this.lastItemZ=this.posZ;
- }
- else
- {
- Iterator<EntityItem> 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<this.capturedStack.getMaxStackSize())
- {
- return this.capturedStack.getItem()==stack.getItem() && this.capturedStack.getItemDamage()==stack.getItemDamage();
- }
- }
- return false;
- }
-
- public int getStored()
- {
- return this.energy;
- }
-
- public void setStored(int value)
- {
- this.energy=value;
- }
-
- public ItemStack getVisibleItemStack()
- {
- return this.dataWatcher.getWatchableObjectItemStack(18);
- }
-
- @SuppressWarnings("unchecked")
- private void harvest()
- {
- double range = 1D;
- AxisAlignedBB searchArea = AxisAlignedBB.getBoundingBox(this.posX-range,this.posY-range-1D,this.posZ-range,this.posX+range,this.posY+range,this.posZ+range);
- List<EntityItem> eItemsList = this.worldObj.getEntitiesWithinAABB(EntityItem.class, searchArea);
- if(eItemsList!=null && eItemsList.size()>0)
- {
- Iterator<EntityItem> 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<hopper.getInventoryStackLimit() && hopperSlot.getItem() == stack.getItem() && hopperSlot.getItemDamage() == stack.getItemDamage())
- {
- if(hopperSlot.stackSize + stack.stackSize<=hopper.getInventoryStackLimit())
- {
- hopperSlot.stackSize+=stack.stackSize;
- return true;
- }
- else
- {
- int newSize=hopper.getInventoryStackLimit()-hopperSlot.stackSize;
- hopperSlot.stackSize=hopper.getInventoryStackLimit();
- stack.stackSize-=newSize;
- }
- }
- else if(hopperSlot==null)
- {
- if(stack.stackSize<=hopper.getInventoryStackLimit())
- {
- hopper.setInventorySlotContents(i, stack);
- return true;
- }
- else
- {
- ItemStack stackAdd = stack.splitStack(hopper.getInventoryStackLimit());
- hopper.setInventorySlotContents(i, stackAdd);
- }
- }
- }
- }
- return false;
- }
-
- public float getRenderEnergyLevel()
- {
- return (float)this.energy/(float)this.maxEnergy;
- }
-
- public void setEnergy(double d, double e)
- {
- if(e<Integer.MAX_VALUE)
- {
- this.maxEnergy=(int) e;
- }
- else
- {
- this.maxEnergy=Integer.MAX_VALUE;
- }
-
- if(d<this.maxEnergy)
- {
- this.energy=(int) d;
- }
- else
- {
- this.energy=this.maxEnergy;
- }
- this.dataWatcher.updateObject(17, Integer.valueOf(this.energy));
- this.dataWatcher.updateObject(16, Integer.valueOf(this.maxEnergy));
- }
-
- @Override
- public boolean interact(EntityPlayer player)
- {
- if(player.inventory.getCurrentItem()==null && !this.worldObj.isRemote)
- {
- this.dropAsItem();
- return true;
- }
- return false;
- }
-
-
- protected void dropAsItem()
- {
- 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);
- }
- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, itemStack));
- spawnContainedItems();
- this.setDead();
- }
-
- @SuppressWarnings("unchecked")
- protected List<EntityItem> 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<EntityItem> 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<getItemStackNum(i).getMaxStackSize() && getItemStackNum(i).getItem()==stack.getItem() && getItemStackNum(i).getItemDamage()==stack.getItemDamage())
- {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- protected void harvest(EntityItem eItem)
- {
- for(int i=0;i<4;i++)
- {
- if(getItemStackNum(i)==null)
- {
- this.setItemStackSlotContent(i, eItem.getEntityItem());
- if(!this.worldObj.isRemote)eItem.setDead();
- this.target=null;
- if(this.capturedStack!=null)
- {
- this.dataWatcher.updateObject(18+i, getItemStackNum(i).copy());
- this.lastItemX=this.posX;
- this.lastItemY=this.posY;
- this.lastItemZ=this.posZ;
- }
- return;
- }
- else if(getItemStackNum(i).getItem() == eItem.getEntityItem().getItem() && getItemStackNum(i).getItemDamage() == eItem.getEntityItem().getItemDamage())
- {
- addItemStackSlotContent(i,eItem.getEntityItem());
- if(!this.worldObj.isRemote)eItem.setDead();
- this.target=null;
- this.dataWatcher.updateObject(18+i, getItemStackNum(i).copy());
- this.lastItemX=this.posX;
- this.lastItemY=this.posY;
- this.lastItemZ=this.posZ;
- return;
- }
- }
- }
-}
diff --git a/ihl/collector/CollectorHeavyItem.java b/ihl/collector/CollectorHeavyItem.java deleted file mode 100644 index 1a355f9..0000000 --- a/ihl/collector/CollectorHeavyItem.java +++ /dev/null @@ -1,35 +0,0 @@ -package ihl.collector;
-
-import ic2.api.item.ElectricItem;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-
-public class CollectorHeavyItem extends CollectorItem {
-
- public CollectorHeavyItem()
- {
- super();
- this.tier=2;
- this.maxCharge=200000;
- }
-
- @Override
- public boolean spawnEntityInWorld(World world, ItemStack itemStack,int x, int y ,int z)
- {
- CollectorHeavyEntity se = new CollectorHeavyEntity(world,x, y+1, z);
- se.setEnergy(ElectricItem.manager.getCharge(itemStack), this.getMaxCharge(itemStack));
- if(itemStack.stackTagCompound!=null)
- {
- se.hopperx = itemStack.stackTagCompound.getInteger("hopperx");
- se.hoppery = itemStack.stackTagCompound.getInteger("hoppery");
- se.hopperz = itemStack.stackTagCompound.getInteger("hopperz");
- }
- else
- {
- se.hopperx = x;
- se.hoppery = y;
- se.hopperz = z;
- }
- return world.spawnEntityInWorld(se);
- }
-}
diff --git a/ihl/collector/CollectorItem.java b/ihl/collector/CollectorItem.java deleted file mode 100644 index b4496fa..0000000 --- a/ihl/collector/CollectorItem.java +++ /dev/null @@ -1,203 +0,0 @@ -package ihl.collector;
-
-import java.util.LinkedList;
-import java.util.List;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.MovingObjectPosition;
-import net.minecraft.util.Vec3;
-import net.minecraft.world.World;
-import ic2.api.item.ElectricItem;
-import ic2.api.item.IElectricItem;
-import ic2.api.item.IItemHudInfo;
-import ihl.IHLCreativeTab;
-import ihl.IHLModInfo;
-
-public class CollectorItem extends Item implements IElectricItem, IItemHudInfo {
-
- protected int tier=1;
- protected int maxCharge=20000;
- protected int minCharge=100;
- private int transferLimit = 100;
-
- public CollectorItem()
- {
- super();
- this.setMaxDamage(27);
- this.setFull3D();
- this.setCreativeTab(IHLCreativeTab.tab);
- this.maxStackSize=1;
- }
-
- @Override
- public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer)
- {
- if(ElectricItem.manager.use(itemStack, this.minCharge, entityPlayer))
- {
- if(!world.isRemote)
- {
- MovingObjectPosition mop = this.returnMOPFromPlayer(entityPlayer, world);
- if(mop!=null)
- {
- int x = mop.blockX;
- int y = mop.blockY;
- int z = mop.blockZ;
- if(this.spawnEntityInWorld(world, itemStack, x,y,z))
- {
- itemStack.stackSize--;
- }
- }
- }
- }
- return itemStack;
- }
-
- public boolean spawnEntityInWorld(World world, ItemStack itemStack,int x, int y ,int z)
- {
- CollectorEntity se = new CollectorEntity(world,x+0.5D, y+1D, z+0.5D);
- se.setEnergy(ElectricItem.manager.getCharge(itemStack), this.getMaxCharge(itemStack));
- if(itemStack.stackTagCompound!=null)
- {
- se.hopperx = itemStack.stackTagCompound.getInteger("hopperx");
- se.hoppery = itemStack.stackTagCompound.getInteger("hoppery");
- se.hopperz = itemStack.stackTagCompound.getInteger("hopperz");
- }
- else
- {
- se.hopperx = x;
- se.hoppery = y;
- se.hopperz = z;
- }
- return world.spawnEntityInWorld(se);
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerIcons(IIconRegister par1IconRegister)
- {
- this.itemIcon = par1IconRegister.registerIcon(IHLModInfo.MODID + ":itemElectricHandpump");
- }
-
-
- @Override
- public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
- {
- return false;
- }
-
-
- public MovingObjectPosition returnMOPFromPlayer(EntityPlayer entityplayer, World world)
- {
- float f = 1.0F;
- float f1 = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch) * f;
- float f2 = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw) * f;
- double d = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) * f;
- double d1 = entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY) * f + entityplayer.getEyeHeight();
-
- if (world.isRemote)
- {
- d1 -= entityplayer.getDefaultEyeHeight();
- }
-
- double d2 = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) * f;
- Vec3 vec3d = Vec3.createVectorHelper(d, d1, d2);
- float f3 = MathHelper.cos(-f2 * 0.01745329F - (float)Math.PI);
- float f4 = MathHelper.sin(-f2 * 0.01745329F - (float)Math.PI);
- float f5 = -MathHelper.cos(-f1 * 0.01745329F);
- float f6 = MathHelper.sin(-f1 * 0.01745329F);
- float f7 = f4 * f5;
- float f9 = f3 * f5;
- double d3 = 5.0D;
- Vec3 vec3d1 = vec3d.addVector(f7 * d3, f6 * d3, f9 * d3);
- MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vec3d, vec3d1, true);
-
- if (movingobjectposition == null)
- {
- return null;
- }
-
- if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
- return movingobjectposition;
- }
- return null;
- }
-
-
- @Override
- public boolean canProvideEnergy(ItemStack itemStack) {
- return false;
- }
-
- @Override
- public Item getChargedItem(ItemStack itemStack) {
- return this;
- }
-
- @Override
- public Item getEmptyItem(ItemStack itemStack) {
- return this;
- }
-
- @Override
- public double getMaxCharge(ItemStack itemStack) {
- return this.maxCharge;
- }
-
- @Override
- public int getTier(ItemStack itemStack) {
- return this.tier;
- }
-
- @Override
- public double getTransferLimit(ItemStack itemStack) {
- return this.transferLimit;
- }
-
- @Override
- public List<String> getHudInfo(ItemStack itemStack) {
- LinkedList<String> info = new LinkedList<String>();
- 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<barSize;i++)
- {
- setTextureOffset("Indicator.ShapeA"+i, 12, 40+i);
- }
- setTextureOffset("Flares.Shape20", 6, 47);
- setTextureOffset("Flares.Shape21", 6, 42);
- setTextureOffset("Flares.Shape22", 6, 42);
- setTextureOffset("Flares.Shape23", 6, 47);
- setTextureOffset("Flares.Shape24", 0, 41);
- setTextureOffset("Flares.Shape25", 0, 80);
-
- Base = new ModelRenderer(this, "Base");
- Base.setRotationPoint(0F, 0F, 0F);
- setRotation(Base, 0F, 0F, 0F);
- Base.mirror = true;
- Base.addBox("Shape1", -9F, 0F, -9F, 18, 1, 18);
- Base.addBox("Shape6", -9F, 5F, -9F, 18, 6, 18);
- Base.addBox("Shape8", -13F, 1F, -13F, 26, 1, 26);
- Base.addBox("Shape27", -20F, 4F, -20F, 40, 1, 40);
- Base.addBox("Shape9", -16F, 2F, -16F, 32, 1, 32);
- Eleron = new ModelRenderer(this, "Eleron");
- Eleron.setRotationPoint(0F, 0F, 0F);
- setRotation(Eleron, 0F, 0F, 0F);
- Eleron.mirror = true;
- Eleron.addBox("Shape4", 32F, 5F, 31F, 8, 20, 1);
- Eleron.addBox("Shape2", 31F, 5F, 39F, 8, 20, 1);
- Eleron.addBox("Shape3", 39F, 5F, 32F, 1, 20, 7);
- Eleron.addBox("Shape5", 31F, 5F, 31F, 1, 20, 8);
- Eleron.addBox("Shape7", 15F, 3F, 15F, 3, 1, 3);
- Eleron.addBox("Shape14", 18F, 9F, 18F, 12, 1, 12);
- Eleron.addBox("Shape11", 6F, 5F, 6F, 16, 1, 16);
- Eleron.addBox("Shape10", 12F, 7F, 12F, 14, 1, 14);
- Eleron.addBox("Shape12", 9F, 6F, 9F, 15, 1, 15);
- Eleron.addBox("Shape13", 15F, 8F, 15F, 13, 1, 13);
- Eleron.addBox("Shape15", 21F, 10F, 21F, 11, 1, 11);
- Eleron.addBox("Shape18", 29F, 11F, 22F, 2, 2, 7);
- Eleron.addBox("Shape16", 23F, 11F, 29F, 16, 2, 2);
- Eleron.addBox("Shape17", 29F, 11F, 31F, 2, 2, 8);
- Indicator = new ModelRenderer(this, "Indicator");
- Indicator.setRotationPoint(0F, 0F, 0F);
- setRotation(Indicator, 0F, 0F, 0F);
- Indicator.mirror = true;
- for(int i=0;i<barSize;i++)
- {
- Indicator.addBox("ShapeA"+i, -15F, 3F, 15F, 30, 1, 1);
- }
- Flares = new ModelRenderer(this, "Flares");
- Flares.setRotationPoint(0F, 0F, 0F);
- setRotation(Flares, 0F, 0F, 0F);
- Flares.mirror = true;
- Flares.addBox("Shape20", 33F, 5F, 32F, 6, 20, 1);
- Flares.addBox("Shape21", 32F, 5F, 32F, 1, 20, 6);
- Flares.addBox("Shape22", 38F, 5F, 33F, 1, 20, 6);
- Flares.addBox("Shape23", 32F, 5F, 38F, 6, 20, 1);
- Flares.addBox("Shape24", 39F, 5F, 39F, 1, 20, 1);
- Flares.addBox("Shape25", 6F, 11F, -6F, 1, 1, 13);
- }
-
- private void setRotation(ModelRenderer model, float x, float y, float z)
- {
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
- }
-
- @Override
- public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
- {
- super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
- }
-}
-
-
diff --git a/ihl/collector/CollectorRender.java b/ihl/collector/CollectorRender.java deleted file mode 100644 index ad93907..0000000 --- a/ihl/collector/CollectorRender.java +++ /dev/null @@ -1,112 +0,0 @@ -package ihl.collector;
-import net.minecraft.client.model.ModelBox;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.entity.Render;
-import net.minecraft.entity.Entity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-import ihl.IHLModInfo;
-import ihl.utils.IHLItemRenderer;
-
-public class CollectorRender extends Render{
-
- private CollectorModel model = new CollectorModel();
- private ResourceLocation tex;
- private float scale;
- private int blink = 0;
- private IHLItemRenderer itemRenderer;
-
- public CollectorRender(boolean heavy)
- {
- super();
- this.itemRenderer=new IHLItemRenderer();
- 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 doRender(Entity entity, double x, double y, double z, float arg4, float arg5)
- {
- if(blink<30)
- {
- blink++;
- }
- else
- {
- blink=0;
- }
- int levelBar=0;
- if(entity instanceof CollectorHeavyEntity)
- {
- CollectorHeavyEntity cEntity = (CollectorHeavyEntity) entity;
- levelBar = Math.max(0,model.Indicator.cubeList.size()-1-Math.round(cEntity.getRenderEnergyLevel()*model.Indicator.cubeList.size()));
- for(int col=0;col<2;col++)
- {
- for(int row=0;row<2;row++)
- {
- ItemStack stack = cEntity.getVisibleItemStack(col+row*2);
- if(stack!=null)
- {
- this.itemRenderer.doRender(this.renderManager, stack, x-0.125D+0.25D*col, y, z-0.125D+0.25D*row);
- }
- }
- }
-
- }
- else if(entity instanceof CollectorEntity)
- {
- CollectorEntity cEntity = (CollectorEntity) entity;
- levelBar = Math.max(0,model.Indicator.cubeList.size()-1-Math.round(cEntity.getRenderEnergyLevel()*model.Indicator.cubeList.size()));
- ItemStack stack = cEntity.getVisibleItemStack();
- if(stack!=null)
- {
- this.itemRenderer.doRender(this.renderManager, stack, x, y, z);
- }
- }
- bindTexture(tex);
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x, (float)y+0.25F, (float)z);
- GL11.glScalef(1.0F, -1F, -1F);
- GL11.glRotated(entity.rotationYaw+90D, 0D, 1.0D, 0D);
- 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);
- if(levelBar<model.Indicator.cubeList.size()-8 || blink > 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<GlassBoxTileEntity> {
-
- 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<te.invSlot.size();i++)
- {
- if(te.invSlot.get(i)!=null)
- {
- GL11.glRotatef((randomPosMatrix[i*3]-0.5F)*90F, 0F, 1F, 0F);
- if(te.invSlot.get(i).getItem().isFull3D())
- {
- GL11.glTranslatef(0, 0.2F, 0);
- this.itemRenderer.doRender(RenderManager.instance,te.invSlot.get(i),randomPosMatrix[i*3]*0.5-0.25F,randomPosMatrix[i*3+1]*0.5-0.25F,randomPosMatrix[i*3+2]*0.5-0.25F);
- GL11.glTranslatef(0, -0.2F, 0);
- }
- else
- {
- this.itemRenderer.doRender(RenderManager.instance,te.invSlot.get(i),randomPosMatrix[i*3]*0.5-0.25F,randomPosMatrix[i*3+1]*0.5-0.25F,randomPosMatrix[i*3+2]*0.5-0.25F);
- }
- }
- }
- GL11.glPopMatrix(); //end
- }
-
-}
diff --git a/ihl/collector/GlassBoxTileEntity.java b/ihl/collector/GlassBoxTileEntity.java deleted file mode 100644 index a05e283..0000000 --- a/ihl/collector/GlassBoxTileEntity.java +++ /dev/null @@ -1,193 +0,0 @@ -package ihl.collector;
-
-import java.util.ArrayList;
-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.util.AxisAlignedBB;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import ic2.core.ContainerBase;
-import ic2.core.IC2;
-import ic2.core.IHasGui;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot;
-import ihl.utils.IHLUtils;
-
-public class GlassBoxTileEntity extends TileEntityInventory implements IHasGui {
-
- public final InvSlot invSlot;
- public boolean isGuiScreenOpened=false;
-
- public GlassBoxTileEntity()
- {
- super();
- this.invSlot = new InvSlot(this, "inventory", 0, InvSlot.Access.IO, 16);
- }
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
- {
- for(int i=0;i<this.invSlot.size();i++)
- {
- if(this.invSlot.get(i)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.invSlot.get(i)));
- }
- return IHLUtils.getThisModItemStack("glassBoxBlock");
- }
-
- @Override
- public List<String> getNetworkedFields()
- {
- List<String> fields = super.getNetworkedFields();
- fields.add("invSlot");
- return fields;
- }
-
- public boolean enableUpdateEntity()
- {
- return IC2.platform.isSimulating();
- }
-
- @Override
- public void updateEntityServer()
- {
- boolean needInvUpdate=false;
- List<EntityItem> eItemList = new ArrayList<EntityItem>();
- for(int i=0;i<this.invSlot.size();i++)
- {
- if(this.invSlot.get(i)==null)
- {
- if(eItemList.isEmpty())
- {
- eItemList = this.getEItemsList();
- if(eItemList.isEmpty())
- {
- break;
- }
- else
- {
- EntityItem entityItem = eItemList.remove(0);
- ItemStack eitem = entityItem.getEntityItem();
- entityItem.setDead();
- if(eitem!=null)
- {
- this.invSlot.put(i, eitem);
- needInvUpdate=true;
- }
- if(eItemList.isEmpty())
- {
- break;
- }
- }
- }
- else
- {
- EntityItem entityItem = eItemList.remove(0);
- ItemStack eitem = entityItem.getEntityItem();
- entityItem.setDead();
- if(eitem!=null)
- {
- this.invSlot.put(i, eitem);
- needInvUpdate=true;
- }
- if(eItemList.isEmpty())
- {
- break;
- }
- }
- }
- else
- {
- EntityPlayer player = this.worldObj.getClosestPlayer(this.xCoord+0.5D, this.yCoord+0.5D, this.zCoord+0.5D, 0.5D);
- if(player!=null && player instanceof EntityPlayerMP)
- {
- if(player.inventory.getFirstEmptyStack()>=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<EntityItem> 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<EntityItem> 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.invSlot.size();i++)
- {
- if(this.invSlot.get(i)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.invSlot.get(i)));
- }
- }
-
- @Override
- public short getFacing()
- {
- return 3;
- }
-}
diff --git a/ihl/collector/GuiMultiTextureButton.java b/ihl/collector/GuiMultiTextureButton.java deleted file mode 100644 index 39b36d0..0000000 --- a/ihl/collector/GuiMultiTextureButton.java +++ /dev/null @@ -1,44 +0,0 @@ -package ihl.collector;
-
-import org.lwjgl.opengl.GL11;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.util.ResourceLocation;
-
-public class GuiMultiTextureButton extends GuiButton {
-
- private ResourceLocation texture;
- private int textureX;
- private int textureY;
- private int textureActiveX;
- private int textureActiveY;
- public boolean isActive=false;
-
- public GuiMultiTextureButton(int id1, int x, int y, int w, int h,
- ResourceLocation texture1, int textureX1, int textureY1, int textureActiveX1, int textureActiveY1) {
- super(id1, x, y, w, h, "");
- texture=texture1;
- textureX=textureX1;
- textureY=textureY1;
- textureActiveX=textureActiveX1;
- textureActiveY=textureActiveY1;
-
- }
-
- @Override
- public void drawButton(Minecraft minecraft, int i, int j)
- {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- minecraft.getTextureManager().bindTexture(this.texture);
- if(this.isActive)
- {
- this.drawTexturedModalRect(this.xPosition, this.yPosition, this.textureActiveX, this.textureActiveY, this.width, this.height);
- }
- else
- {
- this.drawTexturedModalRect(this.xPosition, this.yPosition, this.textureX, this.textureY, this.width, this.height);
- }
- }
-
-}
diff --git a/ihl/collector/InvSlotMultiCharge.java b/ihl/collector/InvSlotMultiCharge.java deleted file mode 100644 index 5c1219f..0000000 --- a/ihl/collector/InvSlotMultiCharge.java +++ /dev/null @@ -1,96 +0,0 @@ -package ihl.collector;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import ic2.api.item.ElectricItem;
-import ic2.api.item.IElectricItem;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot;
-
-public class InvSlotMultiCharge extends InvSlot {
- public int tier;
-
- public InvSlotMultiCharge(TileEntityInventory base1, int oldStartIndex1, int tier1, int count)
- {
- super(base1, "charge", oldStartIndex1, InvSlot.Access.IO, count, InvSlot.InvSide.TOP);
- this.tier = tier1;
- }
-
- @Override
- public boolean accepts(ItemStack itemStack)
- {
- Item item = itemStack.getItem();
- return item instanceof IElectricItem ? ((IElectricItem)item).getTier(itemStack) <= this.tier : false;
- }
-
- public IElectricItem getItem(int slotNum)
- {
- ItemStack itemStack = this.get(slotNum);
- return itemStack == null ? null : (IElectricItem)itemStack.getItem();
- }
-
- public double charge(int amount, int slotNum)
- {
- ItemStack itemStack = this.get(slotNum);
-
- if (itemStack == null)
- {
- return 0;
- }
- else
- {
- Item item = itemStack.getItem();
- return item instanceof IElectricItem ? ElectricItem.manager.charge(itemStack, amount, this.tier, false, false) : 0;
- }
- }
-
- public void setTier(int tier1)
- {
- this.tier = tier1;
- }
-
- public boolean addItemStackToFirstEmptyStack(ItemStack stack)
- {
- int slotNum = this.getFirstEmptyStack();
- if(slotNum<0 || slotNum>=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<this.size();i++)
- {
- if(this.get(i)==null)
- {
- return i;
- }
- }
- return -1;
- }
-
- @Override
- public boolean isEmpty()
- {
- return this.getFirstEmptyStack()>=0;
- }
-}
|
