#block entity
1 messages · Page 1 of 1 (latest)
First, separete class and files. Don't put they together
Second Alt + Enter on class TestBlock and implement all
At the createBlockEntity() just create a new BlockEntity to the heap like (or however you do it in Kotlin)
return new MyBlockEntity(pos, state);
-->
@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new MyBlockEntity(pos, state);
}
For the codec, just create a default one since it seems you dont need a special codec (or however you do it in Kotlin)
return createCodec(MyBlock::new);
-->
@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
return createCodec(MyBlock::new);
}
My BlockEnitity