Posted November 15, 20222 yr I'm trying to register a BlockEntity but IntelliJ says " Connot resolve method 'of(<method reference>, Block)' ". Here is my code: public static final RegistryObject<BlockEntityType<MobKillerBE>> MOB_KILLER_BE = BLOCK_ENTITIES.register("mob_killer", () -> BlockEntityType.Builder.of(MobKillerBE::new, MOB_KILLER.get()).build(null)); MobKillerBE definition: public class MobKillerBE extends BlockEntity MOB_KILLER definition: public static final RegistryObject<Block> MOB_KILLER = BLOCKS.register("mob_killer", () -> new MobKiller(BlockBehaviour.Properties.of(Material.STONE))); I'm using this tutorial: https://moddingtutorials.org/o19/tile-entities Edited November 19, 20222 yr by HobbyProgrammer
November 15, 20222 yr Do you have a constructor in MobKillerBE? Something like: public MobKillerBE(BlockPos position, BlockState state) { ... }
November 15, 20222 yr Author Yes, I'm using this constructor: public MobKillerBE(BlockEntityType<?> type, BlockPos pos, BlockState state) { super(type, pos, state); }
November 15, 20222 yr Add this constructor: public MobKillerBE(BlockPos pos, BlockState state) { this(YourMod.MobKillerBE.get(), pos, state); } Replace YourMod with whatever class you have defined that block entity type You can see something very similar in that tutorial in the section with header "Tile Class" If you want to understand what is going on. Look at the signature of BlockEntityType.BlockEntitySupplier which is the type of the first parameter for Builder.of() It is (BlockPos, BlockState) with no BlockEntityType. Edited November 15, 20222 yr by warjort Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.