Jump to content

Recommended Posts

Posted

As we know, vanilla classes aren't fan of overrides. For example, if we look at ItemSeeds, we have this thing:

private final Block crops;

What this means is that if someone overrides your crops block you have nothing you can do and the whole game breaks, because the registry Block is now different.

 

How do I fix this?

 

(@ObjectHolders are still as broken as they were before, since they do nothing to help this.)

No, you do NOT need jar modding!

Posted (edited)

final on a field means nothing about overriding, because overriding applies to methods only. A final field just means it can't be changed after it's been initialised. In ItemSeeds, the crops field is initialised using the Block passed to the constructor, so you can set it to whatever you want when making your own seed item.

 

Maybe explain your actual situation, because this sounds like a potential XY problem.

Edited by Jay Avery
Posted

Forge has a mechanism for overriding blocks. You can replace any block with your own Block as long as it's not Blocks.AIR.

 

This mechanism doesn't extend to final Block fields like the ones found in ItemSeeds. You can crash anything that uses ItemSeeds by overriding the underlying Block. (You *can* override both the block *and* the item, but eh.)

No, you do NOT need jar modding!

Posted

You mean the substitution alias system.

 

That's not override.

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.

Posted
  On 7/16/2017 at 9:19 PM, SoniEx2 said:

How do I fix this?

Expand  

Override the item when you override the block.

  On 7/16/2017 at 9:19 PM, SoniEx2 said:

(@ObjectHolders are still as broken as they were before, since they do nothing to help this.)

Expand  

Um no, they are working just fine. Quit BITCHING about things and actually HELP if you have issues. Seriously you're REALLY pissing off most of the community.

 

Let this be your final warning, you're already banned from almost off IRC/Git Projects for your attitude. Don't make me have to ban you from here to.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
  On 7/17/2017 at 1:51 AM, Draco18s said:

You mean the substitution alias system.

 

That's not override.

Expand  

The substitution alias system was replaced by the override system with the registry overhaul in 1.12.

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.

Posted

How can I make it so I don't need to override the item when I override the block, at least for my own items?

 

Also it's called "override" in the code.

No, you do NOT need jar modding!

Posted

It doesn't matter what it is called stop using random phrases and expecting others to understand them.

Just describe in unambiguous terms what you're doing so that everyone can understand.

 

As for what to do with your own code. Registry DELEGATES the exact thing we've been telling you to do for years.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

What I came up with is, I could extend ItemSeeds and hope nobody's reflecting into the crops field, then override the relevant methods using a static @ObjectHolder field instead of a private final (instance) field, such that I need different classes for different seeds, but at least the Block is automatically updated. That would probably work, but is there a better way I can do it?

No, you do NOT need jar modding!

Posted (edited)

Those would be IRegistryDelegate? Also, that's not exactly what I'd call "a better way", since I still need to override everything.

Edited by SoniEx2

No, you do NOT need jar modding!

Posted

Why in gods name are you overriding YOUR OWN ITEMS?

Seriously dude, Explain in full detail exactly what you are trying to accomplish. Not what you're thinking you should try.

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I need to override the ItemSeeds methods, not my own items. I want other mods to be able to override my stuff painlessly.

No, you do NOT need jar modding!

Posted

Step 1:

Create a new class

Step 2:

Use the sustitution/override system to replace the vanilla instance with your own instance

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.

Posted
  On 7/17/2017 at 3:55 AM, SoniEx2 said:

I need to override the ItemSeed

Expand  

You want to override the Item, there ya go. Replace the item! What does anyone else matter?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Why? You want to replace the vanilla ItemSeed instances in the registry with your own thing.

Who cares that you are subclassing things. You don't NEED to subclass things.

Just register your override for the Item.

 

Seriously dude, sit down, take 10 seconds. Write down what you're trying to accomplish at the end of the road. What is your mod doing that has interaction with ItemSeed. We need to understand what you want to do, not how you want to do it. http://xyproblem.info/

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I have a mod. It registers a Block, and an ItemSeeds which uses that Block. I'd like to let other mods replace the Block using the overrides system, without them also having to replace the ItemSeeds.

 

To do that, the only way I know of is to make my own subclass of ItemSeeds that doesn't use the final Block inside it, but rather uses some sort of thing that stays in sync with the registry. This involves overriding all ItemSeeds methods in my subclass, which defeats using ItemSeeds in the first place.

 

The question is, is there a better way?

No, you do NOT need jar modding!

Posted

Right now there is is no better option. We could patch ItemSeeds to use the delegate system like we do for ItemBlock/ItemBlockSpecial. However as it sits any other modder would need to override the ItemSeed if they replace the Block in vanilla so there isn't any issue. You're making a problem where there isn't one.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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