Added documentation to updateTexture in GT_MetaTileEntity_Hatch.

Added a function to GT_Utility called addTexturePage(byte page).
Added information about who is using which texture page in GT_Block_Casings1.
Updated GT_Block_Casings5 & GT_Block_Casings8 to utilise texture page 1.
Updated Large Chemical Reactor to reflect this change, now also uses Page 1 Index 48.
Moved the Pyrolyse oven casing index from 111 to 22, which is currently unused and within the Gregtech index space.
This commit is contained in:
Alkalus 2017-10-08 19:55:35 +10:00
parent 85044d37a3
commit f70c7d4046
8 changed files with 68 additions and 17 deletions

View file

@ -1,6 +1,5 @@
package gregtech.api.metatileentity.implementations; package gregtech.api.metatileentity.implementations;
import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.ITexture;
@ -77,6 +76,14 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
mMachineBlock=actualTexture; mMachineBlock=actualTexture;
} }
/**
*
* @param textureIndex
* Index between 0-127.
* Add 128 per page, if texture index is not on first page.
*
*/
public final void updateTexture(int textureIndex){ public final void updateTexture(int textureIndex){
onValueUpdate((byte) textureIndex); onValueUpdate((byte) textureIndex);
onTexturePageUpdate((byte) (textureIndex>>7)); onTexturePageUpdate((byte) (textureIndex>>7));

View file

@ -8,9 +8,11 @@ import gregtech.api.enchants.Enchantment_Radioactivity;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList; import gregtech.api.enums.ItemList;
import gregtech.api.enums.SubTag; import gregtech.api.enums.SubTag;
import gregtech.api.enums.Textures;
import gregtech.api.events.BlockScanningEvent; import gregtech.api.events.BlockScanningEvent;
import gregtech.api.interfaces.IDebugableBlock; import gregtech.api.interfaces.IDebugableBlock;
import gregtech.api.interfaces.IProjectileItem; import gregtech.api.interfaces.IProjectileItem;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.*; import gregtech.api.interfaces.tileentity.*;
import gregtech.api.items.GT_EnergyArmor_Item; import gregtech.api.items.GT_EnergyArmor_Item;
import gregtech.api.items.GT_Generic_Item; import gregtech.api.items.GT_Generic_Item;
@ -1116,6 +1118,17 @@ public class GT_Utility {
} }
} }
/**
* Initializes a new texture page.
*/
public static boolean addTexturePage(byte page){
if(Textures.BlockIcons.casingTexturePages[page]==null){
Textures.BlockIcons.casingTexturePages[page]=new ITexture[128];
return true;
}
return false;
}
/** /**
* Converts a Number to a String * Converts a Number to a String
*/ */

View file

@ -11,12 +11,27 @@ import net.minecraft.world.IBlockAccess;
public class GT_Block_Casings1 public class GT_Block_Casings1
extends GT_Block_Casings_Abstract { extends GT_Block_Casings_Abstract {
/**
* Texture Index Information
* Textures.BlockIcons.casingTexturePages[0][0-63] - Gregtech
* Textures.BlockIcons.casingTexturePages[0][64-127] - GT++
* Textures.BlockIcons.casingTexturePages[1][0-127] - Gregtech
* Textures.BlockIcons.casingTexturePages[2][0-127] - Free
* Textures.BlockIcons.casingTexturePages[3][0-127] - Free
* Textures.BlockIcons.casingTexturePages[4][0-127] - Free
* Textures.BlockIcons.casingTexturePages[5][0-127] - Free
* Textures.BlockIcons.casingTexturePages[6][0-127] - Free
* Textures.BlockIcons.casingTexturePages[7][0-127] - Free
* Textures.BlockIcons.casingTexturePages[8][0-127] - TecTech
*/
public GT_Block_Casings1() { public GT_Block_Casings1() {
super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE); super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) { for (byte i = 0; i < 16; i = (byte) (i + 1)) {
Textures.BlockIcons.CASING_BLOCKS[i] = new GT_CopiedBlockTexture(this, 6, i); Textures.BlockIcons.CASING_BLOCKS[i] = new GT_CopiedBlockTexture(this, 6, i);
} }
Textures.BlockIcons.CASING_BLOCKS[111] = new GT_CopiedBlockTexture(this, 6, 0,Dyes.MACHINE_METAL.mRGBa);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "ULV Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "ULV Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "LV Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "LV Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "MV Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "MV Machine Casing");

View file

@ -1,9 +1,11 @@
package gregtech.common.blocks; package gregtech.common.blocks;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.ItemList; import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_LanguageManager;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -15,8 +17,11 @@ public class GT_Block_Casings2
public GT_Block_Casings2() { public GT_Block_Casings2() {
super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE); super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) { for (byte i = 0; i < 16; i = (byte) (i + 1)) {
Textures.BlockIcons.CASING_BLOCKS[(i + 16)] = new GT_CopiedBlockTexture(this, 6, i); if (i != 6){
} Textures.BlockIcons.CASING_BLOCKS[(i + 16)] = new GT_CopiedBlockTexture(this, 6, i);
}
}
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Solid Steel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Solid Steel Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Frost Proof Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Frost Proof Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Bronze Gear Box Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Bronze Gear Box Casing");
@ -49,6 +54,9 @@ public class GT_Block_Casings2
ItemList.Casing_Pipe_Steel.set(new ItemStack(this, 1, 13)); ItemList.Casing_Pipe_Steel.set(new ItemStack(this, 1, 13));
ItemList.Casing_Pipe_Titanium.set(new ItemStack(this, 1, 14)); ItemList.Casing_Pipe_Titanium.set(new ItemStack(this, 1, 14));
ItemList.Casing_Pipe_TungstenSteel.set(new ItemStack(this, 1, 15)); ItemList.Casing_Pipe_TungstenSteel.set(new ItemStack(this, 1, 15));
//Special handler for Pyrolyse Oven Casing
Textures.BlockIcons.CASING_BLOCKS[22] = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0,Dyes.MACHINE_METAL.mRGBa);
} }
public IIcon getIcon(int aSide, int aMeta) { public IIcon getIcon(int aSide, int aMeta) {

View file

@ -6,6 +6,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
@ -13,8 +14,9 @@ public class GT_Block_Casings5
extends GT_Block_Casings_Abstract { extends GT_Block_Casings_Abstract {
public GT_Block_Casings5() { public GT_Block_Casings5() {
super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE); super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE);
GT_Utility.addTexturePage((byte) 1);
for (byte i = 0; i < 16; i = (byte) (i + 1)) { for (byte i = 0; i < 16; i = (byte) (i + 1)) {
Textures.BlockIcons.CASING_BLOCKS[(i + 64)] = new GT_CopiedBlockTexture(this, 6, i); Textures.BlockIcons.casingTexturePages[1][i] = new GT_CopiedBlockTexture(this, 6, i);
} }
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Cupronickel Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Cupronickel Coil Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Kanthal Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Kanthal Coil Block");

View file

@ -13,8 +13,8 @@ public class GT_Block_Casings8
extends GT_Block_Casings_Abstract { extends GT_Block_Casings_Abstract {
public GT_Block_Casings8() { public GT_Block_Casings8() {
super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE);
for (int i = 0; i < 16; i = (i + 1)) { for (int i = 0; i < 1; i = (i + 1)) {
Textures.BlockIcons.CASING_BLOCKS[(i + 112)] = new GT_CopiedBlockTexture(this, 6, i); Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i);
} }
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");

View file

@ -20,7 +20,7 @@ import java.util.ArrayList;
public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase {
private static final int CASING_INDEX = 112; private final int CASING_INDEX = 176;
public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional); super(aID, aName, aNameRegional);
@ -58,11 +58,11 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
boolean aRedstone) { boolean aRedstone) {
if (aSide == aFacing) { if (aSide == aFacing) {
return new ITexture[] { return new ITexture[] {
Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], Textures.BlockIcons.casingTexturePages[1][48],
new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE
: Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) }; : Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) };
} }
return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX] }; return new ITexture[] { Textures.BlockIcons.casingTexturePages[1][48] };
} }
@Override @Override

View file

@ -1,15 +1,19 @@
package gregtech.common.tileentities.machines.multi; package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -20,6 +24,9 @@ import java.util.ArrayList;
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase { public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
private int coilMetaID; private int coilMetaID;
public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0,Dyes.MACHINE_METAL.mRGBa);
//private final int CASING_INDEX = 22;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) { public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional); super(aID, aName, aNameRegional);
@ -49,10 +56,9 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) { if (aSide == aFacing) {
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[111], return new ITexture[]{mTextureULV, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
} }
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[111]}; return new ITexture[]{mTextureULV};
} }
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@ -127,7 +133,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
} }
} }
} else if (h == 3) {// innen decke (ulv casings + input + muffler) } else if (h == 3) {// innen decke (ulv casings + input + muffler)
if ((!addInputToMachineList(tTileEntity, 111)) && (!addMufflerToMachineList(tTileEntity, 111))) { if ((!addInputToMachineList(tTileEntity, 22)) && (!addMufflerToMachineList(tTileEntity, 22))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) {
return false; return false;
} }
@ -142,7 +148,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
} }
} else {// Aeusserer 5x5 ohne hoehe } else {// Aeusserer 5x5 ohne hoehe
if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings) if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings)
if ((!addMaintenanceToMachineList(tTileEntity, 111)) && (!addOutputToMachineList(tTileEntity, 111)) && (!addEnergyInputToMachineList(tTileEntity, 111))) { if ((!addMaintenanceToMachineList(tTileEntity, 22)) && (!addOutputToMachineList(tTileEntity, 22)) && (!addEnergyInputToMachineList(tTileEntity, 22))) {
if ((xDir + i != 0) || (zDir + j != 0)) {//no controller if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) {
return false; return false;