diff options
author | Jason Mitchell <mitchej@gmail.com> | 2023-04-22 22:33:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 07:33:35 +0200 |
commit | 56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b (patch) | |
tree | 745e6d92025ec4ef449fc59fa5fdd741200b0489 /src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java | |
parent | ac0b7a7da46646d325def36eed811941dbfc5950 (diff) | |
download | GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.gz GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.bz2 GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.zip |
Forge direction (#1895)
* ForgeDirection
Also refactor the clusterfuck that was `getCoordinateScan`
Co-authored by: Jason Mitchell <mitchej@gmail.com>
* Fix rendering of Frame Boxes
Frame boxes needed their own implementation of getTexture with int connexion mask,
which is returning an error texture for the MetaTileEntity, because pipes (FrameBox
**is** a pipe) do use this method to return different textures based on connexion
status.
---------
Co-authored-by: Léa Gris <lea.gris@noiraude.net>
Diffstat (limited to 'src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java')
-rw-r--r-- | src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java index b348cbb9e3..47f549b5b4 100644 --- a/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java +++ b/src/main/java/gregtech/api/net/GT_Packet_SendCoverData.java @@ -2,6 +2,7 @@ package gregtech.api.net; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; import com.google.common.io.ByteArrayDataInput; @@ -21,7 +22,7 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { protected short mY; protected int mZ; - protected byte side; + protected ForgeDirection side; protected int coverID; protected ISerializableObject coverData; @@ -29,7 +30,7 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { super(true); } - public GT_Packet_SendCoverData(int mX, short mY, int mZ, byte coverSide, int coverID, + public GT_Packet_SendCoverData(int mX, short mY, int mZ, ForgeDirection coverSide, int coverID, ISerializableObject coverData) { super(false); this.mX = mX; @@ -52,7 +53,8 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { this.coverData = info.getCoverData(); } - public GT_Packet_SendCoverData(byte coverSide, int coverID, ISerializableObject coverData, ICoverable tile) { + public GT_Packet_SendCoverData(ForgeDirection coverSide, int coverID, ISerializableObject coverData, + ICoverable tile) { super(false); this.mX = tile.getXCoord(); this.mY = tile.getYCoord(); @@ -74,7 +76,7 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { aOut.writeShort(mY); aOut.writeInt(mZ); - aOut.writeByte(side); + aOut.writeByte(side.ordinal()); aOut.writeInt(coverID); coverData.writeToByteBuf(aOut); } @@ -86,7 +88,7 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { aData.readInt(), aData.readShort(), aData.readInt(), - aData.readByte(), + ForgeDirection.getOrientation(aData.readByte()), coverId = aData.readInt(), GregTech_API.getCoverBehaviorNew(coverId) .createDataObject() @@ -97,8 +99,8 @@ public class GT_Packet_SendCoverData extends GT_Packet_New { public void process(IBlockAccess aWorld) { if (aWorld != null) { final TileEntity tile = aWorld.getTileEntity(mX, mY, mZ); - if (tile instanceof CoverableTileEntity && !((CoverableTileEntity) tile).isDead()) { - ((CoverableTileEntity) tile).receiveCoverData(side, coverID, coverData, null); + if (tile instanceof CoverableTileEntity coverable && !coverable.isDead()) { + coverable.receiveCoverData(side, coverID, coverData, null); } } } |