aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/miscutil/gregtech/api')
-rw-r--r--src/Java/miscutil/gregtech/api/enums/GregtechTextures.java144
-rw-r--r--src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java2
-rw-r--r--src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java2
-rw-r--r--src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java2
-rw-r--r--src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java162
5 files changed, 240 insertions, 72 deletions
diff --git a/src/Java/miscutil/gregtech/api/enums/GregtechTextures.java b/src/Java/miscutil/gregtech/api/enums/GregtechTextures.java
index 9986add4fd..2db6f14599 100644
--- a/src/Java/miscutil/gregtech/api/enums/GregtechTextures.java
+++ b/src/Java/miscutil/gregtech/api/enums/GregtechTextures.java
@@ -1,6 +1,5 @@
package miscutil.gregtech.api.enums;
-import gregtech.api.GregTech_API;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import miscutil.core.lib.CORE;
@@ -9,71 +8,48 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class GregtechTextures {
- public enum BlockIcons implements IIconContainer, Runnable {
-
-
- LARGECENTRIFUGE1, LARGECENTRIFUGE2, LARGECENTRIFUGE3, LARGECENTRIFUGE4, LARGECENTRIFUGE5,
- LARGECENTRIFUGE6, LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9,
- LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, LARGECENTRIFUGE_ACTIVE3, LARGECENTRIFUGE_ACTIVE4,
- LARGECENTRIFUGE_ACTIVE5, LARGECENTRIFUGE_ACTIVE6, LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, LARGECENTRIFUGE_ACTIVE9;
-
- public static final IIconContainer[]
-
- CENTRIFUGE = new IIconContainer[]{
- LARGECENTRIFUGE1,
- LARGECENTRIFUGE2,
- LARGECENTRIFUGE3,
- LARGECENTRIFUGE4,
- LARGECENTRIFUGE5,
- LARGECENTRIFUGE6,
- LARGECENTRIFUGE7,
- LARGECENTRIFUGE8,
- LARGECENTRIFUGE9
- },
- CENTRIFUGE_ACTIVE = new IIconContainer[]{
- LARGECENTRIFUGE_ACTIVE1,
- LARGECENTRIFUGE_ACTIVE2,
- LARGECENTRIFUGE_ACTIVE3,
- LARGECENTRIFUGE_ACTIVE4,
- LARGECENTRIFUGE_ACTIVE5,
- LARGECENTRIFUGE_ACTIVE6,
- LARGECENTRIFUGE_ACTIVE7,
- LARGECENTRIFUGE_ACTIVE8,
- LARGECENTRIFUGE_ACTIVE9
- };
-
- public static ITexture[]
- GT_CASING_BLOCKS = new ITexture[64];
-
- protected IIcon mIcon;
-
- @Override
- public IIcon getIcon() {
- return mIcon;
- }
-
- @Override
- public IIcon getOverlayIcon() {
- return null;
- }
-
- @Override
- public void run() {
- mIcon = GregTech_API.sBlockIcons.registerIcon(CORE.RES_PATH_BLOCK + "iconsets/" + this);
- }
-
- @Override
- public ResourceLocation getTextureFile() {
- return TextureMap.locationBlocksTexture;
- }
-
- public static class CustomIcon implements IIconContainer, Runnable {
- protected IIcon mIcon;
- protected String mIconName;
-
- public CustomIcon(String aIconName) {
- mIconName = aIconName;
- GregTech_API.sGTBlockIconload.add(this);
+ public enum BlockIcons implements IIconContainer, Runnable {
+
+
+ LARGECENTRIFUGE1, LARGECENTRIFUGE2, LARGECENTRIFUGE3,
+ LARGECENTRIFUGE4, LARGECENTRIFUGE5, LARGECENTRIFUGE6,
+ LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9,
+ LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, LARGECENTRIFUGE_ACTIVE3,
+ LARGECENTRIFUGE_ACTIVE4, LARGECENTRIFUGE_ACTIVE5, LARGECENTRIFUGE_ACTIVE6,
+ LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, LARGECENTRIFUGE_ACTIVE9;
+
+ public static final IIconContainer[]
+
+ CENTRIFUGE = new IIconContainer[]{
+ LARGECENTRIFUGE1,
+ LARGECENTRIFUGE2,
+ LARGECENTRIFUGE3,
+ LARGECENTRIFUGE4,
+ LARGECENTRIFUGE5,
+ LARGECENTRIFUGE6,
+ LARGECENTRIFUGE7,
+ LARGECENTRIFUGE8,
+ LARGECENTRIFUGE9
+ },
+ CENTRIFUGE_ACTIVE = new IIconContainer[]{
+ LARGECENTRIFUGE_ACTIVE1,
+ LARGECENTRIFUGE_ACTIVE2,
+ LARGECENTRIFUGE_ACTIVE3,
+ LARGECENTRIFUGE_ACTIVE4,
+ LARGECENTRIFUGE_ACTIVE5,
+ LARGECENTRIFUGE_ACTIVE6,
+ LARGECENTRIFUGE_ACTIVE7,
+ LARGECENTRIFUGE_ACTIVE8,
+ LARGECENTRIFUGE_ACTIVE9
+ };
+
+ public static ITexture[]
+ GT_CASING_BLOCKS = new ITexture[64];
+
+ protected IIcon mIcon;
+
+ private BlockIcons() {
+ CORE.GT_BlockIconload.add(this);
}
@Override
@@ -88,13 +64,43 @@ public class GregtechTextures {
@Override
public void run() {
- mIcon = GregTech_API.sBlockIcons.registerIcon(CORE.RES_PATH_BLOCK + mIconName);
+ mIcon = CORE.GT_BlockIcons.registerIcon(CORE.RES_PATH_BLOCK + "iconsets/" + this);
}
@Override
public ResourceLocation getTextureFile() {
return TextureMap.locationBlocksTexture;
}
- }
-}}
+
+ public static class CustomIcon implements IIconContainer, Runnable {
+ protected IIcon mIcon;
+ protected String mIconName;
+
+ public CustomIcon(String aIconName) {
+ mIconName = aIconName;
+ CORE.GT_BlockIconload.add(this);
+ }
+
+ @Override
+ public IIcon getIcon() {
+ return mIcon;
+ }
+
+ @Override
+ public IIcon getOverlayIcon() {
+ return null;
+ }
+
+ @Override
+ public void run() {
+ mIcon = CORE.GT_BlockIcons.registerIcon(CORE.RES_PATH_BLOCK + mIconName);
+ }
+
+ @Override
+ public ResourceLocation getTextureFile() {
+ return TextureMap.locationBlocksTexture;
+ }
+ }
+ }
+}
diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java b/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java
index 6f8c42cbaa..92ed9bd702 100644
--- a/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java
+++ b/src/Java/miscutil/gregtech/api/gui/GUI_IronBlastFurnace.java
@@ -8,7 +8,7 @@ import net.minecraft.entity.player.InventoryPlayer;
public class GUI_IronBlastFurnace
extends GT_GUIContainerMetaTile_Machine {
public GUI_IronBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), CORE.MODID+":textures/gui/IronBlastFurnace.png");
+ super(new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI+"IronBlastFurnace.png");
}
@Override
diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java b/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java
index 165e4cb6ea..65ef072281 100644
--- a/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java
+++ b/src/Java/miscutil/gregtech/api/gui/GUI_SafeBlock.java
@@ -8,7 +8,7 @@ import net.minecraft.entity.player.InventoryPlayer;
public class GUI_SafeBlock
extends GT_GUIContainerMetaTile_Machine {
public GUI_SafeBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.MODID + ":" + "textures/gui/" + "SafeBlock.png");
+ super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "SafeBlock.png");
}
//String UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID.toString();
diff --git a/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java b/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java
index 1c125e86fd..6a6e01c243 100644
--- a/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java
+++ b/src/Java/miscutil/gregtech/api/gui/GUI_SteamCondenser.java
@@ -11,7 +11,7 @@ public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine
public GUI_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity)
{
- super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), CORE.MODID + ":" + "textures/gui/" + aTextureName);
+ super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), CORE.RES_PATH_GUI + aTextureName);
}
@Override
diff --git a/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java b/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java
new file mode 100644
index 0000000000..88ef8f5fff
--- /dev/null
+++ b/src/Java/miscutil/gregtech/api/objects/GregtechRenderedTexture.java
@@ -0,0 +1,162 @@
+package miscutil.gregtech.api.objects;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.interfaces.IColorModulationContainer;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.interfaces.ITexture;
+import miscutil.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_INFO("renderZPos failed.");
+ }
+ }
+
+ @Override
+ public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
+ try {
+ Utils.LOG_INFO("renderZNeg Method();.");
+ Utils.LOG_INFO("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_INFO("Is mIconContainer null? "+mIconContainer.toString());
+ Utils.LOG_INFO("mIconContainer.getIcon.getIconName(): "+mIconContainer.getIcon().getIconName());
+ Utils.LOG_INFO("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain());
+ Utils.LOG_INFO("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_INFO("Is miconContainer.getOverlayIcon null? "+mIconContainer.getOverlayIcon().toString());
+ Utils.LOG_INFO("mIconContainer.getIcon.getIconName(): "+mIconContainer.getOverlayIcon().getIconName());
+ Utils.LOG_INFO("mIconContainer.getTextureFile().getResourceDomain()"+mIconContainer.getTextureFile().getResourceDomain());
+ Utils.LOG_INFO("mIconContainer.getTextureFile().getResourcePath()"+mIconContainer.getTextureFile().getResourcePath());
+ }
+ } catch (NullPointerException e){
+
+
+ e.printStackTrace();
+ Utils.LOG_INFO("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