Skip to content

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, and MetaMachine(MM) is now a BlockEntity.
  • Most methods and properties of MMBE have been moved onto MM.
  • The IMachineBlockEntity interface has been removed. Use MetaMachineBlock directly instead.
  • Many methods common to all block entities have been moved to the IGregtechBlockEntity interface.
  • Machine instance creation functions have signature (BlockEntityCreationInfo) -> MetaMachine instead 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);
A number of methods have been renamed across a number of different interfaces and classes to ensure consistency with default BlockEntity methods: - 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 holder with BlockEntityCreationInfo info

TieredEnergyMachine

  • Removed createEnergyContainer method
  • Constructor now has an optional Supplier<NotifiableEnergyContainer> argument

WorkableTieredMachine

  • Removed createRecipeLogic, createImportItemHandler, createExportItemHandler, createImportFluidHandler, createExportFluidHandler methods
  • Added a new constructor:
    • BlockEntityCreationInfo info
    • int tier
    • Supplier<RecipeLogic> recipeLogicSupplier Recipe logic supplier, defaults to the standard RecipeLogic class.
    • int importSlots Item import slots, defaults to the amount of slots in the machine's default recipe type.
    • int exportSlots Same as above, but for item export slots.
    • int fluidImportSlots As above, but for fluid import slots.
    • int fluidExportSlots As above, but for fluid export slots.
    • Int2IntFunction tankScalingFunction Fluid tank capacity scaling function.

WorkableMultiblockMachine, WorkableElectricMultiblockMachine and SteamWorkableMachine

  • Removed createRecipeLogic method
  • Constructor now has an optional Supplier<RecipeLogic> argument, defaults to the standard RecipeLogic class