TheGreyGhost / MinecraftByExample

Working sample code for the basic concepts in Minecraft and Forge.
Other
1.24k stars 187 forks source link

The mbe01_block_simple go wrong in 1.12 #31

Closed dancerphil closed 6 years ago

dancerphil commented 7 years ago

The GameRegistry.register() function is set private. And the example may seem to be confused.

dancerphil commented 7 years ago

The code can be replaced as:

ForgeRegistries.BLOCKS.register(blockSimple);
ForgeRegistries.ITEMS.register(itemBlockSimple);

in StartupCommon.java

And I think it's the best practice.

tomelfring commented 7 years ago

Current best practice with 1.12 is using the event based registries.

You can use the following registries (that I know of): RegistryEvent.Register - Register blocks and TileEntities RegisterEvent.Register - Register Items and ItemBlocks ModelRegistryEvent - Register custom models / renderers RegistryEvent.Register - Register sounds

A small example (by LexManos): https://gist.github.com/LexManos/86e88c591c34dfcb34845268200fbd98

TheGreyGhost commented 7 years ago

Hi guys Thanks for that. I'm planning to update the code to 1.12 shortly so I'll incorporate your suggestions then. I do find it very frustrating how the Forge guys keep changing things to "optimise them". It doesn't do us coders any favours to keep breaking the "API" all the time. But anyway Thanks for the help.

Cheers TGG

ghost commented 6 years ago

I think the Item Registry changes were forced by changes on Minecrafts end (in 1.12). I think its a little harsh to blame Forge here.

Any way, thanks for your great work here.

TheGreyGhost commented 6 years ago

Closing (addressed in 1.12.2 version). May change to event-based registration shortly. Thanks for the help. -TGG