diff options
| author | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 22:06:25 -0400 |
|---|---|---|
| committer | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 22:06:25 -0400 |
| commit | 9353aa711b1d750ff945acdfed2d3b956291b615 (patch) | |
| tree | d6ca62ab093dede52afef0d82ac29d32c56fb29b /src/main/java/gregtech/api/objects | |
| parent | 445e6c3f25714ecf15c07dcd3462375d65b6dc92 (diff) | |
| download | GT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.tar.gz GT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.tar.bz2 GT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.zip | |
Reformat code
Diffstat (limited to 'src/main/java/gregtech/api/objects')
| -rw-r--r-- | src/main/java/gregtech/api/objects/ElementStack.java | 71 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_ArrayList.java | 72 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java | 160 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_Cover_Default.java | 116 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_Cover_None.java | 161 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_Fluid.java | 36 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_FluidStack.java | 80 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_HashSet.java | 63 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_ItemStack.java | 87 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_MultiTexture.java | 88 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_RenderedTexture.java | 200 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/GT_SidedTexture.java | 224 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/ItemData.java | 222 | ||||
| -rw-r--r-- | src/main/java/gregtech/api/objects/MaterialStack.java | 71 |
14 files changed, 842 insertions, 809 deletions
diff --git a/src/main/java/gregtech/api/objects/ElementStack.java b/src/main/java/gregtech/api/objects/ElementStack.java index 38443dffaf..f3e1543614 100644 --- a/src/main/java/gregtech/api/objects/ElementStack.java +++ b/src/main/java/gregtech/api/objects/ElementStack.java @@ -3,39 +3,40 @@ package gregtech.api.objects; import gregtech.api.enums.Element; public class ElementStack implements Cloneable { - public int mAmount; - public Element mElement; - - public ElementStack(Element aElement, int aAmount) { - mElement = aElement==null?Element._NULL:aElement; - mAmount = aAmount; - } - - public ElementStack copy(int aAmount) { - return new ElementStack(mElement, aAmount); - } - - @Override - public ElementStack clone() { - return new ElementStack(mElement, mAmount); - } - - @Override - public boolean equals(Object aObject) { - if (aObject == this) return true; - if (aObject == null) return false; - if (aObject instanceof Element) return aObject == mElement; - if (aObject instanceof ElementStack) return ((ElementStack)aObject).mElement == mElement && (mAmount < 0 || ((ElementStack)aObject).mAmount < 0 || ((ElementStack)aObject).mAmount == mAmount); - return false; - } - - @Override - public String toString() { - return mElement.toString()+mAmount; - } - - @Override - public int hashCode() { - return mElement.hashCode(); - } + public int mAmount; + public Element mElement; + + public ElementStack(Element aElement, int aAmount) { + mElement = aElement == null ? Element._NULL : aElement; + mAmount = aAmount; + } + + public ElementStack copy(int aAmount) { + return new ElementStack(mElement, aAmount); + } + + @Override + public ElementStack clone() { + return new ElementStack(mElement, mAmount); + } + + @Override + public boolean equals(Object aObject) { + if (aObject == this) return true; + if (aObject == null) return false; + if (aObject instanceof Element) return aObject == mElement; + if (aObject instanceof ElementStack) + return ((ElementStack) aObject).mElement == mElement && (mAmount < 0 || ((ElementStack) aObject).mAmount < 0 || ((ElementStack) aObject).mAmount == mAmount); + return false; + } + + @Override + public String toString() { + return mElement.toString() + mAmount; + } + + @Override + public int hashCode() { + return mElement.hashCode(); + } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_ArrayList.java b/src/main/java/gregtech/api/objects/GT_ArrayList.java index a6c0750217..5bc781e281 100644 --- a/src/main/java/gregtech/api/objects/GT_ArrayList.java +++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java @@ -5,55 +5,55 @@ import java.util.Arrays; import java.util.Collection; public class GT_ArrayList<E> extends ArrayList<E> { - private static final long serialVersionUID = 1L; - - private final boolean mAllowNulls; - - public GT_ArrayList(boolean aAllowNulls, int aCapacity) { - super(aCapacity); - mAllowNulls = aAllowNulls; - } - - public GT_ArrayList(boolean aAllowNulls, E... aArray) { - super(Arrays.asList(aArray)); - mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); - } - + private static final long serialVersionUID = 1L; + + private final boolean mAllowNulls; + + public GT_ArrayList(boolean aAllowNulls, int aCapacity) { + super(aCapacity); + mAllowNulls = aAllowNulls; + } + + public GT_ArrayList(boolean aAllowNulls, E... aArray) { + super(Arrays.asList(aArray)); + mAllowNulls = aAllowNulls; + if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + } + public GT_ArrayList(boolean aAllowNulls, Collection<? extends E> aList) { - super(aList); - mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + super(aList); + mAllowNulls = aAllowNulls; + if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); } - + @Override - public E set(int aIndex, E aElement) { - if (mAllowNulls || aElement != null) return super.set(aIndex, aElement); + public E set(int aIndex, E aElement) { + if (mAllowNulls || aElement != null) return super.set(aIndex, aElement); return null; } - + @Override - public boolean add(E aElement) { - if (mAllowNulls || aElement != null) return super.add(aElement); + public boolean add(E aElement) { + if (mAllowNulls || aElement != null) return super.add(aElement); return false; } - + @Override - public void add(int aIndex, E aElement) { - if (mAllowNulls || aElement != null) super.add(aIndex, aElement); + public void add(int aIndex, E aElement) { + if (mAllowNulls || aElement != null) super.add(aIndex, aElement); } - + @Override - public boolean addAll(Collection<? extends E> aList) { + public boolean addAll(Collection<? extends E> aList) { boolean rReturn = super.addAll(aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); - return rReturn; + if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + return rReturn; } - + @Override - public boolean addAll(int aIndex, Collection<? extends E> aList) { - boolean rReturn = super.addAll(aIndex, aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); - return rReturn; + public boolean addAll(int aIndex, Collection<? extends E> aList) { + boolean rReturn = super.addAll(aIndex, aList); + if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + return rReturn; } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index ffbbe09ec6..caf46b3980 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -8,89 +8,87 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; public class GT_CopiedBlockTexture implements ITexture { - private final Block mBlock; - private final byte mSide, mMeta; - - /** - * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! - * - * Just set this variable to another different Array instead. - * Otherwise some colored things will get Problems. - */ - public short[] mRGBa; - - private final boolean mAllowAlpha; - - public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) { - if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); - mBlock = aBlock; - mRGBa = aRGBa; - mSide = (byte)aSide; - mMeta = (byte)aMeta; - mAllowAlpha = aAllowAlpha; - } - - public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa) { - this(aBlock, aSide, aMeta, aRGBa, true); - } - - public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta) { - this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa); - } - - private IIcon getIcon(int aSide) { - if (mSide == 6) return mBlock.getIcon(aSide, mMeta); - return mBlock.getIcon(mSide, mMeta); - } - - @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(5); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 0.6F), (int)(mRGBa[1] * 0.6F), (int)(mRGBa[2] * 0.6F), mAllowAlpha?255-mRGBa[3]:255); + private final Block mBlock; + private final byte mSide, mMeta; + private final boolean mAllowAlpha; + /** + * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! + * <p/> + * Just set this variable to another different Array instead. + * Otherwise some colored things will get Problems. + */ + public short[] mRGBa; + + public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); + mBlock = aBlock; + mRGBa = aRGBa; + mSide = (byte) aSide; + mMeta = (byte) aMeta; + mAllowAlpha = aAllowAlpha; + } + + public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa) { + this(aBlock, aSide, aMeta, aRGBa, true); + } + + public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta) { + this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa); + } + + private IIcon getIcon(int aSide) { + if (mSide == 6) return mBlock.getIcon(aSide, mMeta); + return mBlock.getIcon(mSide, mMeta); + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(5); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); // aRenderer.flipTexture = !aRenderer.flipTexture; - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); // aRenderer.flipTexture = !aRenderer.flipTexture; - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(4); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 0.6F), (int)(mRGBa[1] * 0.6F), (int)(mRGBa[2] * 0.6F), mAllowAlpha?255-mRGBa[3]:255); - aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(1); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 1.0F), (int)(mRGBa[1] * 1.0F), (int)(mRGBa[2] * 1.0F), mAllowAlpha?255-mRGBa[3]:255); - aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(0); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 0.5F), (int)(mRGBa[1] * 0.5F), (int)(mRGBa[2] * 0.5F), mAllowAlpha?255-mRGBa[3]:255); - aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(3); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 0.8F), (int)(mRGBa[1] * 0.8F), (int)(mRGBa[2] * 0.8F), mAllowAlpha?255-mRGBa[3]:255); - aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(2); - Tessellator.instance.setColorRGBA((int)(mRGBa[0] * 0.8F), (int)(mRGBa[1] * 0.8F), (int)(mRGBa[2] * 0.8F), mAllowAlpha?255-mRGBa[3]:255); + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(4); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(1); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(0); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(3); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(2); + Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); // aRenderer.flipTexture = !aRenderer.flipTexture; - aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); // aRenderer.flipTexture = !aRenderer.flipTexture; - } - - @Override - public boolean isValidTexture() { - return mBlock != null; - } + } + + @Override + public boolean isValidTexture() { + return mBlock != null; + } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_Cover_Default.java b/src/main/java/gregtech/api/objects/GT_Cover_Default.java index b317e0e523..bf3bc84497 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_Default.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_Default.java @@ -7,62 +7,62 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fluids.Fluid; public class GT_Cover_Default extends GT_CoverBehavior { - /** - * This is the Dummy, if there is a generic Cover without behavior - */ - public GT_Cover_Default() { - super(); - } - - @Override - public boolean isSimpleCover() { - return true; - } - - @Override - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - aCoverVariable=((aCoverVariable+1)&15); - GT_Utility.sendChatToPlayer(aPlayer, ((aCoverVariable & 1) != 0?"Redstone ":"") + ((aCoverVariable & 2) != 0?"Energy ":"") + ((aCoverVariable & 4) != 0?"Fluids ":"") + ((aCoverVariable & 8) != 0?"Items ":"")); - return aCoverVariable; - } - - @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return (aCoverVariable & 1) != 0; - } - - @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return (aCoverVariable & 1) != 0; - } - - @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return (aCoverVariable & 2) != 0; - } - - @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return (aCoverVariable & 2) != 0; - } - - @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return (aCoverVariable & 4) != 0; - } - - @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return (aCoverVariable & 4) != 0; - } - - @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return (aCoverVariable & 8) != 0; - } - - @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return (aCoverVariable & 8) != 0; - } + /** + * This is the Dummy, if there is a generic Cover without behavior + */ + public GT_Cover_Default() { + super(); + } + + @Override + public boolean isSimpleCover() { + return true; + } + + @Override + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + aCoverVariable = ((aCoverVariable + 1) & 15); + GT_Utility.sendChatToPlayer(aPlayer, ((aCoverVariable & 1) != 0 ? "Redstone " : "") + ((aCoverVariable & 2) != 0 ? "Energy " : "") + ((aCoverVariable & 4) != 0 ? "Fluids " : "") + ((aCoverVariable & 8) != 0 ? "Items " : "")); + return aCoverVariable; + } + + @Override + public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return (aCoverVariable & 1) != 0; + } + + @Override + public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return (aCoverVariable & 1) != 0; + } + + @Override + public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return (aCoverVariable & 2) != 0; + } + + @Override + public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return (aCoverVariable & 2) != 0; + } + + @Override + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return (aCoverVariable & 4) != 0; + } + + @Override + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return (aCoverVariable & 4) != 0; + } + + @Override + public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return (aCoverVariable & 8) != 0; + } + + @Override + public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return (aCoverVariable & 8) != 0; + } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_Cover_None.java b/src/main/java/gregtech/api/objects/GT_Cover_None.java index 89a0e17ded..6514571924 100644 --- a/src/main/java/gregtech/api/objects/GT_Cover_None.java +++ b/src/main/java/gregtech/api/objects/GT_Cover_None.java @@ -6,84 +6,85 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fluids.Fluid; public class GT_Cover_None extends GT_CoverBehavior { - - /** - * This is the Dummy, if there is no Cover - */ - public GT_Cover_None() {} - - @Override - public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 10.0F; - } - - @Override - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean isGUIClickable(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return true; - } - - @Override - public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - @Override - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - return false; - } - - @Override - public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { - return true; - } - - @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - return 0; - } - - @Override - public boolean isSimpleCover() { - return true; - } + + /** + * This is the Dummy, if there is no Cover + */ + public GT_Cover_None() { + } + + @Override + public float getBlastProofLevel(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 10.0F; + } + + @Override + public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean isGUIClickable(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return true; + } + + @Override + public boolean manipulatesSidedRedstoneOutput(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return false; + } + + @Override + public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { + return false; + } + + @Override + public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { + return true; + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { + return 0; + } + + @Override + public boolean isSimpleCover() { + return true; + } } diff --git a/src/main/java/gregtech/api/objects/GT_Fluid.java b/src/main/java/gregtech/api/objects/GT_Fluid.java index 8e7a71c972..119b32a22b 100644 --- a/src/main/java/gregtech/api/objects/GT_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_Fluid.java @@ -1,28 +1,28 @@ package gregtech.api.objects; -import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; import gregtech.api.GregTech_API; import net.minecraftforge.fluids.Fluid; +import static gregtech.api.enums.GT_Values.RES_PATH_BLOCK; + public class GT_Fluid extends Fluid implements Runnable { - private final short[] mRGBa; - - public final String mTextureName; - - public GT_Fluid(String aName, String aTextureName, short[] aRGBa) { - super(aName); - mRGBa = aRGBa; - mTextureName = aTextureName; - GregTech_API.sGTBlockIconload.add(this); - } - + public final String mTextureName; + private final short[] mRGBa; + + public GT_Fluid(String aName, String aTextureName, short[] aRGBa) { + super(aName); + mRGBa = aRGBa; + mTextureName = aTextureName; + GregTech_API.sGTBlockIconload.add(this); + } + @Override - public int getColor() { + public int getColor() { return (Math.max(0, Math.min(255, mRGBa[0])) << 16) | (Math.max(0, Math.min(255, mRGBa[1])) << 8) | Math.max(0, Math.min(255, mRGBa[2])); } - - @Override - public void run() { - setIcons(GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + "fluids/fluid." + mTextureName)); - } + + @Override + public void run() { + setIcons(GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + "fluids/fluid." + mTextureName)); + } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_FluidStack.java b/src/main/java/gregtech/api/objects/GT_FluidStack.java index 11571ba816..d98981cca1 100644 --- a/src/main/java/gregtech/api/objects/GT_FluidStack.java +++ b/src/main/java/gregtech/api/objects/GT_FluidStack.java @@ -3,53 +3,73 @@ package gregtech.api.objects; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.Collection; import java.util.Map; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - /** * Because Forge fucked this one up royally. */ public class GT_FluidStack extends FluidStack { - private static final Collection<GT_FluidStack> sAllFluidStacks = new ArrayList<GT_FluidStack>(5000); - private Fluid mFluid; - private static volatile boolean lock=false; - + private static final Collection<GT_FluidStack> sAllFluidStacks = new ArrayList<GT_FluidStack>(5000); + private static volatile boolean lock = false; + private Fluid mFluid; + public GT_FluidStack(Fluid aFluid, int aAmount) { - super(aFluid, aAmount); - mFluid = aFluid; - sAllFluidStacks.add(this); + super(aFluid, aAmount); + mFluid = aFluid; + sAllFluidStacks.add(this); } - + public GT_FluidStack(FluidStack aFluid) { - this(aFluid.getFluid(), aFluid.amount); + this(aFluid.getFluid(), aFluid.amount); } - + public static synchronized void fixAllThoseFuckingFluidIDs() { - if(ForgeVersion.getBuildVersion()<1355){ - while(lock){try {Thread.sleep(1);} catch (InterruptedException e) {}} - lock=true; - for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake(); - for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings) try {GT_Utility.reMap(tMap);} catch(Throwable e) {e.printStackTrace(GT_Log.err);} - lock=false;} - } - + if (ForgeVersion.getBuildVersion() < 1355) { + while (lock) { + try { + Thread.sleep(1); + } catch (InterruptedException e) { + } + } + lock = true; + for (GT_FluidStack tFluid : sAllFluidStacks) tFluid.fixFluidIDForFucksSake(); + for (Map<Fluid, ?> tMap : GregTech_API.sFluidMappings) + try { + GT_Utility.reMap(tMap); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + lock = false; + } + } + public void fixFluidIDForFucksSake() { - if(ForgeVersion.getBuildVersion()<1355){ - int fluidID; - try {fluidID = this.getFluid().getID();} catch(Throwable e){System.err.println(e);} - try {fluidID = mFluid.getID();} catch(Throwable e) {fluidID = -1;}} + if (ForgeVersion.getBuildVersion() < 1355) { + int fluidID; + try { + fluidID = this.getFluid().getID(); + } catch (Throwable e) { + System.err.println(e); + } + try { + fluidID = mFluid.getID(); + } catch (Throwable e) { + fluidID = -1; + } + } } - + @Override - public FluidStack copy() { - if(ForgeVersion.getBuildVersion()<1355){ - fixFluidIDForFucksSake();} + public FluidStack copy() { + if (ForgeVersion.getBuildVersion() < 1355) { + fixFluidIDForFucksSake(); + } return new GT_FluidStack(this); } }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/GT_HashSet.java b/src/main/java/gregtech/api/objects/GT_HashSet.java index 5a88307639..cec006905b 100644 --- a/src/main/java/gregtech/api/objects/GT_HashSet.java +++ b/src/main/java/gregtech/api/objects/GT_HashSet.java @@ -2,80 +2,81 @@ package gregtech.api.objects; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; import java.util.*; -import net.minecraft.item.ItemStack; - public class GT_HashSet<E extends GT_ItemStack> extends AbstractSet<E> { - private transient HashMap<GT_ItemStack, Object> map; private static final Object OBJECT = new Object(); - + private transient HashMap<GT_ItemStack, Object> map; + public GT_HashSet() { map = new HashMap<GT_ItemStack, Object>(); GregTech_API.sItemStackMappings.add(map); } - + public GT_HashSet(Collection<? extends E> c) { - map = new HashMap<GT_ItemStack, Object>(Math.max((int) (c.size()/.75f) + 1, 16)); + map = new HashMap<GT_ItemStack, Object>(Math.max((int) (c.size() / .75f) + 1, 16)); addAll(c); GregTech_API.sItemStackMappings.add(map); } - + public GT_HashSet(int initialCapacity, float loadFactor) { map = new HashMap<GT_ItemStack, Object>(initialCapacity, loadFactor); GregTech_API.sItemStackMappings.add(map); } - + public GT_HashSet(int initialCapacity) { map = new HashMap<GT_ItemStack, Object>(initialCapacity); GregTech_API.sItemStackMappings.add(map); } - + GT_HashSet(int initialCapacity, float loadFactor, boolean dummy) { map = new LinkedHashMap<GT_ItemStack, O |
