Jump to content

Recommended Posts

Posted

I am trying to add Capabilities to certain Entities so that once I have run them through my mod's re-arming process (just changing their armors and weapons to modded ones) during EntityJoinWorldEvent, the mobs get tagged as being re-armed and no longer are subjected to the process when exiting and then rejoining the world.

When I load a world, I get a bunch of IllegalStateExceptions in the log as they are thrown in EntityJoinWorldEvent when the capability is not successfully gotten at each getCapability line in the class handling EntityJoinWorldEvent.

 

Here is my ReArmerProvider class: https://pastebin.com/pTb42dFJ
Here is my MobEquipEvent class where EntityJoinWorldEvent is handled: https://pastebin.com/icDh8mYp

Here is my CapabilityHandler class: https://pastebin.com/QufN6Czb

Here is my main class, where I assume I am properly registering CapabilityHandler (look for "<=== RIGHT HERE"): https://pastebin.com/xB2jZQzR

 

Do let me know if you need to see any other of my capability-related classes.

Posted
  On 4/10/2020 at 6:11 AM, the_infamous_1 said:

Do let me know if you need to see any other of my capability-related classes.

Expand  

The problem is that your AttachCapabilityEvent function is static, but the way you registered it it should not be static.

 

Another thing I noticed is you are doing some stuff in FMLCommonSetupEvent that is not thread safe. Basically anything that interacts with Vanilla Minecraft and potentially forge, such as biomes, needs to be done inside the event, but also using DeferredWorkQueue.runLater

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Yup, that did it. I feel like a fool for not catching that, I don't even use static in my other two event handlers so I have no clue why I put that.

I know about the biomes thing, I had originally left it there so a fellow modder would be able to prevent my ore generation automatically and load the equivalent ores for his mod - if I'm using DWQ then he can't do that and the user would have to disable and enable via config. But, if it's that bad, I'll fix it. Anything else you spot that I should fix while we're at it?

Posted
  On 4/10/2020 at 6:28 AM, the_infamous_1 said:

I had originally left it there so a fellow modder would be able to prevent my ore generation automatically and load the equivalent ores for his mod

Expand  

If you want your ore generation or anything to be determined by another mod use IMC events. IE if you receive a message that says Cancel: OREID or something don't add that ore to the world gen.

 

Just some cleanup stuff in your @Mod class. You don't use the Regsiter<Block> event down at the bottom.

 

Nothing else immediately pops out at me.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

Great.

Bad news, however. Mobs are still re-arming themselves when reloading into a world. Do I need to make sure in AttachCapability that a mob doesn't already have a capability? It seems like when I set a mob's isReArmed capability to true, either it doesn't actually save or each mob keeps getting a new capability with a default value of false.

Edited by the_infamous_1
Posted
  On 4/10/2020 at 6:47 AM, the_infamous_1 said:

Great.

Bad news, however. Mobs are still re-arming themselves when reloading into a world. Do I need to make sure in AttachCapability that a mob doesn't already have a capability? It seems like when I set a mob's isReArmed capability to true, either it doesn't actually save or each mob keeps getting a new capability.

Expand  

Sounds like it is either not saving or not loading. Could you post all of the classes for the Capability. Preferably as a github repo.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

Okay, I shifted setting the "isReArmed" capability to true into the if (World.isBlockLoaded(entity.getPosition) statements during MobEquipEvent (it was outside before). I also add a logger to detect if "isReArmed" is ever set to true before those if statements and it turns out, they are, so I am successfully setting the isReArmed capability of a mob to true.

 

In-game, sometimes entities have their armor and weapons preserved when exiting and reloading, but sometimes they don't. Something about saving and quitting too quickly after a mob has spawned causes it to not get its capability saved to disk I imagine.

 

Here's the updated MobEquipEvent class: https://pastebin.com/w9Z9ArWK

Edited by the_infamous_1
Posted

So what I've noticed is that if you spawn too many mobs in a rapid succession (like I usually do during testing) and then save/quit/reload, most of them won't have their capabilities preserved. If their spawning is done normally or slowly, then it will work as expected.

Posted (edited)

Finally got my Github to work, here's my capability stuff:

https://github.com/Thelnfamous1/HardSteel/tree/master/src/main/java/com/infamous/hard_steel/capabilities

 

https://github.com/Thelnfamous1/HardSteel/tree/master/src/main/java/com/infamous/hard_steel/events

 

Note that I committed this with LivingSpawnEvent.SpecialSpawn instead of EntityJoinWorldEvent.

Edited by the_infamous_1

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

×
×
  • Create New...

Important Information

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