Jump to content

[1.8.9] GameRegistry.registerBlock() throws NoSuchMethodException


Recommended Posts

Posted

I'm trying to set up some blocks with differently textured variants. When I try to register a block with an ItemMultiTexture as its ItemBlock, the game crashes with the stacktrace:

java.lang.NoSuchMethodException: net.minecraft.item.ItemMultiTexture.<init>(net.minecraft.block.Block, mod.block.PortalFrameBlock, mod.block.VariantBlock$1)
at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_92]
at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_92]
at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:272) [GameRegistry.class:?]
at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:239) [GameRegistry.class:?]
at mod.block.VariantBlock.<init>(VariantBlock.java:24) [VariantBlock.class:?]
at mod.block.PortalFrameBlock.<init>(PortalFrameBlock.java:30) [PortalFrameBlock.class:?]
at mod.block.ModBlocks.init(ModBlocks.java:18) [ModBlocks.class:?]
at mod.proxy.CommonProxy.preInit(CommonProxy.java:16) [CommonProxy.class:?]
at mod.proxy.ClientProxy.preInit(ClientProxy.java:14) [ClientProxy.class:?]
at mod.TestMod.preInit(TestMod.java:34) [TestMod.class:?]

 

Context from my code:

protected VariantBlock(String name, Material material) {
super(material);
setUnlocalizedName(name);
setRegistryName(name);
Function<ItemStack, String> function = new Function<ItemStack, String>() {
	@Override
	public String apply(ItemStack input) {
		return getTypeForMeta(input.getMetadata()).getName();
	}
};
GameRegistry.registerBlock(this, ItemMultiTexture.class, this, function);
}

 

registerBlock() wants me to pass in the constructor arguments for ItemMultiTexture, not the types, but ItemMultiTexture has a (Block, Block, Function<>) constructor, which doesn't match the subtypes produced from the arguments.

 

Is there any way to work around this, or should I just begin porting everything to 1.9.4?

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.

Announcements



×
×
  • Create New...

Important Information

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