Skip to content

Conversation

@ghzdude
Copy link
Contributor

@ghzdude ghzdude commented Dec 22, 2025

What

Make MTE extend TileEntity through GTBaseTileEntity.
Could be a good candidate for 2.9

Implementation Details

for MetaTileEntity and extending classes, certain methods had to be renamed:

  • writeToNBT -> writeMTETag
  • readFromNBT -> readMTETag
  • writeInitialSyncData -> writeInitialSyncDataMTE
  • receiveInitialSyncData -> receiveInitialSyncDataMTE
  • update -> updateMTE

notable changed classes are:

  • BlockMachine
  • GTBaseTileEntity
  • MetaTileEntity
  • SyncedTileEntityBase
  • MultiblockControllerBase
  • BlockPattern
  • MultiblockShapeInfo
  • BlockInfo
  • DummyWorld
  • TileEntityMixin
  • ClientHandlerMixin
  • and various tests

MetaTileEntity#createMetaTileEntity(IGregTechTileEntity) is now deprecated and replaced by MetaTileEntity#copy()
all usages of setMetaTileEntity() from mte holder has been replaced with MTE#copy()
BlockMachine might not need to implement ITileEntityProvider
BlockMachine now creates the MTE in onBlockPlacedBy()
create GTBaseTileEntity to map TE methods to MTE methods
replace usages of MetaTileEntityHolder with GTBaseTileEntity
track tile entities by pos in DummyWorld
add forcePlace to dummy world
add toString impl for BlockInfo
create ClientHandlerHooks along with ClientHandlerMixin to instantiate MetaTileEntities
TileEntity#Create() needs a mixin to avoid the reflection call to a no args constructor
TileEntity#writeInternal() needs a mixin because the MTE is registered with the GTBaseTileEntity class
PacketRecoverMTE could be removed
probably other things that i have yet to write in this pr

Outcome

people can now implement TileEntity interfaces on MTE

Potential Compatibility Issues

This might impact other prs? i don't know
this may affect the local trout population

this should be everything that instantiates the TE
get convert chunk block pos to world pos
tear out references to mte holder and replace with GTBaseTileEntity
holy shit it actually works
kinda
multiblock previews are fucked up tho
they all face north
try and initialize the mte like it was in MTE holder
fix retrieving the wrong TE at a pos
really these TEs should be added to the world directly
not finished
use Object instead of generics
delete tile map from GTBaseTileEntity
fix TileEntityMixin
send mte info to client
go back to using threadlocal for placing mte
add special tile entity method for DummyWorld
get rid of chunk load event
improve ClientHandlerMixin
delete ChunkMixin.java
fix BlockPattern ???
simplify BlockMachine create mte
some minor lighting issues in jei preview
large boilers are always borked because even in master
add copy method
set TE in block placed method
mark getWorld and getPos to unknown nullability
deprecate `createMetaTileEntity()` in MetaTileEntity
rename `createMetaTileEntity` -> `copy`
cleanup/spotless
deprecate holder
fix processing array's workable
@ghzdude ghzdude added the type: refactor Suggestion to refactor a section of code label Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant