Texture overhaul,

allows for more textures to be added for casing, with extra byte of data for paging.

Just change the value of mTexturePage at the same time you change mMachineBlock.
This commit is contained in:
Technus 2017-07-28 12:56:47 +02:00
parent 60fcf643c9
commit c54ba03b4b
9 changed files with 109 additions and 13 deletions

View file

@ -9,6 +9,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IEnergyConnected;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*; import gregtech.api.util.*;
@ -58,7 +59,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15};
private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false, mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false; private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false, mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false;
private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oTexturePage=0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0;
private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0;
private short mID = 0; private short mID = 0;
private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE;
@ -513,7 +514,15 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (aSideServer) { if (aSideServer) {
if (mTickTimer % 10 == 0) { if (mTickTimer % 10 == 0) {
if (mSendClientData) { if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); NW.sendPacketToAllPlayersInRange(worldObj,
new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID,
mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5],
oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)),
oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0,
oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0,
oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)),
oColor = mColor),
xCoord, zCoord);
mSendClientData = false; mSendClientData = false;
} }
} }
@ -521,8 +530,13 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (mTickTimer > 10) { if (mTickTimer > 10) {
byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
tData = mMetaTileEntity.getUpdateData(); tData = mMetaTileEntity.getUpdateData();
if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
if(mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) {
tData = ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage();
if (tData != oTexturePage) sendBlockEvent((byte) 1, (byte)((oTexturePage = tData)|0x80));//set last bit as a flag for page
}
if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
@ -571,6 +585,30 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return null; return null;
} }
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aTexturePage, byte aUpdateData, byte aRedstoneData, byte aColorData) {
issueTextureUpdate();
if (mID != aID && aID > 0) {
mID = aID;
createNewMetatileEntity(mID);
}
mCoverSides[0] = aCover0;
mCoverSides[1] = aCover1;
mCoverSides[2] = aCover2;
mCoverSides[3] = aCover3;
mCoverSides[4] = aCover4;
mCoverSides[5] = aCover5;
for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
receiveClientEvent(0, aTextureData);
receiveClientEvent(1, aUpdateData & 0x7F);
receiveClientEvent(1, aTexturePage | 0x80);
receiveClientEvent(2, aColorData);
receiveClientEvent(3, aRedstoneData);
}
@Deprecated
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
issueTextureUpdate(); issueTextureUpdate();
if (mID != aID && aID > 0) { if (mID != aID && aID > 0) {
@ -588,7 +626,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
receiveClientEvent(0, aTextureData); receiveClientEvent(0, aTextureData);
receiveClientEvent(1, aUpdateData); receiveClientEvent(1, aUpdateData & 0x7F);
receiveClientEvent(1, 0x80);
receiveClientEvent(2, aColorData); receiveClientEvent(2, aColorData);
receiveClientEvent(3, aRedstoneData); receiveClientEvent(3, aRedstoneData);
} }
@ -616,7 +655,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
//mLockUpgrade = ((aValue&32) != 0); //mLockUpgrade = ((aValue&32) != 0);
break; break;
case 1: case 1:
if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue); if (hasValidMetaTileEntity()) {
if ((aValue & 0x80) == 0) //Is texture index
mMetaTileEntity.onValueUpdate((byte) (aValue & 0x7F));
else if (mMetaTileEntity instanceof GT_MetaTileEntity_Hatch)//is texture page and hatch
((GT_MetaTileEntity_Hatch) mMetaTileEntity).onTexturePageUpdate((byte) (aValue & 0x7F));
}
break; break;
case 2: case 2:
if (aValue > 16 || aValue < 0) aValue = 0; if (aValue > 16 || aValue < 0) aValue = 0;

View file

@ -6,8 +6,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTank { public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTank {
public byte mMachineBlock = 0; public byte mMachineBlock = 0;
public byte mTexturePage = 0;
public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { public GT_MetaTileEntity_Hatch(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
@ -36,29 +36,40 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
@Override @Override
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) {
return aSide != aFacing ? mMachineBlock > 0 ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} : mMachineBlock > 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); int textureIndex=mMachineBlock|(mTexturePage<<7);//Shift seven since one page is 128 textures!
return aSide != aFacing ? (textureIndex > 0) ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[textureIndex]} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} : textureIndex > 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[textureIndex]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[textureIndex]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
} }
@Override @Override
public void saveNBTData(NBTTagCompound aNBT) { public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT); super.saveNBTData(aNBT);
aNBT.setByte("mMachineBlock", mMachineBlock); aNBT.setByte("mMachineBlock", mMachineBlock);
aNBT.setByte("mTexturePage", mTexturePage);
} }
@Override @Override
public void loadNBTData(NBTTagCompound aNBT) { public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT); super.loadNBTData(aNBT);
mMachineBlock = aNBT.getByte("mMachineBlock"); mMachineBlock = aNBT.getByte("mMachineBlock");
mTexturePage = aNBT.getByte("mTexturePage");
} }
@Override @Override
public final void onValueUpdate(byte aValue) { public final void onValueUpdate(byte aValue) {
mMachineBlock = (byte) (aValue & 127); mMachineBlock = (byte)(aValue & 0x7F);
} }
@Override @Override
public final byte getUpdateData() { public final byte getUpdateData() {
return (byte) (mMachineBlock & 127); return (byte)(mMachineBlock & 0x7F);
}
public final void onTexturePageUpdate(byte aValue) {
mTexturePage = (byte)(aValue & 0x7F);
}
public final byte getTexturePage() {
return (byte)(mTexturePage & 0x7F);
} }
@Override @Override

View file

@ -709,8 +709,10 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aTileEntity == null) return false; if (aTileEntity == null) return false;
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
}
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)
return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus)
@ -736,6 +738,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
} }
return false; return false;
@ -749,6 +752,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity);
} }
return false; return false;
@ -760,6 +764,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity);
} }
return false; return false;
@ -771,6 +776,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity);
} }
return false; return false;
@ -782,11 +788,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap();
return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
} }
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap();
return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity);
} }
@ -799,10 +807,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
} }
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity);
} }
return false; return false;

View file

@ -11,12 +11,33 @@ import net.minecraft.world.IBlockAccess;
public class GT_Packet_TileEntity extends GT_Packet { public class GT_Packet_TileEntity extends GT_Packet {
private int mX, mZ, mC0, mC1, mC2, mC3, mC4, mC5; private int mX, mZ, mC0, mC1, mC2, mC3, mC4, mC5;
private short mY, mID; private short mY, mID;
private byte mTexture, mUpdate, mRedstone, mColor; private byte mTexture, mTexturePage, mUpdate, mRedstone, mColor;
public GT_Packet_TileEntity() { public GT_Packet_TileEntity() {
super(true); super(true);
} }
//For tiles
public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aTexturePage, byte aUpdate, byte aRedstone, byte aColor) {
super(false);
mX = aX;
mY = aY;
mZ = aZ;
mC0 = aC0;
mC1 = aC1;
mC2 = aC2;
mC3 = aC3;
mC4 = aC4;
mC5 = aC5;
mID = aID;
mTexture = aTexture;
mTexturePage=aTexturePage;
mUpdate = aUpdate;
mRedstone = aRedstone;
mColor = aColor;
}
//For pipes
public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aUpdate, byte aRedstone, byte aColor) { public GT_Packet_TileEntity(int aX, short aY, int aZ, short aID, int aC0, int aC1, int aC2, int aC3, int aC4, int aC5, byte aTexture, byte aUpdate, byte aRedstone, byte aColor) {
super(false); super(false);
mX = aX; mX = aX;
@ -30,6 +51,7 @@ public class GT_Packet_TileEntity extends GT_Packet {
mC5 = aC5; mC5 = aC5;
mID = aID; mID = aID;
mTexture = aTexture; mTexture = aTexture;
mTexturePage=0;
mUpdate = aUpdate; mUpdate = aUpdate;
mRedstone = aRedstone; mRedstone = aRedstone;
mColor = aColor; mColor = aColor;
@ -37,7 +59,7 @@ public class GT_Packet_TileEntity extends GT_Packet {
@Override @Override
public byte[] encode() { public byte[] encode() {
ByteArrayDataOutput tOut = ByteStreams.newDataOutput(40); ByteArrayDataOutput tOut = ByteStreams.newDataOutput(41);
tOut.writeInt(mX); tOut.writeInt(mX);
tOut.writeShort(mY); tOut.writeShort(mY);
@ -52,6 +74,7 @@ public class GT_Packet_TileEntity extends GT_Packet {
tOut.writeInt(mC5); tOut.writeInt(mC5);
tOut.writeByte(mTexture); tOut.writeByte(mTexture);
tOut.writeByte(mTexturePage);
tOut.writeByte(mUpdate); tOut.writeByte(mUpdate);
tOut.writeByte(mRedstone); tOut.writeByte(mRedstone);
tOut.writeByte(mColor); tOut.writeByte(mColor);
@ -61,7 +84,7 @@ public class GT_Packet_TileEntity extends GT_Packet {
@Override @Override
public GT_Packet decode(ByteArrayDataInput aData) { public GT_Packet decode(ByteArrayDataInput aData) {
return new GT_Packet_TileEntity(aData.readInt(), aData.readShort(), aData.readInt(), aData.readShort(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte()); return new GT_Packet_TileEntity(aData.readInt(), aData.readShort(), aData.readInt(), aData.readShort(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readInt(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte(), aData.readByte());
} }
@Override @Override
@ -70,7 +93,7 @@ public class GT_Packet_TileEntity extends GT_Packet {
TileEntity tTileEntity = aWorld.getTileEntity(mX, mY, mZ); TileEntity tTileEntity = aWorld.getTileEntity(mX, mY, mZ);
if (tTileEntity != null) { if (tTileEntity != null) {
if (tTileEntity instanceof BaseMetaTileEntity) if (tTileEntity instanceof BaseMetaTileEntity)
((BaseMetaTileEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); ((BaseMetaTileEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mTexturePage, mUpdate, mRedstone, mColor);
else if (tTileEntity instanceof BaseMetaPipeEntity) else if (tTileEntity instanceof BaseMetaPipeEntity)
((BaseMetaPipeEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor); ((BaseMetaPipeEntity) tTileEntity).receiveMetaTileEntityData(mID, mC0, mC1, mC2, mC3, mC4, mC5, mTexture, mUpdate, mRedstone, mColor);
} }

View file

@ -354,6 +354,7 @@ public class GT_MetaTileEntity_AssemblyLine
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
} }
return false; return false;

View file

@ -155,6 +155,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity()); this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity());
((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex();
((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mTexturePage = (byte) 0;
} else { } else {
return false; return false;
} }

View file

@ -280,16 +280,19 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
if (this.mEnergyHatches != null) { if (this.mEnergyHatches != null) {
for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) { for (GT_MetaTileEntity_Hatch_Energy hatch : this.mEnergyHatches) {
hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; hatch.mMachineBlock = status ? (byte) 52 : (byte) 53;
hatch.mTexturePage=0;
} }
} }
if (this.mOutputHatches != null) { if (this.mOutputHatches != null) {
for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) {
hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; hatch.mMachineBlock = status ? (byte) 52 : (byte) 53;
hatch.mTexturePage=0;
} }
} }
if (this.mInputHatches != null) { if (this.mInputHatches != null) {
for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) {
hatch.mMachineBlock = status ? (byte) 52 : (byte) 53; hatch.mMachineBlock = status ? (byte) 52 : (byte) 53;
hatch.mTexturePage=0;
} }
} }
return true; return true;

View file

@ -225,6 +225,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
mOutputColdFluidHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity; mOutputColdFluidHatch = (GT_MetaTileEntity_Hatch_Output) aMetaTileEntity;
return true; return true;
} }
@ -237,6 +238,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
if (aMetaTileEntity == null) return false; if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mTexturePage = (byte) 0;
((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap();
mInputHotFluidHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity; mInputHotFluidHatch = (GT_MetaTileEntity_Hatch_Input) aMetaTileEntity;
return true; return true;

View file

@ -91,6 +91,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity()); this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity());
((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex();
((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mTexturePage = (byte) 0;
} else { } else {
return false; return false;
} }