Closed Rabbit0w0 closed 1 month ago
@Rabbit0w0 I had the exact same issue and just saw that it is caused because you need to register the newly created BLOCK_ENTITY_TYPES to the mod event bus. Like this, by using the starting ModDevGradle example repository.
// The constructor for the mod class is the first code that is run when your mod is loaded.
// FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
public ExtraSync(IEventBus modEventBus, ModContainer modContainer)
{
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
// Register the Deferred Register to the mod event bus so blocks get registered
BLOCKS.register(modEventBus);
// Register the Deferred Register to the mod event bus so items get registered
ITEMS.register(modEventBus);
// Register the Deferred Register to the mod event bus so tabs get registered
CREATIVE_MODE_TABS.register(modEventBus);
// Register the Deferred Register to the mod event bus so block entities get registered
BLOCK_ENTITY_TYPES.register(modEventBus);
...
}
Is it possible to add this mention to the documentation?
@Rabbit0w0 I had the exact same issue and just saw that it is caused because you need to register the newly created BLOCK_ENTITY_TYPES to the mod event bus. Like this, by using the starting ModDevGradle example repository.
// The constructor for the mod class is the first code that is run when your mod is loaded. // FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically. public ExtraSync(IEventBus modEventBus, ModContainer modContainer) { // Register the commonSetup method for modloading modEventBus.addListener(this::commonSetup);
// Register the Deferred Register to the mod event bus so blocks get registered BLOCKS.register(modEventBus); // Register the Deferred Register to the mod event bus so items get registered ITEMS.register(modEventBus); // Register the Deferred Register to the mod event bus so tabs get registered CREATIVE_MODE_TABS.register(modEventBus); // Register the Deferred Register to the mod event bus so block entities get registered BLOCK_ENTITY_TYPES.register(modEventBus); ...
}
Is it possible to add this mention to the documentation?
We do link to the relevant pages for registration using DeferredRegister
in the documentation since it should be stated that if you are making a block entity, you have probably already done a similar process for blocks. However, after a quick read, I do think the link should be more explicitly highlight than just a loose mention. I would suggest creating a separate issue for this.
As title.
Code in doc:
but the
register
method actually acceptsBlock
instead ofDeferredBlock
Also, by following the doc to build a example mod, it actually doesn't work with the exception:
java.lang.NullPointerException: Trying to access unbound value: ResourceKey[minecraft:block_entity_type / customfurniture:furniture_entity]
, which is thrown when constructing a new block entity and unboxingSupplier<BlockEntityType<MyBlockEntity>>
mc ver: 1.12.1 neo: 21.1.65