diff options
author | Léa Gris <lea.gris@noiraude.net> | 2022-07-18 02:29:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 07:29:13 +0700 |
commit | d698da152c3882fd3656954cbaa7ff5c0f47e2ef (patch) | |
tree | 1d8f9b67e80340959cf4596f22b0bdf5d435ce75 /src/main/java/gregtech/common/blocks/GT_Block_Machines.java | |
parent | a0875d0f57753fae9f608eddf651466b04182060 (diff) | |
download | GT5-Unofficial-d698da152c3882fd3656954cbaa7ff5c0f47e2ef.tar.gz GT5-Unofficial-d698da152c3882fd3656954cbaa7ff5c0f47e2ef.tar.bz2 GT5-Unofficial-d698da152c3882fd3656954cbaa7ff5c0f47e2ef.zip |
feat(tile): onRandomDisplayTick (#1138)
Adds onRandomDisplayTick method to the IGregTechTileEntity interface
that can proxy randomDisplayTick from block.
This allows to delegate block particles to the tile,
with a client-side-only processing.
Includes reference implementation for the Bronze Boiler
Diffstat (limited to 'src/main/java/gregtech/common/blocks/GT_Block_Machines.java')
-rw-r--r-- | src/main/java/gregtech/common/blocks/GT_Block_Machines.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index 24b8635c86..63626928bf 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -1,4 +1,5 @@ package gregtech.common.blocks; +import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import com.cricketcraft.chisel.api.IFacade; import cpw.mods.fml.common.Optional; @@ -48,6 +49,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Random; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.SIDE_UP; @@ -540,6 +542,18 @@ public class GT_Block_Machines extends GT_Generic_Block implements IDebugableBlo return this.renderAsNormalBlock() ? 0.2F : 0.5F; } + /** + * @inheritDoc + */ + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World aWorld, int aX, int aY, int aZ, Random aRandom) { + final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (tTileEntity instanceof IGregTechTileEntity) { + ((IGregTechTileEntity) tTileEntity).onRandomDisplayTick(); + } + } + @Override public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { final TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); |