aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r--src/main/java/gregtech/api/interfaces/IBlockContainer.java8
-rw-r--r--src/main/java/gregtech/api/interfaces/ITexture.java32
-rw-r--r--src/main/java/gregtech/api/interfaces/ITextureBuilder.java72
3 files changed, 112 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IBlockContainer.java b/src/main/java/gregtech/api/interfaces/IBlockContainer.java
new file mode 100644
index 0000000000..7949ae90ce
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/IBlockContainer.java
@@ -0,0 +1,8 @@
+package gregtech.api.interfaces;
+
+import net.minecraft.block.Block;
+
+public interface IBlockContainer {
+ Block getBlock();
+ byte getMeta();
+}
diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java
index 4321cc523c..4c0b1984ca 100644
--- a/src/main/java/gregtech/api/interfaces/ITexture.java
+++ b/src/main/java/gregtech/api/interfaces/ITexture.java
@@ -2,6 +2,7 @@ package gregtech.api.interfaces;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
public interface ITexture {
void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);
@@ -17,4 +18,35 @@ public interface ITexture {
void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ);
boolean isValidTexture();
+
+ /**
+ * @return {@code true} if this texture is from the old package
+ */
+ default boolean isOldTexture() {
+ return getClass().toString().startsWith("gregtech.api.objects");
+ }
+
+ /**
+ * Will initialize the {@link Tessellator} if rendering off-world (Inventory)
+ * @param aRenderer The {@link RenderBlocks} Renderer
+ * @param aNormalX The X Normal for current Quad Face
+ * @param aNormalY The Y Normal for current Quad Face
+ * @param aNormalZ The Z Normal for current Quad Face
+ */
+ default void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) {
+ if (aRenderer.useInventoryTint) {
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setNormal(aNormalX, aNormalY, aNormalZ);
+ }
+ }
+
+ /**
+ * Will run the {@link Tessellator} to draw Quads if rendering off-world (Inventory)
+ * @param aRenderer The {@link RenderBlocks} Renderer
+ */
+ default void draw(RenderBlocks aRenderer) {
+ if (aRenderer.useInventoryTint) {
+ Tessellator.instance.draw();
+ }
+ }
}
diff --git a/src/main/java/gregtech/api/interfaces/ITextureBuilder.java b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java
new file mode 100644
index 0000000000..8a4d715ccb
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java
@@ -0,0 +1,72 @@
+package gregtech.api.interfaces;
+
+import gregtech.api.render.TextureFactory;
+import net.minecraft.block.Block;
+import net.minecraftforge.common.util.ForgeDirection;
+
+/**
+ * <p>This Interface defines operations to configure and build instances of the {@link ITexture} implementations</p>
+ * <p>Use the {@link TextureFactory#builder()} method to get an instance of the {@link ITextureBuilder} implementation.</p>
+ */
+public interface ITextureBuilder {
+ /**
+ * Build the {@link ITexture}
+ *
+ * @return The built {@link ITexture}
+ */
+ ITexture build();
+
+ /**
+ * @param block The {@link Block}
+ * @param meta The meta value for the Block
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder setFromBlock(final Block block, final int meta);
+
+ /**
+ * @param side <p>The {@link ForgeDirection} side providing the texture</p>
+ * <p>Default is {@link ForgeDirection#UNKNOWN} to use same side as rendered</p>
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder setFromSide(final ForgeDirection side);
+
+ /**
+ * @param iconContainers The {@link IIconContainer}s to add
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder addIcon(final IIconContainer... iconContainers);
+
+ /**
+ * @param rgba The RGBA tint for this {@link ITexture}
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder setRGBA(final short[] rgba);
+
+ /**
+ * @param iTextures The {@link ITexture} layers to add
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder addLayer(final ITexture... iTextures);
+
+ /**
+ * Set alpha blending
+ * @param allowAlpha to set
+ *
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder setAllowAlpha(final boolean allowAlpha);
+
+ /**
+ * Texture will render with same orientation as with vanilla blocks
+ *
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder stdOrient();
+
+ /**
+ * Texture always render with full brightness to glow in the dark
+ *
+ * @return {@link ITextureBuilder} for chaining
+ */
+ ITextureBuilder glow();
+}