Insane96MCP Posted October 13, 2017 Posted October 13, 2017 Let's say I want to change how Farmland works (e.g. want to add a new propertyInteger to the block), or beacon. What should I do? Create a new block, with most of the same attributes and methods, and replace (using events) the vanilla one? Or there's some other method that works better? Quote
Differentiation Posted October 14, 2017 Posted October 14, 2017 On 10/13/2017 at 11:44 AM, Insane96MCP said: Let's say I want to change how Farmland works (e.g. want to add a new propertyInteger to the block), or beacon. What should I do? Create a new block, with most of the same attributes and methods, and replace (using events) the vanilla one? Or there's some other method that works better? Do what ben said... Quote
Insane96MCP Posted October 15, 2017 Author Posted October 15, 2017 (edited) Deleted Edited October 15, 2017 by Insane96MCP Quote
Insane96MCP Posted October 15, 2017 Author Posted October 15, 2017 On 13/10/2017 at 11:58 PM, diesieben07 said: The new registry system allows to override blocks, simply register a new block with the same registry name to override it. The problem is that I've tried but the game crashes saying that the block has been registered twice: ResourceLocation location = new ResourceLocation("minecraft", "farmland"); newFarmland = new BlockNewFarmland(); newFarmland.setRegistryName(location); newFarmland.setCreativeTab(CreativeTabs.DECORATIONS); GameRegistry.register(newFarmland); GameRegistry.register(new ItemBlock(newFarmland), location); 12 hours ago, Differentiation said: Do what ben said... What's the point of this reply? Quote
Choonster Posted October 15, 2017 Posted October 15, 2017 Which version are you using? By the looks of it, it's not 1.12; which is where the new registry system was introduced. Before 1.12 there was the substitution alias system (GameRegistry.addSubstitutionAlias), though I never managed to get it working properly myself. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Insane96MCP Posted October 15, 2017 Author Posted October 15, 2017 (edited) 42 minutes ago, Choonster said: Which version are you using? By the looks of it, it's not 1.12; which is where the new registry system was introduced. Before 1.12 there was the substitution alias system (GameRegistry.addSubstitutionAlias), though I never managed to get it working properly myself. Uhm well, I may have to move my mod to 1.12 Edited October 15, 2017 by Insane96MCP Quote
Draco18s Posted October 15, 2017 Posted October 15, 2017 8 hours ago, Insane96MCP said: The problem is that I've tried but the game crashes saying that the block has been registered twice: ResourceLocation location = new ResourceLocation("minecraft", "farmland"); newFarmland = new BlockNewFarmland(); newFarmland.setRegistryName(location); newFarmland.setCreativeTab(CreativeTabs.DECORATIONS); GameRegistry.register(newFarmland); GameRegistry.register(new ItemBlock(newFarmland), location); Prior to the addition of the registry events, this is the wrong way to do item substitution. You were supposed to use GameRegistry.addSubstitutionAlias which may throw a ExistingSubstitutionException so you had to wrap it in a try...catch block. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
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.