Jump to content

Custom (non-iron) bucket


Corey

Recommended Posts

The universal bucket is great and all (it's what my clay buckets currently turn into once they harden), but I'd like to have them come out as actual clay buckets.  My first attempt was to just create my own instance of the universal bucket with a modified unlocalised/registry name, which yielded:

[11:19:05] [main/WARN] [FML/]: Registry Item: Override did not have an associated owner object. Name: gradient:clay_bucket Value: lordmonoxide.gradient.items.ClayBucket@72188b01

 

In case Forge was using the actually class object in one of its maps, I tried extending it, but got the same issue.  I don't want to override the bucket, I want to create a second, non-metal bucket.

 

Anyone have any suggestions, short of copying-and-pasting the universal bucket class?

Link to comment
Share on other sites

I copied the registration code from ForgeModContainer:

CLAY_BUCKET.setUnlocalizedName("clay_bucket");
event.getRegistry().register(CLAY_BUCKET.setRegistryName(GradientMod.MODID, "clay_bucket"));
MinecraftForge.EVENT_BUS.register(CLAY_BUCKET);

I'm guessing it's not necessary to register the event handlers again here since Forge already does, but I get the same error if that line is commented out.

Link to comment
Share on other sites

It's currently just a static field:

public static final UniversalBucket CLAY_BUCKET = new UniversalBucket();

The class it's in is initialized on the line immediately preceding the code I pasted above.

 

See source here:

https://github.com/LordMonoxide/gradient/blob/master.%2337.buckets/src/main/java/lordmonoxide/gradient/items/GradientItems.java#L205

CLAY_BUCKET is defined on line 96.

Note: it's a god damned mess, it started off as a learning mod and needs to be refactored

Edited by Corey
Link to comment
Share on other sites

Just checked - I don't see any way it could be getting registered twice.  It's being registered during the item registry event, and no other code calls that method.  I added logging immediately before the call to register it just in case, and I'm only seeing it logged once.

Just realised I forgot to attach the actual stacktrace to my first post...

java.lang.RuntimeException: One of more entry values did not copy to the correct id. Check log for details!
	at net.minecraftforge.registries.ForgeRegistry.sync(ForgeRegistry.java:543)
	at net.minecraftforge.registries.GameData.loadRegistry(GameData.java:490)
	at net.minecraftforge.registries.GameData.freezeData(GameData.java:225)
	at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:730)
	at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:352)
	at net.minecraft.client.Minecraft.init(Minecraft.java:581)
	at net.minecraft.client.Minecraft.run(Minecraft.java:421)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

The line pasted in the first post is the last thing logged before the error.

Link to comment
Share on other sites

It was, in fact, a double-registration... after disabling the universal bucket and only registering my own, I was still getting a conflict.  I had accidentally registered it with the same name I had used for another block.  However, after registering it, I ran into several other issues.  Some of the code assumes the universal bucket, and I couldn't seem to get it to actually show up in JEI.  I've ended up just using parts of the universal bucket code and its supporting classes, removing all of the special-case handling of vanilla buckets.

 

My final issue now is that I'm having trouble tracking down the code that provides the dynamic textures.  Any pointers?

 

Edit: Scratch that, found it.  Thanks for your help.

Edited by Corey
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.

Announcements



×
×
  • Create New...

Important Information

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