Jump to content

Whats the best way to change vanilla blocks behaviour when events are not available?


Insane96MCP

Recommended Posts

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...

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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 by Insane96MCP
Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Ho installato Forge 1.20.2, ho cliccato col tasto sinistro due volte su installer.jar, non si apre e crea solo un file .log Il file contiene: JVM info: Oracle Corporation - 1.8.0_401 - 25.401-b10 java.net.preferIPv4Stack=true Current Time: 27/02/2024 18:18:10 Host: files.minecraftforge.net [51.79.83.165] Host: maven.minecraftforge.net [51.79.83.165] Host: libraries.minecraft.net [13.107.213.45, 13.107.246.45] Host: launchermeta.mojang.com [13.107.246.45, 13.107.213.45] Host: piston-meta.mojang.com [13.107.246.45, 13.107.213.45] java.net.UnknownHostException: authserver.mojang.com     at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)     at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)     at java.net.InetAddress.getAddressesFromNameService(Unknown Source)     at java.net.InetAddress.getAllByName0(Unknown Source)     at java.net.InetAddress.getAllByName(Unknown Source)     at java.net.InetAddress.getAllByName(Unknown Source)     at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:290)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120) Exception in thread "main"  java.lang.NullPointerException     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:120)
    • Suddenly the installer stopped working, both forge and neoforge, I've tested it on almost all versions of java and it didn't solve my problem.] Here is the log that appears after trying to open the file: JVM info: Oracle Corporation - 21.0.2 - 21.0.2+13-LTS-58 java.net.preferIPv4Stack=true Current Time: 27/02/2024 13:55:14 Host: maven.neoforged.net [172.67.165.187, 104.21.89.226] Host: libraries.minecraft.net [13.107.246.33, 13.107.213.33] Host: launchermeta.mojang.com [13.107.246.33, 13.107.213.33] Host: piston-meta.mojang.com [13.107.246.33, 13.107.213.33] java.net.UnknownHostException: Este host nᅢᆪo ᅢᄅ conhecido (authserver.mojang.com)     at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)     at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52)     at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211)     at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828)     at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139)     at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818)     at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688)     at net.minecraftforge.installer.DownloadUtils.getIps(DownloadUtils.java:296)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:124) Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "net.minecraftforge.installer.DownloadUtils.getIps(String)" is null     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:124)   If anyone knows how to solve this please tell me.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.