diff options
author | iamblackornot <nkzshinnik@gmail.com> | 2023-10-21 13:16:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-21 12:16:22 +0200 |
commit | a2e23af5cbd85d085ce2003402560aad4bb87a52 (patch) | |
tree | 7872d1db1774161833b8d3bd73a293b86417c3b7 /src/main/java/gregtech/api/metatileentity | |
parent | 2466d880d95a0584f5beb7a205070b0e3fc47549 (diff) | |
download | GT5-Unofficial-a2e23af5cbd85d085ce2003402560aad4bb87a52.tar.gz GT5-Unofficial-a2e23af5cbd85d085ce2003402560aad4bb87a52.tar.bz2 GT5-Unofficial-a2e23af5cbd85d085ce2003402560aad4bb87a52.zip |
A new approach for block updates in BaseMetaTileEntity (#2342)
* - added 0,5s cooldown on BaseMetaTileEntity texture render update
* - changed to RandomCooldown to make visual representation of the target object more relevant to its state
* - implemented a BlockUpdateHandler, making the update cooldowns chunk-based
- left commented out debug code
* - now BaseMetaTileEntity tracks last time a texture update was issued and skips update if parent chunk was already updated since last update issue
* - reworked BlockUpdateHandler to a singleton doing update work on client tick, this way update logic is fully encapsulated and gets rid of some comparisons needed to sync updates
* - fixed a bug with crash on quitting the game
- forgot to add moved sources
- cleaned up debug code
- added description commentary
* - updated buildscript
* - switched to internal tick counter, cause server time is unreliable and crashes client https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/14742
- removed subclass aliases
- switched to XSTR instead of java's Random
- IllegalArugmentException instead of InvalidParameterException
- added client side config option to enable/disable this feature (by default is off)
---------
Co-authored-by: iamblackornot <nkzshinnnik@gmail.com>
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index a7236e164d..8755bacf7f 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -72,6 +72,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.blockupdate.BlockUpdateHandler; import gregtech.api.util.GT_CoverBehaviorBase; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; @@ -333,8 +334,11 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity } if (mNeedsUpdate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - // worldObj.func_147479_m(xCoord, yCoord, zCoord); + if (GT_Mod.gregtechproxy.mUseBlockUpdateHandler) { + BlockUpdateHandler.Instance.enqueueBlockUpdate(worldObj, getLocation()); + } else { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } mNeedsUpdate = false; } } |