Updating from 7.4.0 to 8.0.0
Machine Refactor
Many aspects of the machine classes have been refactored and changed in order to streamline the machine system and remove legacy and unnecessary abstraction.
MetaMachine and MetaMachineBlockEntity merge
- The
MetaMachineBlockEntity(MMBE) class has been removed, andMetaMachine(MM) is now a BlockEntity. - Most methods and properties of MMBE have been moved onto MM.
- The
IMachineBlockEntityinterface has been removed. UseMetaMachineBlockdirectly instead. - Many methods common to all block entities have been moved to the
IGregtechBlockEntityinterface. - Machine instance creation functions have signature
(BlockEntityCreationInfo) -> MetaMachineinstead of(IMachineBlockEntity) -> MetaMachine
References to MMBE can generally be replaced with references to MM:
/////// OLD
if (level.getBlockEntity(getPos()) instanceof MetaMachineBlockEntity mmbe) {
MetaMachine machine = mmbe.getMetaMachine();
...
}
////// NEW
if (level.getBlockEntity(getPos()) instanceof MetaMachine machine) {
...
}
The IMachineBlockEntity holder argument in machine constructors has been replaced with BlockEntityCreationInfo info:
////// OLD
public MetaMachine(IMachineBlockEntity holder);
////// NEW
public MetaMachine(BlockEntityCreationInfo info);
BlockPos getPipePos() -> BlockPos getBlockPos()
- Level getPipeLevel() -> Level getLevel()
- BlockPos getPos() -> BlockPos getBlockPos()
- BlockState getState() -> BlockState getBlockState()
- boolean isInvalid() -> boolean isRemoved()
- void markAsDirty() -> void markAsChanged()
Machine constructor and trait initialisation changes
The constructors for a large number of machines have changed in order to simply machine instance creation. Additionally, methods for trait creation have also been removed and now form part of the machine constructor.
All Machines
- Replace the first constructor argument
IMachineBlockEntity holderwithBlockEntityCreationInfo info
TieredEnergyMachine
- Removed
createEnergyContainermethod - Constructor now has an optional
Supplier<NotifiableEnergyContainer>argument
WorkableTieredMachine
- Removed
createRecipeLogic,createImportItemHandler,createExportItemHandler,createImportFluidHandler,createExportFluidHandlermethods - Added a new constructor:
BlockEntityCreationInfo infoint tierSupplier<RecipeLogic> recipeLogicSupplierRecipe logic supplier, defaults to the standardRecipeLogicclass.int importSlotsItem import slots, defaults to the amount of slots in the machine's default recipe type.int exportSlotsSame as above, but for item export slots.int fluidImportSlotsAs above, but for fluid import slots.int fluidExportSlotsAs above, but for fluid export slots.Int2IntFunction tankScalingFunctionFluid tank capacity scaling function.
WorkableMultiblockMachine, WorkableElectricMultiblockMachine and SteamWorkableMachine
- Removed
createRecipeLogicmethod - Constructor now has an optional
Supplier<RecipeLogic>argument, defaults to the standardRecipeLogicclass