diff options
Diffstat (limited to 'ihl/flexible_cable')
24 files changed, 145 insertions, 626 deletions
diff --git a/ihl/flexible_cable/AnchorBlock.java b/ihl/flexible_cable/AnchorBlock.java index 7c12b49..9d9c1dc 100644 --- a/ihl/flexible_cable/AnchorBlock.java +++ b/ihl/flexible_cable/AnchorBlock.java @@ -1,10 +1,5 @@ package ihl.flexible_cable;
-import ic2.core.IC2;
-import ic2.core.item.tool.ItemToolWrench;
-import ihl.IHLCreativeTab;
import ihl.IHLModInfo;
-import ihl.enviroment.LightBulbTileEntity;
-import ihl.utils.IHLUtils;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -12,19 +7,14 @@ import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
-import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class AnchorBlock extends Block implements ITileEntityProvider {
- private String unlocalizedName;
private IIcon blockIconSide;
public AnchorBlock(String unlocalizedName1)
@@ -170,7 +160,6 @@ public class AnchorBlock extends Block implements ITileEntityProvider { {
AnchorTileEntity ate = (AnchorTileEntity) te;
float portSize=0.1f;
- boolean firstBB=false;
float bbMinX = 1f;
float bbMaxX = 0f;
float bbMinY = 1f;
diff --git a/ihl/flexible_cable/AnchorTileEntity.java b/ihl/flexible_cable/AnchorTileEntity.java index b9057ba..b03a3d9 100644 --- a/ihl/flexible_cable/AnchorTileEntity.java +++ b/ihl/flexible_cable/AnchorTileEntity.java @@ -8,8 +8,6 @@ import ic2.api.energy.tile.IEnergySource; import ic2.core.ExplosionIC2;
import ic2.core.IC2;
import ic2.core.block.TileEntityBlock;
-import ihl.IHLMod;
-import ihl.interfaces.ICableHolder;
import ihl.interfaces.IEnergyNetNode;
import ihl.interfaces.IMultiPowerCableHolder;
import ihl.utils.IHLUtils;
@@ -19,15 +17,11 @@ import java.util.Iterator; import java.util.List;
import java.util.Set;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
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.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
@@ -406,6 +400,7 @@ public class AnchorTileEntity extends TileEntityBlock implements IEnergySink, IE }
}
+ @Override
public boolean isCableRemoved(int chainUniqueID)
{
if(!checkCables)
diff --git a/ihl/flexible_cable/BatterySwitchUnitTileEntity.java b/ihl/flexible_cable/BatterySwitchUnitTileEntity.java index 375cb21..f4fc6c1 100644 --- a/ihl/flexible_cable/BatterySwitchUnitTileEntity.java +++ b/ihl/flexible_cable/BatterySwitchUnitTileEntity.java @@ -12,19 +12,12 @@ import ic2.api.energy.tile.IEnergySource; import ic2.api.network.INetworkClientTileEntityEventListener;
import ic2.core.ExplosionIC2;
import ic2.core.IC2;
-import ic2.core.block.TileEntityBlock;
-import ihl.IHLMod;
-import ihl.flexible_cable.IHLGrid;
-import ihl.flexible_cable.NodeEntity;
-import ihl.interfaces.IEnergyNetNode;
import ihl.utils.IHLUtils;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
diff --git a/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java b/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java index ee8ebf7..34455ac 100644 --- a/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java +++ b/ihl/flexible_cable/FlexibleCableHolderBaseTileEntity.java @@ -1,18 +1,10 @@ package ihl.flexible_cable;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import ic2.api.energy.event.EnergyTileLoadEvent;
-import ic2.api.energy.event.EnergyTileUnloadEvent;
-import ic2.api.energy.tile.IEnergySource;
-import ic2.api.network.INetworkClientTileEntityEventListener;
-import ic2.core.ExplosionIC2;
-import ic2.core.IC2;
-import ic2.core.block.TileEntityBlock;
import ic2.core.block.TileEntityInventory;
import ihl.IHLMod;
import ihl.flexible_cable.IHLGrid;
@@ -20,16 +12,10 @@ import ihl.flexible_cable.NodeEntity; import ihl.interfaces.IEnergyNetNode;
import ihl.utils.IHLUtils;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.common.util.ForgeDirection;
public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInventory implements IEnergyNetNode{
@@ -43,7 +29,7 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent public FlexibleCableHolderBaseTileEntity()
{
super();
- cableList=new HashSet();
+ cableList=new HashSet<NBTTagCompound>();
}
@Override
@@ -57,6 +43,7 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent }
}
+ @SuppressWarnings("unchecked")
@Override
public void setFacing(short facing1)
{
@@ -70,7 +57,7 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent setConnectionZ(this.zCoord+0.5D);
if(!nodeList.isEmpty())
{
- Iterator ei = nodeList.iterator();
+ Iterator<NodeEntity> ei = nodeList.iterator();
while(ei.hasNext())
{
NodeEntity ne=(NodeEntity) ei.next();
@@ -174,7 +161,6 @@ public abstract class FlexibleCableHolderBaseTileEntity extends TileEntityInvent if(newGridID!=-1)
{
this.gridID=newGridID;
- IHLGrid newGrid = IHLMod.enet.getGrid(newGridID);
IHLMod.enet.getGrid(newGridID).add(this);
}
else
diff --git a/ihl/flexible_cable/IHLENet.java b/ihl/flexible_cable/IHLENet.java index 2429aa7..32b5ebf 100644 --- a/ihl/flexible_cable/IHLENet.java +++ b/ihl/flexible_cable/IHLENet.java @@ -12,8 +12,8 @@ import net.minecraft.nbt.NBTTagCompound; public class IHLENet {
- public Map<Integer, IHLGrid> grids = new HashMap();
- public Map<Integer, IHLGrid> cablesToGrids = new HashMap();
+ public Map<Integer, IHLGrid> grids = new HashMap<Integer, IHLGrid>();
+ public Map<Integer, IHLGrid> cablesToGrids = new HashMap<Integer, IHLGrid>();
private int griduid=0;
diff --git a/ihl/flexible_cable/IHLGrid.java b/ihl/flexible_cable/IHLGrid.java index 04a9d4c..a47c229 100644 --- a/ihl/flexible_cable/IHLGrid.java +++ b/ihl/flexible_cable/IHLGrid.java @@ -18,22 +18,21 @@ import net.minecraft.server.MinecraftServer; public class IHLGrid
{
private static final double powerLossLimitPerMeter=1.6D;
- public final Set<IEnergyNetNode> telist = new HashSet();
+ public final Set<IEnergyNetNode> telist = new HashSet<IEnergyNetNode>();
public double energy=0D;
private IEnergyNetNode sink;
private IEnergyNetNode source;
private double voltage;
- private short frequency=0;
private double lastVoltage;
public boolean isGridValid=true;
private double total20TicksEU;
private int lastTickCounter=0;
private int tickCounterFireStart=0;
- public final List<IEnergyNetNode> calculatedSinks = new ArrayList();
- public final List<IEnergyNetNode> calculatedSources = new ArrayList();
- public final Set<NBTTagCompound> cablesOnFire = new HashSet();
- private final Map<IEnergyNetNode, Double> energyLossSinkMap = new HashMap();
- private final Map<IEnergyNetNode, Double> voltageSinkMap = new HashMap();
+ public final List<IEnergyNetNode> calculatedSinks = new ArrayList<IEnergyNetNode>();
+ public final List<IEnergyNetNode> calculatedSources = new ArrayList<IEnergyNetNode>();
+ public final Set<NBTTagCompound> cablesOnFire = new HashSet<NBTTagCompound> ();
+ private final Map<IEnergyNetNode, Double> energyLossSinkMap = new HashMap<IEnergyNetNode, Double>();
+ private final Map<IEnergyNetNode, Double> voltageSinkMap = new HashMap<IEnergyNetNode, Double>();
private double averageEUTransfered;
private double lastAverageEUTransfered=0D;
@@ -151,10 +150,10 @@ public class IHLGrid this.averageEUTransfered>this.lastAverageEUTransfered ||
this.voltage!=this.lastVoltage))
{
- Map<IEnergyNetNode, NBTTagCompound> map = new HashMap();
- Set<IEnergyNetNode> templist = new HashSet();
- Set<IEnergyNetNode> processlist = new HashSet();
- Set<IEnergyNetNode> templist2 = new HashSet();
+ Map<IEnergyNetNode, NBTTagCompound> map = new HashMap<IEnergyNetNode, NBTTagCompound>();
+ Set<IEnergyNetNode> templist = new HashSet<IEnergyNetNode>();
+ Set<IEnergyNetNode> processlist = new HashSet<IEnergyNetNode>();
+ Set<IEnergyNetNode> templist2 = new HashSet<IEnergyNetNode>();
templist.addAll(telist);
processlist.add(sink);
int threads=0;
diff --git a/ihl/flexible_cable/InvSlotOutputInProgress.java b/ihl/flexible_cable/InvSlotOutputInProgress.java index 2b5bfda..3694aee 100644 --- a/ihl/flexible_cable/InvSlotOutputInProgress.java +++ b/ihl/flexible_cable/InvSlotOutputInProgress.java @@ -79,7 +79,7 @@ public class InvSlotOutputInProgress extends IronWorkbenchInvSlot{ public List<ItemStack> getRecipeOutputs(int currentSlot)
{
int slotRecipeIndex=this.slotRecipe[currentSlot];
- List<ItemStack> list = new ArrayList();
+ List<ItemStack> list = new ArrayList<ItemStack>();
for(int i=0;i<this.size;i++)
{
if(this.slotRecipe[i]==slotRecipeIndex)
diff --git a/ihl/flexible_cable/InvSlotProcessableIronWorkbench.java b/ihl/flexible_cable/InvSlotProcessableIronWorkbench.java index a5b8ee5..adb51f5 100644 --- a/ihl/flexible_cable/InvSlotProcessableIronWorkbench.java +++ b/ihl/flexible_cable/InvSlotProcessableIronWorkbench.java @@ -1,10 +1,14 @@ package ihl.flexible_cable;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidContainerRegistry;
import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputFluidContainer;
import ic2.core.IC2;
import ic2.core.item.ItemUpgradeModule;
import ihl.interfaces.IWire;
@@ -41,8 +45,9 @@ public class InvSlotProcessableIronWorkbench extends IronWorkbenchInvSlot { }
}
- public void substract(List<IRecipeInput> materials, int multiplier)
+ public Set<ItemStack> substract(List<IRecipeInput> materials, int multiplier)
{
+ Set<ItemStack> output = new HashSet<ItemStack>();
Iterator<IRecipeInput> i1 = materials.iterator();
while(i1.hasNext())
{
@@ -59,6 +64,25 @@ public class InvSlotProcessableIronWorkbench extends IronWorkbenchInvSlot { is.stackSize=0;
}
}
+ else if(is1 instanceof RecipeInputFluidContainer)
+ {
+ if(is.stackSize==1)
+ {
+ output.add(FluidContainerRegistry.drainFluidContainer(is));
+ is.stackSize=0;
+ }
+ else
+ {
+ is.stackSize-=is1.getAmount()*multiplier;
+ ItemStack iscopy = is.copy();
+ iscopy.stackSize=1;
+ ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(iscopy);
+ if(emptyContainer!=null)
+ {
+ output.add(emptyContainer);
+ }
+ }
+ }
else
{
is.stackSize-=is1.getAmount()*multiplier;
@@ -71,6 +95,7 @@ public class InvSlotProcessableIronWorkbench extends IronWorkbenchInvSlot { }
}
}
+ return output;
}
public int getAmountOf(ItemStack rubber)
diff --git a/ihl/flexible_cable/InvSlotTool.java b/ihl/flexible_cable/InvSlotTool.java index b3a3855..0ffbcd9 100644 --- a/ihl/flexible_cable/InvSlotTool.java +++ b/ihl/flexible_cable/InvSlotTool.java @@ -9,77 +9,61 @@ import ic2.core.IC2; import ic2.core.Ic2Items;
import ic2.core.item.ItemUpgradeModule;
import ihl.interfaces.IWire;
+import ihl.recipes.IronWorkbenchRecipe;
import ihl.utils.IHLUtils;
public class InvSlotTool extends IronWorkbenchInvSlot {
- public InvSlotTool(IronWorkbenchTileEntity base1, String name1,
- int oldStartIndex1, Access access1, int count) {
+ public InvSlotTool(IronWorkbenchTileEntity base1, String name1, int oldStartIndex1, Access access1, int count) {
super(base1, name1, oldStartIndex1, access1, count);
// TODO Auto-generated constructor stub
}
- public void damage(List<IRecipeInput> tools)
- {
- if(tools!=null && !tools.isEmpty())
- {
- for(int i=0;i<this.size();i++)
- {
+ public void damage(List<IRecipeInput> tools) {
+ if (tools != null && !tools.isEmpty()) {
+ for (int i = 0; i < this.size(); i++) {
ItemStack is = this.get(i);
- Iterator<IRecipeInput> i1 = tools.iterator();
- while(i1.hasNext())
- {
+ Iterator<IRecipeInput> i1 = tools.iterator();
+ while (i1.hasNext()) {
IRecipeInput is1 = i1.next();
- if(is!=null && (is1.matches(is)))
- {
- if(!is.attemptDamageItem(1, IC2.random))
- {
- if(is.stackTagCompound!=null && is.stackTagCompound.hasKey("GT.ToolStats"))
- {
+ if (is != null && (is1.matches(is))) {
+ if (!is.attemptDamageItem(1, IC2.random)) {
+ if (is.stackTagCompound != null && is.stackTagCompound.hasKey("GT.ToolStats")) {
IHLUtils.damageItemViaNBTTag(is, 1);
}
}
- if(is.stackSize<=0)
- {
- this.put(i,null);
+ if (is.stackSize <= 0) {
+ this.put(i, null);
}
}
}
}
}
}
-
+
@Override
- public void put(int index, ItemStack content)
- {
+ public void put(int index, ItemStack content) {
super.put(index, content);
- if(IC2.platform.isSimulating() && ((IronWorkbenchTileEntity)this.base).container!=null)
- {
- ((IronWorkbenchTileEntity)this.base).resetOutput();
- ((IronWorkbenchTileEntity)this.base).container.detectAndSendChanges();
+ if (IC2.platform.isSimulating() && ((IronWorkbenchTileEntity) this.base).container != null) {
+ ((IronWorkbenchTileEntity) this.base).resetOutput();
+ ((IronWorkbenchTileEntity) this.base).container.detectAndSendChanges();
}
- }
-
+ }
+
@Override
- public boolean accepts(ItemStack itemStack)
- {
- if (itemStack != null && (itemStack.getItem() instanceof ItemUpgradeModule || itemStack.getItem() instanceof IWire|| itemStack.getItem()==Ic2Items.rubber.getItem()))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
+ public boolean accepts(ItemStack itemStack) {
+ for (IronWorkbenchRecipe recipe : IronWorkbenchTileEntity.recipes) {
+ if (recipe.isTool(itemStack)) {
+ return true;
+ }
+ }
+ return false;
+ }
- public boolean contain(ItemStack is1)
- {
- for(int i=0;i<this.size();i++)
- {
+ public boolean contain(ItemStack is1) {
+ for (int i = 0; i < this.size(); i++) {
ItemStack is = this.get(i);
- if(is!=null && (is.getItem()==is1.getItem()||IHLUtils.isItemsHaveSameOreDictionaryEntry(is, is1)))
- {
+ if (is != null && (is.getItem() == is1.getItem() || IHLUtils.isItemsHaveSameOreDictionaryEntry(is, is1))) {
return true;
}
}
diff --git a/ihl/flexible_cable/InvSlotWorkspaceElement.java b/ihl/flexible_cable/InvSlotWorkspaceElement.java index 53af541..0ae0d26 100644 --- a/ihl/flexible_cable/InvSlotWorkspaceElement.java +++ b/ihl/flexible_cable/InvSlotWorkspaceElement.java @@ -7,7 +7,6 @@ import java.util.List; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
-import ihl.IHLMod;
import ihl.interfaces.IWorkspaceElement;
import ihl.utils.IHLUtils;
@@ -68,7 +67,6 @@ public class InvSlotWorkspaceElement extends IronWorkbenchInvSlot { while(iterator.hasNext())
{
ItemStack rWorkspaceElementItemStack = iterator.next();
- boolean presence=false;
for(int i=1;i<workspaceElements.length;i++)
{
IWorkspaceElement cWorkspaceElement=workspaceElements[i];
@@ -149,18 +147,6 @@ public class InvSlotWorkspaceElement extends IronWorkbenchInvSlot { return false;
}
- private boolean contains(ItemStack wse)
- {
- for(int i=1;i<size();i++)
- {
- if(this.get(i)!=null && this.get(i).getItem()==wse.getItem())
- {
- return true;
- }
- }
- return false;
- }
-
public short encodeReadyStatus()
{
short result=0;
@@ -187,7 +173,7 @@ public class InvSlotWorkspaceElement extends IronWorkbenchInvSlot { @Override
public List<ItemStack> getItemStackList()
{
- List<ItemStack> list = new ArrayList();
+ List<ItemStack> list = new ArrayList<ItemStack>();
for(int i=1; i<this.size(); i++)
{
if(get(i)!=null)list.add(get(i));
diff --git a/ihl/flexible_cable/IronWorkbenchContainer.java b/ihl/flexible_cable/IronWorkbenchContainer.java index 9429663..b25c790 100644 --- a/ihl/flexible_cable/IronWorkbenchContainer.java +++ b/ihl/flexible_cable/IronWorkbenchContainer.java @@ -1,13 +1,13 @@ package ihl.flexible_cable;
import ic2.core.ContainerBase;
-import ic2.core.slot.SlotInvSlot;
import ihl.processing.invslots.SlotInvSlotOutputInProgress;
+import ihl.processing.invslots.SlotInvSlotIronWorkbench;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
-public class IronWorkbenchContainer extends ContainerBase {
+public class IronWorkbenchContainer extends ContainerBase<IronWorkbenchTileEntity> {
protected IronWorkbenchTileEntity tileEntity;
private int lastProgress1 = -1;
@@ -37,14 +37,14 @@ public class IronWorkbenchContainer extends ContainerBase { {
for(col=0;col<=1;col++)
{
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.tools, row+col*6, 26+col*18, 8+row*18));
+ this.addSlotToContainer(new SlotInvSlotIronWorkbench(tileEntity1.tools, row+col*6, 26+col*18, 8+row*18));
}
}
for(row=0;row<6;row++)
{
for(col=0;col<=1;col++)
{
- this.addSlotToContainer(new SlotInvSlot(tileEntity1.inputMaterial, row+col*6, 65+col*18, 8+row*18));
+ this.addSlotToContainer(new SlotInvSlotIronWorkbench(tileEntity1.inputMaterial, row+col*6, 65+col*18, 8+row*18));
}
}
for (row = 0; row<6; ++row)
diff --git a/ihl/flexible_cable/IronWorkbenchGui.java b/ihl/flexible_cable/IronWorkbenchGui.java index 131f2f7..dedb9d8 100644 --- a/ihl/flexible_cable/IronWorkbenchGui.java +++ b/ihl/flexible_cable/IronWorkbenchGui.java @@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11;
-import ic2.core.network.NetworkManager;
import ihl.interfaces.IItemHasMiniGUI;
import ihl.interfaces.ItemMiniGUI;
import ihl.utils.IHLRenderUtils;
@@ -22,21 +21,12 @@ public class IronWorkbenchGui extends GuiContainer { private static final short outputslotoffset=66;
public IronWorkbenchGui (IronWorkbenchContainer container1) {
- //the container is instanciated and passed to the superclass for handling
super(container1);
this.container=container1;
this.ySize=IronWorkbenchContainer.height;
}
@Override
- public void initGui()
- {
- super.initGui();
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- }
-
- @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
int x = (width - xSize) / 2;
@@ -103,7 +93,6 @@ public class IronWorkbenchGui extends GuiContainer { this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
if (this.container.tileEntity.progress > 0)
{
- int progressLevel=Math.min(Math.round(this.container.tileEntity.progress*16.0F/this.container.tileEntity.maxProgress),16);
int frameNum=0;
short slotRecipeNum=this.container.tileEntity.output.slotRecipe[0];
for(int row = 0;row<6;row++)
diff --git a/ihl/flexible_cable/IronWorkbenchInvSlot.java b/ihl/flexible_cable/IronWorkbenchInvSlot.java index 830f9b4..380b6d3 100644 --- a/ihl/flexible_cable/IronWorkbenchInvSlot.java +++ b/ihl/flexible_cable/IronWorkbenchInvSlot.java @@ -15,7 +15,7 @@ public class IronWorkbenchInvSlot extends InvSlot { public List<ItemStack> getItemStackList()
{
- List<ItemStack> list = new ArrayList();
+ List<ItemStack> list = new ArrayList<ItemStack>();
for(int i=0; i<this.size(); i++)
{
if(get(i)!=null)list.add(get(i));
diff --git a/ihl/flexible_cable/IronWorkbenchRender.java b/ihl/flexible_cable/IronWorkbenchRender.java index 3bfc946..7afdf17 100644 --- a/ihl/flexible_cable/IronWorkbenchRender.java +++ b/ihl/flexible_cable/IronWorkbenchRender.java @@ -2,15 +2,11 @@ package ihl.flexible_cable; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
-import ic2.api.tile.IWrenchable;
-import ihl.IHLModInfo;
import ihl.utils.IHLItemRenderer;
public class IronWorkbenchRender extends TileEntitySpecialRenderer{
-private final float scale=1F/16F;
private IHLItemRenderer itemRenderer=new IHLItemRenderer(true);
public IronWorkbenchRender(){}
diff --git a/ihl/flexible_cable/IronWorkbenchRender.java~ b/ihl/flexible_cable/IronWorkbenchRender.java~ deleted file mode 100644 index b6420c6..0000000 --- a/ihl/flexible_cable/IronWorkbenchRender.java~ +++ /dev/null @@ -1,40 +0,0 @@ -package ihl.flexible_cable;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-
-import ic2.api.tile.IWrenchable;
-import ihl.IHLModInfo;
-import ihl.utils.IHLItemRenderer;
-
-public class IronWorkbenchRender extends TileEntitySpecialRenderer{
-private final float scale=1F/16F;
-private IHLItemRenderer itemRenderer=new IHLItemRenderer(true);
-
-public IronWorkbenchRender(){}
-
-public void renderAModelAt(IronWorkbenchTileEntity tile, double x, double y, double z, float f) {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y+0.5F, (float)z + 0.5F);
- GL11.glRotatef(90f, 1F, 0F, 0F);
- int index = 0;
- for (int i = 0; i < tile.tools.size() && index < 8; i++) {
- if (tile.tools.get(i)!=null) {
- float iy = index >= 4 ? -0.5f : 0f;
- float ix = (index % 2) * 0.4f-0.2f;
- float iz = (index / 2) * 0.4f-0.2f + iy;
- this.itemRenderer.doRender(RenderManager.instance,tile.tools.get(i),ix,iz,iy-0.002f*index);
- index++;
- }
- }
- GL11.glPopMatrix();
-}
-
- @Override
- public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
- {
- this.renderAModelAt((IronWorkbenchTileEntity)par1TileEntity, par2, par4, par6, par8);
- }
-}
diff --git a/ihl/flexible_cable/IronWorkbenchTileEntity.java b/ihl/flexible_cable/IronWorkbenchTileEntity.java index 3821a0c..73a3eb1 100644 --- a/ihl/flexible_cable/IronWorkbenchTileEntity.java +++ b/ihl/flexible_cable/IronWorkbenchTileEntity.java @@ -3,9 +3,11 @@ package ihl.flexible_cable; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -14,29 +16,26 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import ic2.api.network.INetworkClientTileEntityEventListener;
import ic2.api.network.INetworkTileEntityEventListener;
import ic2.api.recipe.IRecipeInput;
-import ic2.api.recipe.RecipeInputItemStack;
import ic2.core.ContainerBase;
-import ic2.core.IC2;
import ic2.core.IHasGui;
-import ic2.core.Ic2Items;
import ic2.core.block.TileEntityInventory;
import ic2.core.block.invslot.InvSlot.Access;
import ihl.IHLMod;
import ihl.interfaces.IWire;
-import ihl.items_blocks.FlexibleCableItem;
-import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity;
-import ihl.processing.metallurgy.GasWeldingStationTileEntity;
import ihl.recipes.IronWorkbenchRecipe;
+import ihl.recipes.RecipeInputDetonator;
import ihl.recipes.RecipeInputDie;
import ihl.recipes.RecipeInputObjectInstance;
import ihl.utils.IHLUtils;
public class IronWorkbenchTileEntity extends TileEntityInventory implements IHasGui, INetworkClientTileEntityEventListener, INetworkTileEntityEventListener{
- public static List<IronWorkbenchRecipe> recipes = new ArrayList();
+ public static List<IronWorkbenchRecipe> recipes = new ArrayList<IronWorkbenchRecipe>();
public int progress;
public int currentSlot=-1;
public final int maxProgress;
@@ -49,7 +48,8 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas private boolean outputDefined=false;
private EntityPlayer crafter;
public ContainerBase<?> container;
- private Map<Integer, IronWorkbenchRecipe> slotRecipeMap = new HashMap();
+ private Map<Integer, IronWorkbenchRecipe> slotRecipeMap = new HashMap<Integer, IronWorkbenchRecipe>();
+ private boolean firstTick = true;
public IronWorkbenchTileEntity()
{
@@ -77,7 +77,18 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas {
return IHLUtils.getThisModItemStack("ironWorkbench");
}
-
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateEntityClient()
+ {
+ if(firstTick)
+ {
+ IHLMod.proxy.requestTileEntityInitdataFromClientToServer(xCoord, yCoord, zCoord);
+ this.firstTick=false;
+ }
+ }
+
@Override
public void updateEntityServer()
{
@@ -102,6 +113,13 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas newOutputs = ((RecipeInputDie)rinput).transformOutput(this.getMatchedItemStack(rinput),recipe.outputs);
}
}
+ for(IRecipeInput rinput:recipe.materials)
+ {
+ if(rinput instanceof RecipeInputDetonator)
+ {
+ newOutputs = ((RecipeInputDetonator)rinput).transformOutput(this.getMatchedItemStack(rinput),recipe.outputs);
+ }
+ }
int slot = this.output.put(newOutputs);
if(slot<0)break;
slotRecipeMap.put(slot, recipe);
@@ -109,7 +127,6 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas }
}
}
- List<ItemStack> processingMaterials = new ArrayList<ItemStack>();
for(int i=0; i<this.inputMaterial.size();i++)
{
ItemStack stack = this.inputMaterial.get(i);
@@ -136,7 +153,7 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas }
else if(!this.output.isEmpty())
{
- List<Integer> crafterEmptyInventorySlotsList = getCrafterEmptyInventorySlotsList();
+ Set<Integer> crafterEmptyInventorySlotsList = getCrafterEmptyInventorySlotsList();
if(startProcess && crafterEmptyInventorySlotsList.size()>=this.slotRecipeMap.get(currentSlot).outputs.size())
{
if(++this.progress>=this.maxProgress)
@@ -150,10 +167,8 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas {
int slot = emptySlotsIterator.next();
ItemStack stack = optsi.next();
- this.crafter.inventory.mainInventory[slot]=stack.copy();
if(stack.getItem() instanceof IWire)
{
- System.out.println(multiplier);
this.crafter.inventory.mainInventory[slot]=IHLUtils.getWireItemStackCopyWithLengthMultiplied(stack,multiplier);
}
else
@@ -162,8 +177,23 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas this.crafter.inventory.mainInventory[slot].stackSize*=multiplier;
}
}
+ Iterator<ItemStack> emptyContainers = this.inputMaterial.substract(crecipe.materials, multiplier).iterator();
+ while(emptyContainers.hasNext())
+ {
+ if(emptySlotsIterator.hasNext())
+ {
+ int slot = emptySlotsIterator.next();
+ ItemStack stack = emptyContainers.next();
+ this.crafter.inventory.mainInventory[slot]=stack.copy();
+ this.crafter.inventory.mainInventory[slot].stackSize*=multiplier;
+ }
+ else
+ {
+ EntityItem eistack = new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, emptyContainers.next());
+ this.worldObj.spawnEntityInWorld(eistack);
+ }
+ }
this.crafter.inventoryContainer.detectAndSendChanges();
- this.inputMaterial.substract(crecipe.materials, multiplier);
this.tools.damage(crecipe.tools);
if(!crecipe.workspaceElements.isEmpty())
{
@@ -196,9 +226,9 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas return null;
}
- private List<Integer> getCrafterEmptyInventorySlotsList()
+ private Set<Integer> getCrafterEmptyInventorySlotsList()
{
- List<Integer> list = new ArrayList<Integer>();
+ Set<Integer> list = new HashSet<Integer>(4);
if(this.crafter!=null)
{
for (int var1 = 0; var1 < this.crafter.inventory.mainInventory.length; ++var1)
@@ -213,7 +243,7 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas }
private List<RecipeInputObjectInstance> getListOfSameWires(ItemStack stack1) {
- List<RecipeInputObjectInstance> list = new ArrayList();
+ List<RecipeInputObjectInstance> list = new ArrayList<RecipeInputObjectInstance>();
for(int i=0; i<this.inputMaterial.size();i++)
{
ItemStack stack = this.inputMaterial.get(i);
@@ -361,7 +391,12 @@ public class IronWorkbenchTileEntity extends TileEntityInventory implements IHas ri.remove();
}
}
-
}
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
+ {
+ this.readFromNBT(pkt.func_148857_g());
+ }
}
diff --git a/ihl/flexible_cable/IronWorkbenchTileEntity.java~ b/ihl/flexible_cable/IronWorkbenchTileEntity.java~ deleted file mode 100644 index 3821a0c..0000000 --- a/ihl/flexible_cable/IronWorkbenchTileEntity.java~ +++ /dev/null @@ -1,367 +0,0 @@ -package ihl.flexible_cable;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import ic2.api.network.INetworkClientTileEntityEventListener;
-import ic2.api.network.INetworkTileEntityEventListener;
-import ic2.api.recipe.IRecipeInput;
-import ic2.api.recipe.RecipeInputItemStack;
-import ic2.core.ContainerBase;
-import ic2.core.IC2;
-import ic2.core.IHasGui;
-import ic2.core.Ic2Items;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot.Access;
-import ihl.IHLMod;
-import ihl.interfaces.IWire;
-import ihl.items_blocks.FlexibleCableItem;
-import ihl.processing.chemistry.GaedesMercuryRotaryPumpTileEntity;
-import ihl.processing.metallurgy.GasWeldingStationTileEntity;
-import ihl.recipes.IronWorkbenchRecipe;
-import ihl.recipes.RecipeInputDie;
-import ihl.recipes.RecipeInputObjectInstance;
-import ihl.utils.IHLUtils;
-
-public class IronWorkbenchTileEntity extends TileEntityInventory implements IHasGui, INetworkClientTileEntityEventListener, INetworkTileEntityEventListener{
-
- public static List<IronWorkbenchRecipe> recipes = new ArrayList();
- public int progress;
- public int currentSlot=-1;
- public final int maxProgress;
- public final InvSlotTool tools;
- public final InvSlotWorkspaceElement workspaceElements;
- public final InvSlotProcessableIronWorkbench inputMaterial;
- public final InvSlotOutputInProgress output;
- public boolean isGuiScreenOpened=false;
- private boolean startProcess=false;
- private boolean outputDefined=false;
- private EntityPlayer crafter;
- public ContainerBase<?> container;
- private Map<Integer, IronWorkbenchRecipe> slotRecipeMap = new HashMap();
-
- public IronWorkbenchTileEntity()
- {
- this.maxProgress=80;
- this.workspaceElements = new InvSlotWorkspaceElement(this, "workspaceElements", 3, Access.NONE, 6);
- this.tools=new InvSlotTool(this, "tools", 0, Access.IO, 12);
- this.inputMaterial=new InvSlotProcessableIronWorkbench(this, "input", 1, Access.IO, 12);
- this.output=new InvSlotOutputInProgress(this, "output", 2, 18);
- }
-
- public static void addRecipe(IronWorkbenchRecipe recipe)
- {
- IronWorkbenchTileEntity.recipes.add(recipe);
- }
-
- @Override
- public String getInventoryName()
- {
- return "ironWorkbench";
- }
-
-
- @Override
- public ItemStack getWrenchDrop(EntityPlayer player)
- {
- return IHLUtils.getThisModItemStack("ironWorkbench");
- }
-
- @Override
- public void updateEntityServer()
- {
- if(this.isGuiScreenOpened)
- {
- if(this.output.isEmpty() && !outputDefined)
- {
- this.workspaceElements.reset();
- Iterator<IronWorkbenchRecipe> iwri=IronWorkbenchTileEntity.recipes.iterator();
- while(iwri.hasNext())
- {
- IronWorkbenchRecipe recipe = iwri.next();
- if(recipe.isCanBeCrafted(this.tools.getItemStackList(), this.inputMaterial.getItemStackList(), this.workspaceElements.getItemStackList()))
- {
- if(recipe.workspaceElements==null || recipe.workspaceElements.isEmpty() || this.workspaceElements.containsAndCanUse(recipe.workspaceElements))
- {
- List<ItemStack> newOutputs = recipe.outputs;
- for(IRecipeInput rinput:recipe.tools)
- {
- if(rinput instanceof RecipeInputDie)
- {
- newOutputs = ((RecipeInputDie)rinput).transformOutput(this.getMatchedItemStack(rinput),recipe.outputs);
- }
- }
- int slot = this.output.put(newOutputs);
- if(slot<0)break;
- slotRecipeMap.put(slot, recipe);
- this.startProcess=false;
- }
- }
- }
- List<ItemStack> processingMaterials = new ArrayList<ItemStack>();
- for(int i=0; i<this.inputMaterial.size();i++)
- {
- ItemStack stack = this.inputMaterial.get(i);
- if(stack!=null && stack.getItem() instanceof IWire)
- {
- if(stack.stackTagCompound==null)
- {
- stack.stackTagCompound=new NBTTagCompound();
- }
- int fullLength = this.getFullLengthOfSameWires(stack);
- List<RecipeInputObjectInstance> list = this.getListOfSameWires(stack);
- ItemStack result = stack.copy();
- result.stackTagCompound.setInteger("length", fullLength);
- result.stackTagCompound.setInteger("fullLength", fullLength);
- IronWorkbenchRecipe recipe = new IronWorkbenchRecipe(null, list, Arrays.asList(new ItemStack[] {result}));
- int slot = this.output.put(recipe.outputs);
- if(slot<0)break;
- slotRecipeMap.put(slot, recipe);
- this.startProcess=false;
- break;
- }
- }
- outputDefined=true;
- }
- else if(!this.output.isEmpty())
- {
- List<Integer> crafterEmptyInventorySlotsList = getCrafterEmptyInventorySlotsList();
- if(startProcess && crafterEmptyInventorySlotsList.size()>=this.slotRecipeMap.get(currentSlot).outputs.size())
- {
- if(++this.progress>=this.maxProgress)
- {
- IronWorkbenchRecipe crecipe = this.slotRecipeMap.get(currentSlot);
- List<ItemStack> opts = this.output.getRecipeOutputs(currentSlot);
- int multiplier = this.inputMaterial.getMultiplier(crecipe.materials);
- Iterator<ItemStack> optsi = opts.iterator();
- Iterator<Integer> emptySlotsIterator = crafterEmptyInventorySlotsList.iterator();
- while(optsi.hasNext())
- {
- int slot = emptySlotsIterator.next();
- ItemStack stack = optsi.next();
- this.crafter.inventory.mainInventory[slot]=stack.copy();
- if(stack.getItem() instanceof IWire)
- {
- System.out.println(multiplier);
- this.crafter.inventory.mainInventory[slot]=IHLUtils.getWireItemStackCopyWithLengthMultiplied(stack,multiplier);
- }
- else
- {
- this.crafter.inventory.mainInventory[slot]=stack.copy();
- this.crafter.inventory.mainInventory[slot].stackSize*=multiplier;
- }
- }
- this.crafter.inventoryContainer.detectAndSendChanges();
- this.inputMaterial.substract(crecipe.materials, multiplier);
- this.tools.damage(crecipe.tools);
- if(!crecipe.workspaceElements.isEmpty())
- {
- this.workspaceElements.use(crecipe.workspaceElements);
- }
- this.resetOutput();
- }
- }
- }
- }
- }
-
- private ItemStack getMatchedItemStack(IRecipeInput rinput)
- {
- for(ItemStack tool:this.tools.getItemStackList())
- {
- if(rinput.matches(tool))
- {
- return tool;
- }
- }
- for(ItemStack material:this.inputMaterial.getItemStackList())
- {
- if(rinput.matches(material))
- {
- return material;
- }
- }
-
- return null;
- }
-
- private List<Integer> getCrafterEmptyInventorySlotsList()
- {
- List<Integer> list = new ArrayList<Integer>();
- if(this.crafter!=null)
- {
- for (int var1 = 0; var1 < this.crafter.inventory.mainInventory.length; ++var1)
- {
- if (this.crafter.inventory.mainInventory[var1] == null)
- {
- list.add(var1);
- }
- }
- }
- return list;
- }
-
- private List<RecipeInputObjectInstance> getListOfSameWires(ItemStack stack1) {
- List<RecipeInputObjectInstance> list = new ArrayList();
- for(int i=0; i<this.inputMaterial.size();i++)
- {
- ItemStack stack = this.inputMaterial.get(i);
- if(stack!=null && ((IWire)stack1.getItem()).isSameWire(stack1, stack))
- {
- list.add(new RecipeInputObjectInstance(stack));
- }
- }
- return list;
- }
-
- private int getFullLengthOfSameWires(ItemStack stack1) {
- int fullLength=0;
- for(int i=0; i<this.inputMaterial.size();i++)
- {
- ItemStack stack = this.inputMaterial.get(i);
- if(stack!=null && ((IWire)stack1.getItem()).isSameWire(stack1, stack))
- {
- fullLength += IHLUtils.getWireLength(stack);
- }
- }
- return fullLength;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public GuiScreen getGui(EntityPlayer player, boolean arg1) {
- return new IronWorkbenchGui(new IronWorkbenchContainer(player, this));
- }
-
- @Override
- public ContainerBase<?> getGuiContainer(EntityPlayer player) {
- resetOutput();
- this.isGuiScreenOpened=true;
- this.crafter=player;
- container = new IronWorkbenchContainer(player, this);
- return container;
- }
-
- @Override
- public void onGuiClosed(EntityPlayer arg0)
- {
- this.isGuiScreenOpened=false;
- }
-
- @Override
- public void onNetworkEvent(EntityPlayer player, int event)
- {
- if(event==16)
- {
- this.isGuiScreenOpened=false;
- this.crafter=null;
- this.container=null;
- return;
- }
- for(int i=event;i>=0;i--)
- {
- if(this.slotRecipeMap.containsKey(i))
- {
- if(!this.slotRecipeMap.get(i).isCanBeCrafted(this.tools.getItemStackList(), this.inputMaterial.getItemStackList(), this.workspaceElements.getItemStackList()))
- {
- resetOutput();
- }
- else
- {
- this.currentSlot=i;
- this.startProcess=true;
- return;
- }
- }
- }
- }
-
- public void resetOutput()
- {
- this.output.clear();
- this.slotRecipeMap.clear();
- this.progress=0;
- this.startProcess=false;
- this.currentSlot=-1;
- this.outputDefined=false;
- }
-
-
- public void dropContents() {
- for(int i=0;i<this.tools.size();i++)
- {
- if(this.tools.get(i)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.tools.get(i)));
- }
- for(int i=0;i<this.inputMaterial.size();i++)
- {
- if(this.inputMaterial.get(i)!=null)this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord+1, this.zCoord, this.inputMaterial.get(i)));
- }
- }
-
- @Override
- public void onNetworkEvent(int event)
- {
-
- }
-
- public int gaugeProgressScaled(int i)
- {
- return this.progress * i / this.maxProgress;
- }
-
- @Override
- public boolean shouldRenderInPass(int pass)
- {
- return pass==0;
- }
-
- public static void removeRecipeByOutput(List<ItemStack> recipeOutputsItems)
- {
- Iterator<IronWorkbenchRecipe> ri = recipes.iterator();
- while(ri.hasNext())
- {
- IronWorkbenchRecipe recipe = ri.next();
- boolean removeEntry=false;
- Iterator<ItemStack> roi = recipe.outputs.iterator();
- while(roi.hasNext())
- {
- if(IHLUtils.isItemStacksIsEqual(recipeOutputsItems.get(0), roi.next(), true))
- {
- removeEntry=true;
- }
- }
- if(removeEntry)
- {
- ri.remove();
- }
- }
-
- }
-
- public static void removeRecipeByInput(List<IRecipeInput> recipeInputsTools1,List<IRecipeInput> recipeInputsItems1,List<ItemStack> recipeInputsMachines) {
- List<ItemStack> recipeInputsTools = IHLUtils.convertRecipeInputToItemStackList(recipeInputsTools1);
- List<ItemStack> recipeInputsItems = IHLUtils.convertRecipeInputToItemStackList(recipeInputsItems1);
- Iterator<IronWorkbenchRecipe> ri = recipes.iterator();
- while(ri.hasNext())
- {
- IronWorkbenchRecipe recipe = ri.next();
- if(recipe.isCanBeCrafted(recipeInputsTools, recipeInputsItems, recipeInputsMachines))
- {
- ri.remove();
- }
- }
-
- }
-
-}
diff --git a/ihl/flexible_cable/NodeEntity.java b/ihl/flexible_cable/NodeEntity.java index 623c9a1..b734cd1 100644 --- a/ihl/flexible_cable/NodeEntity.java +++ b/ihl/flexible_cable/NodeEntity.java @@ -6,36 +6,25 @@ import java.util.Iterator; import java.util.List;
import java.util.Set;
-import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import ihl.IHLMod;
import ihl.IHLModInfo;
import ihl.interfaces.ICableHolder;
-import ihl.interfaces.IDataCableHolder;
-import ihl.interfaces.IEnergyNetNode;
import ihl.interfaces.IMultiPowerCableHolder;
import ihl.interfaces.INetworkListener;
import ihl.items_blocks.FlexibleCableItem;
-import ihl.utils.IHLUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@@ -109,6 +98,7 @@ public class NodeEntity extends Entity implements INetworkListener{ @Override
public void travelToDimension(int dimensionId){}
+ @Override
public void setSize(float width, float heigth)
{
super.setSize(width, heigth);
@@ -122,6 +112,7 @@ public class NodeEntity extends Entity implements INetworkListener{ this.registerAndSendData(null);
}
+ @Override
public void registerAndSendData(EntityPlayerMP player)
{
if(!worldObj.isRemote)
@@ -135,7 +126,7 @@ public class NodeEntity extends Entity implements INetworkListener{ }
else
{
- nes=new HashSet();
+ nes=new HashSet<NodeEntity>();
IHLMod.proxy.nodeEntityRegistry.put(this.getChainUniqueID(),nes);
}
nes.add(this);
@@ -172,7 +163,8 @@ public class NodeEntity extends Entity implements INetworkListener{ }
}
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public void onUpdate()
{
super.onUpdate();
@@ -194,7 +186,7 @@ public class NodeEntity extends Entity implements INetworkListener{ List<NodeEntity> eItemsList = this.worldObj.getEntitiesWithinAABB(NodeEntity.class, searchArea);
if(!eItemsList.isEmpty())
{
- Iterator ei = eItemsList.iterator();
+ Iterator<NodeEntity> ei = eItemsList.iterator();
while(ei.hasNext())
{
NodeEntity node=(NodeEntity) ei.next();
@@ -227,7 +219,7 @@ public class NodeEntity extends Entity implements INetworkListener{ List<EntityPlayer> eItemsList = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, searchArea);
if(!eItemsList.isEmpty())
{
- Iterator ei = eItemsList.iterator();
+ Iterator<EntityPlayer> ei = eItemsList.iterator();
while(ei.hasNext())
{
EntityPlayer player=(EntityPlayer) ei.next();
@@ -415,15 +407,10 @@ public class NodeEntity extends Entity implements INetworkListener{ xi=(dx1-2*x1+2*dx0+2*x0-dx0)*i*i*i+(3*x1-dx1-3*dx0-3*x0+dx0)*i*i+dx0*i+x0;
yi=(dy1-2*y1+2*dy0+2*y0-dy0)*i*i*i+(3*y1-dy1-3*dy0-3*y0+dy0)*i*i+dy0*i+y0;
zi=(dz1-2*z1+2*dz0+2*z0-dz0)*i*i*i+(3*z1-dz1-3*dz0-3*z0+dz0)*i*i+dz0*i+z0;
- int blockX=(int)xi;
- int blockY=(int)yi;
- int blockZ=(int)zi;
dxi-=xi;
dyi-=yi;
dzi-=zi;
double var7 = MathHelper.sqrt_double(dxi * dxi + dzi * dzi);
- float var9 = (float)(Math.atan2(dzi, dxi) * 180.0D / Math.PI) - 90.0F;
- float var10 = (float)(-(Math.atan2(dyi, var7) * 180.0D / Math.PI));
float rotationPitch = (float) Math.atan2(dxi, dzi);
float rotationYaw = (float) (-Math.atan2(dyi, var7));
rotationPitchArray[i1]=rotationPitch;
diff --git a/ihl/flexible_cable/NodeRender.java b/ihl/flexible_cable/NodeRender.java index 61c272b..157be67 100644 --- a/ihl/flexible_cable/NodeRender.java +++ b/ihl/flexible_cable/NodeRender.java @@ -1,19 +1,11 @@ package ihl.flexible_cable;
import ihl.IHLModInfo;
-import ihl.model.IHLModelRenderer;
import ihl.model.ModelTube;
-import ihl.utils.IHLMathUtils;
-import ihl.utils.IHLRenderUtils;
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.model.ModelBox;
-import net.minecraft.client.renderer.ActiveRenderInfo;
-import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
-import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
@@ -26,7 +18,6 @@ public class NodeRender extends Render private ModelTube modelThin;
private ResourceLocation tex;
private float scale;
- private boolean firstTick=true;
public NodeRender()
{
diff --git a/ihl/flexible_cable/PowerCableNodeEntity.java b/ihl/flexible_cable/PowerCableNodeEntity.java index 42d07fd..ed5a7ea 100644 --- a/ihl/flexible_cable/PowerCableNodeEntity.java +++ b/ihl/flexible_cable/PowerCableNodeEntity.java @@ -1,34 +1,22 @@ package ihl.flexible_cable;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import ic2.api.network.INetworkClientTileEntityEventListener;
-import ic2.core.IC2;
import ic2.core.IC2DamageSource;
import ic2.core.item.armor.ItemArmorHazmat;
import ihl.IHLMod;
import ihl.IHLModInfo;
-import ihl.interfaces.IDataCableHolder;
import ihl.interfaces.IEnergyNetNode;
import ihl.utils.IHLUtils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
-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.nbt.NBTTagList;
-import net.minecraft.network.play.server.S26PacketMapChunkBulk;
import net.minecraft.network.play.server.S29PacketSoundEffect;
import net.minecraft.network.play.server.S2APacketParticles;
-import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{
@@ -56,6 +44,8 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{ return !worldObj.isRemote && !this.noClip;
}
+ @SuppressWarnings("unchecked")
+ @Override
public void onUpdate()
{
super.onUpdate();
@@ -191,7 +181,7 @@ public class PowerCableNodeEntity extends NodeEntity implements IEnergyNetNode{ public Set<NBTTagCompound> getCableList() {
if(cableList==null)
{
- cableList=new HashSet(1);
+ cableList=new HashSet<NBTTagCompound>(1);
if(this.cable!=null)
{
cableList.add(this.cable);
diff --git a/ihl/flexible_cable/RectifierTransformerUnitTileEntity.java b/ihl/flexible_cable/RectifierTransformerUnitTileEntity.java index 1d13d0a..484df85 100644 --- a/ihl/flexible_cable/RectifierTransformerUnitTileEntity.java +++ b/ihl/flexible_cable/RectifierTransformerUnitTileEntity.java @@ -1,6 +1,5 @@ package ihl.flexible_cable;
-import java.util.Iterator;
import java.util.List;
import ic2.api.energy.event.EnergyTileLoadEvent;
@@ -8,15 +7,10 @@ import ic2.api.energy.event.EnergyTileUnloadEvent; import ic2.api.energy.tile.IEnergySink;
import ic2.api.network.INetworkClientTileEntityEventListener;
import ic2.core.IC2;
-import ic2.core.block.TileEntityBlock;
import ic2.core.block.TileEntityInventory;
-import ihl.IHLMod;
-import ihl.flexible_cable.IHLGrid;
-import ihl.flexible_cable.NodeEntity;
import ihl.interfaces.IEnergyNetNode;
import ihl.interfaces.IMultiPowerCableHolder;
import ihl.utils.IHLUtils;
-import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -280,6 +274,7 @@ public class RectifierTransformerUnitTileEntity extends TileEntityInventory impl return amount;
}
+ @Override
public boolean isCableRemoved(int chainUniqueID)
{
if(!checkCables)
diff --git a/ihl/flexible_cable/SetOfDiesMiniGUI.java b/ihl/flexible_cable/SetOfDiesMiniGUI.java index c00a19b..43f905d 100644 --- a/ihl/flexible_cable/SetOfDiesMiniGUI.java +++ b/ihl/flexible_cable/SetOfDiesMiniGUI.java @@ -1,9 +1,6 @@ package ihl.flexible_cable; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.util.regex.Pattern; - import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.GuiTextField; @@ -20,7 +17,6 @@ public class SetOfDiesMiniGUI extends ItemMiniGUI private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIIronWorkbench.png"); private int transverseSectionValue; private GuiTextField transverseSectionTextField; - private boolean leftMouseButtonPressed=false; private int xPos; private int yPos; diff --git a/ihl/flexible_cable/SubAnchorEnergyNetNode.java b/ihl/flexible_cable/SubAnchorEnergyNetNode.java index 6b84dd8..33f9fb3 100644 --- a/ihl/flexible_cable/SubAnchorEnergyNetNode.java +++ b/ihl/flexible_cable/SubAnchorEnergyNetNode.java @@ -1,13 +1,9 @@ package ihl.flexible_cable; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; @@ -16,9 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection; import ic2.api.energy.EnergyNet; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergyConductor; import ic2.api.energy.tile.IEnergySink; -import ic2.api.energy.tile.IEnergySource; import ic2.core.IC2; import ihl.IHLMod; import ihl.interfaces.IEnergyNetNode; @@ -29,7 +23,7 @@ public class SubAnchorEnergyNetNode implements IEnergyNetNode{ private AnchorTileEntity base; private short facing; private int gridID=-1; - private Set<NBTTagCompound> cableList = new HashSet(); + private Set<NBTTagCompound> cableList = new HashSet<NBTTagCompound>(); public SubAnchorEnergyNetNode(AnchorTileEntity base1, short facing1) { diff --git a/ihl/flexible_cable/SubRTUEnergyNetNode.java b/ihl/flexible_cable/SubRTUEnergyNetNode.java index 2dd0673..c068ba0 100644 --- a/ihl/flexible_cable/SubRTUEnergyNetNode.java +++ b/ihl/flexible_cable/SubRTUEnergyNetNode.java @@ -1,13 +1,9 @@ package ihl.flexible_cable; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.MinecraftForge; @@ -23,7 +19,7 @@ public class SubRTUEnergyNetNode implements IEnergyNetNode{ private RectifierTransformerUnitTileEntity base; private short side; private int gridID=-1; - private Set<NBTTagCompound> cableList = new HashSet(); + private Set<NBTTagCompound> cableList = new HashSet<NBTTagCompound>(); public SubRTUEnergyNetNode(RectifierTransformerUnitTileEntity base1, short facing1) { |
