diff options
| author | Jason Mitchell <mitchej@gmail.com> | 2023-05-01 02:45:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-01 11:45:56 +0200 |
| commit | b2c8cfb4ec8b82337a95f51364277964ec968b52 (patch) | |
| tree | d4cf94acc93249cd649b33ec13c5b0d75f1f75db /src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines | |
| parent | d2eda84e457d549ad9a51f40e9dd159147a141f8 (diff) | |
| download | GT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.tar.gz GT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.tar.bz2 GT5-Unofficial-b2c8cfb4ec8b82337a95f51364277964ec968b52.zip | |
ForgeDirection (#608)
* ForgeDirection WIP
* Fix GTPP_Render_MachineBlock
Fix handling of getTexture with facing mask for pipes
Kill a bunch of magic numbers
* spotlessApply (#612)
Co-authored-by: GitHub GTNH Actions <>
* Bump bw/tt deps
---------
Co-authored-by: Léa Gris <lea.gris@noiraude.net>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines')
71 files changed, 539 insertions, 417 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java index 1b12b6cb41..9dc531edd9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java @@ -11,6 +11,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; import com.gtnewhorizons.modularui.api.screen.ModularWindow; @@ -87,7 +88,7 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @@ -485,12 +486,14 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { return aStack != null && aIndex >= SLOT_OUTPUT_START && aIndex < this.getSizeInventory(); } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { if (aStack != null) { if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) { return aIndex >= SLOT_FERT_1 && aIndex <= SLOT_FERT_4; @@ -515,7 +518,7 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + public boolean allowCoverOnSide(ForgeDirection side, GT_ItemStack aStack) { return true; } @@ -550,16 +553,16 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == 0 || aSide == 1) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, + final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { + if (side == ForgeDirection.DOWN || side == ForgeDirection.UP) { return this.mTextures[3][aColorIndex + 1]; } else { return this.mTextures[4][aColorIndex + 1]; } /* - * return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == - * GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + * return this.mTextures[(aActive ? 5 : 0) + (side == facing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) + * ? 1 : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex + 1]; */ } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java index 9c7ab14e89..9a26ea57ec 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_WorldAccelerator.java @@ -92,22 +92,26 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered } @Override - public ITexture[] getTexture(IGregTechTileEntity pBaseMetaTileEntity, byte pSide, byte pFacing, byte pColorIndex, - boolean pActive, boolean pRedstone) { - if (mMode == 0) return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1], (pSide < 2) + public ITexture[] getTexture(IGregTechTileEntity pBaseMetaTileEntity, ForgeDirection side, ForgeDirection sacing, + int pColorIndex, boolean pActive, boolean pRedstone) { + if (mMode == 0) return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1], + (side.offsetY != 0) ? null + : pActive ? new GT_RenderedTexture(_mGTIco_Norm_Active) + : new GT_RenderedTexture(_mGTIco_Norm_Idle) }; + else return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1], (side.offsetY != 0) ? null - : pActive ? new GT_RenderedTexture(_mGTIco_Norm_Active) : new GT_RenderedTexture(_mGTIco_Norm_Idle) }; - else return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][pColorIndex + 1], (pSide < 2) ? null : pActive ? new GT_RenderedTexture(_mGTIco_TE_Active) : new GT_RenderedTexture(_mGTIco_TE_Idle) }; } @Override - public boolean allowPullStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, byte pSide, ItemStack pStack) { + public boolean allowPullStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, ForgeDirection side, + ItemStack pStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, byte pSide, ItemStack pStack) { + public boolean allowPutStack(IGregTechTileEntity pBaseMetaTileEntity, int pIndex, ForgeDirection side, + ItemStack pStack) { return false; } @@ -136,7 +140,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(ForgeDirection facing) { return true; } @@ -146,7 +150,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered } @Override - public boolean isInputFacing(byte aSide) { + public boolean isInputFacing(ForgeDirection side) { return true; } @@ -178,7 +182,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered private static String[] mModeStr = { "Blocks", "TileEntities" }; @Override - public void onScrewdriverRightClick(byte pSide, EntityPlayer pPlayer, float pX, float pY, float pZ) { + public void onScrewdriverRightClick(ForgeDirection pSide, EntityPlayer pPlayer, float pX, float pY, float pZ) { mMode = (byte) (mMode == 0x00 ? 0x01 : 0x00); markDirty(); PlayerUtils.messagePlayer(pPlayer, String.format("Switched mode to: %s", mModeStr[mMode])); @@ -220,7 +224,7 @@ public class GT_MetaTileEntity_WorldAccelerator extends GT_MetaTileEntity_Tiered if (!pBaseMetaTileEntity.isActive()) getBaseMetaTileEntity().setActive(true); for (ForgeDirection tDir : ForgeDirection.VALID_DIRECTIONS) { - TileEntity tTile = pBaseMetaTileEntity.getTileEntityAtSide((byte) tDir.ordinal()); + TileEntity tTile = pBaseMetaTileEntity.getTileEntityAtSide(tDir); if (isTEBlackListed(tTile)) continue; long tMaxTime = System.nanoTime() + 1000000; |
