diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-01-20 02:07:40 +1000 |
commit | a6bb1b33da251f4a2ec7a6d6facb4864e9905341 (patch) | |
tree | 84d47440794cadd5c64598355903b123e18e0662 /src/Java/gtPlusPlus/xmod/gregtech/api/objects | |
parent | 142fe00070526484862f15f3a125400a22a2fe96 (diff) | |
download | GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.gz GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.tar.bz2 GT5-Unofficial-a6bb1b33da251f4a2ec7a6d6facb4864e9905341.zip |
+ Added a power cost of 32eu/action for the Tree Farmer. (Will eventually get a config option).
% Moved the internal power buffer variable out of the cut method into the class.
% Massive project tidy up, lots of old unused code removed or tidied up.
$ Fixed lots of String comparisons that used == instead of .equals().
$ Fixed Double/Triple/Quad null checks in certain places.
$ Fixed returns that set values at the same time.
$ Swapped 3.14 and 1.57 to Math.PI and Math.PI/2.
$ Fixed possible cases where a NPE may be thrown, by calling logging outside of null checks.
+ Added PI to CORE.java, since it's a double and MC uses it as a float in each instance.
- Stripped 95% of the useless code out of Meta_GT_Proxy.java
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/objects')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechRenderedTexture.java | 160 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java | 5 |
2 files changed, 3 insertions, 162 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechRenderedTexture.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechRenderedTexture.java deleted file mode 100644 index e22c324984..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechRenderedTexture.java +++ /dev/null @@ -1,160 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import gregtech.api.enums.Dyes; -import gregtech.api.interfaces.*; -import gtPlusPlus.core.util.Utils; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; - -public class GregtechRenderedTexture implements ITexture, IColorModulationContainer { - private final IIconContainer mIconContainer; - 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 GregtechRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { - if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); - mIconContainer = aIcon; - mAllowAlpha = aAllowAlpha; - mRGBa = aRGBa; - } - - public GregtechRenderedTexture(IIconContainer aIcon, short[] aRGBa) { - this(aIcon, aRGBa, true); - } - - public GregtechRenderedTexture(IIconContainer aIcon) { - this(aIcon, Dyes._NULL.mRGBa); - } - - @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); - aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); - aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer.getIcon(); - - double d3 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0D); - double d4 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0D); - double d5 = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - double d6 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - double d11 = aX + aRenderer.renderMinX; - double d12 = aX + aRenderer.renderMaxX; - double d13 = aY + aRenderer.renderMinY; - double d14 = aZ + aRenderer.renderMinZ; - double d15 = aZ + aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6); - Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5); - Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5); - Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6); - - if ((aIcon = mIconContainer.getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6); - Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5); - Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5); - Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6); - } - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - try { - 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, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); - aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } catch (NullPointerException e){ - Utils.LOG_WARNING("renderZPos failed."); - } - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - try { - Utils.LOG_WARNING("renderZNeg Method();."); - Utils.LOG_WARNING("Setting RGBA of instance."); - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); - aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - Utils.LOG_WARNING("Is mIconContainer null? "+mIconContainer.toString()); - Utils.LOG_WARNING("mIconContainer.getIcon.getIconName(): "+mIconContainer.getIcon().getIconName()); - Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); - Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); - if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); - aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - Utils.LOG_WARNING("Is miconContainer.getOverlayIcon null? "+mIconContainer.getOverlayIcon().toString()); - Utils.LOG_WARNING("mIconContainer.getIcon.getIconName(): "+mIconContainer.getOverlayIcon().getIconName()); - Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain()); - Utils.LOG_WARNING("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath()); - } - } catch (NullPointerException e){ - - - e.printStackTrace(); - Utils.LOG_WARNING("renderZNeg failed."+e.getMessage()+"|"+e.getClass()+"|"+e.getLocalizedMessage()); - Minecraft.getMinecraft().shutdown(); - } - } - - @Override - public short[] getRGBA() { - return mRGBa; - } - - @Override - public boolean isValidTexture() { - return mIconContainer != null; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java index c0ccffe4d9..da3df32d3a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java @@ -255,10 +255,11 @@ public class XSTR extends Random { @Override public void nextBytes(byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) - for (int rndba = nextInt(), + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) { + for (int rndba = nextInt(), nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); nba-- > 0; rndba >>= Byte.SIZE) bytes_arr[iba++] = (byte)rndba; + } } }
\ No newline at end of file |