Hi,
Im trying to Create a simple block entity, following a guide, and for some reason there's an error registering it(with the deferred register)
Here is my MobRepellentBlockEntity Class
package com.Tadpolling.tutorialmod.block.entity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
public class MobRepellentBlockEntity extends BlockEntity {
public MobRepellentBlockEntity(BlockEntityType<?> pType, BlockPos pPos, BlockState pState) {
super(pType, pPos, pState);
}
}
Here is my ModBlockEntities Class where I have my deferred register
package com.Tadpolling.tutorialmod.block.entity;
import com.Tadpolling.tutorialmod.TutorialMod;
import com.Tadpolling.tutorialmod.block.ModBlocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class ModBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES=
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, TutorialMod.MOD_ID);
public static final RegistryObject<BlockEntityType<MobRepellentBlockEntity>> MOB_REPPLLENT_BLOCK_ENTITY=
BLOCK_ENTITIES.register("mob_repellent_block_entity",()->
BlockEntityType.Builder.of(MobRepellentBlockEntity::new,
ModBlocks.MOB_REPELLENT_BLOCK.get()).build(null));
public static void register(IEventBus eventBus)
{
BLOCK_ENTITIES.register(eventBus);
}
}
On the Line of the of the "BlockEntityType.Builder.of" function call, it gives me an error on the given parameters of the function 'of' and the error given is:
"Cannot resolve method 'of(<method reference> , Block)'
In case it's relevant the Mob Repellent Block does exist and works(I've tested it). I've looked at a few guides so far and they all do the same thing.
Thank you for your time!