In minecraft forge 1.20.1 you instantiate a specific type of class (entities) with a constructor that looks like this:
{
super(ModBlockEntities.LIQUID_ENTITY.get(), pos, state);
}```
To instantiate you need to register a object of RegistryObject<BlockEntityType<Entity>>:
``` public static final RegistryObject<BlockEntityType<LiquidBlockEntity>> LIQUID_ENTITY =
BLOCK_ENTITIES.register("block_liquid_entity",
() -> BlockEntityType.Builder.of(
LiquidBlockEntity::new,
ModBlocks.LIQUID_BLOCK.get()).build(null));```
As you can see, within the constructor, you use the RegistryObject itself within super.
That kinda annoys me, so i wanna find a solution for that.
My idea was to create a constructor like this:
``` public LiquidBlockEntity(BlockEntityType<?> pType, BlockPos pos, BlockState state)
{
super(pType, pos, state);
}```
and use this one in the instantiating of the LIQUID_ENTITY by giving
```(pos, state) -> new LiquidBlockEntity(LIQUID_ENTITY.get(), pos, state)```
instead of LiquidBlockEntity::new.
But obviously this doesnt work because i'm referencing the RegistryObject while creating the RegistryObject.
Trying something samey with using a supplier of BlockEntityType<?>
``` public LiquidBlockEntity(Supplier<BlockEntityType<?>> pTypeSupplier, BlockPos pos, BlockState state)
{
super(pTypeSupplier.get, pos, state);
}
(pos, state) -> new LiquidBlockEntity(LIQUID_ENTITY::get, pos, state)
doesnt work for the same reason.
So, is there a way how i could fix this?