Draco18s / ReasonableRealism

For 1.10!
Other
17 stars 8 forks source link

[Harder Farming] Undead horses dying? #47

Closed theavandiepen closed 2 years ago

theavandiepen commented 2 years ago

I know you haven't been doing anything with Minecraft mods for a while, so I know this may be a long shot, but:

Skeleton horses (and I'm guessing also zombie horses) die like other animals do with Harder Farming, but because they can't actually breed, they just all die off. They go into love mode, though, which is entertaining xD Either way, though, it doesn't make sense for an undead being to die of old age. Also I have four skeleton horses thanks to a skeleton trap and I don't want to keep cheating to replace them xD

Would you be able to make it so undead horses aren't affected by Harder Farming's animal mechanics? The config file doesn't have a way to make certain animals exempt from aging; there's just the global on/off for all animals.

Draco18s commented 2 years ago

Ah yes, super old code applying to mobs that don't spawn all that naturally to begin with.... hehe There is a per-animal config, though because of how horses work I don't think it would work for just the undead ones. :\

In theory I could probably fix it, but it wouldn't be easy.

theavandiepen commented 2 years ago

Haha, yeah, I’ve been playing Minecraft since it was in beta and this was my first natural encounter with a skeleton trap. I was delighted

I could try the per-animal config and see what happens. Where is it/how would I do it? I’ve been trying but I can’t find it (my Minecraft version is 1.12.2)

Also I was looking at the source code for animal aging and if I’m correct (I’m not super code savvy), if an animal has an owner, it doesn’t age?

Since skeleton trap horses are tame when they spawn (rather than a player taming them) I’m thinking they don’t have an owner attributed to them. If so, if I use a command to make me their owner, that would solve the problem (and would explain why my tame wolves aren’t dying, which I’m glad about!)

Draco18s commented 2 years ago

1.12 would actually be this repo but it's fine.

Oh well shit. Setting the accelerated age rate to 0 was the intended solution, but that'll actually cause a Divide By Zero error.

Darn.

theavandiepen commented 2 years ago

Oh whoops. This is where the source link in CurseForge took me

Whoops

Was I right about an animal with an owner not aging, though?

Draco18s commented 2 years ago

Yeah I updated the source link when the new version came out. It's fine though, same project, just things changed so drastically I didn't "port" so much as "rewrite from scratch."

Was I right about an animal with an owner not aging, though?

Yes.

theavandiepen commented 2 years ago

Gotcha!

Okay, perfect, I read that right. Now I can death proof them :D

theavandiepen commented 2 years ago

All right, it looks like donkeys, llamas, and mules are also being affected by this, and skeleton horses still die if they have an owner. (And I'm guessing zombie horses are similarly affected)

BUT I found the fix!

If you change EntityHorse to AbstractHorse in two spots of the code section you linked me to, it'll make all of the above stop aging when they're tame, and horses will continue to work as intended. For skeleton horses, this would make them unaging from the get go since they spawn tame.

So basically, if I'm right about this, you want that section of code to read:

    if(entity instanceof AbstractHorse) {
        return !((AbstractHorse)entity).isTame();
    }
    else if(entity instanceof IEntityOwnable) {
        return ((IEntityOwnable)entity).getOwner() == null;
    }

And that would fix it!

Also, looking at the dates for releases on Curseforge and comparing them to the commits on this repo and the other you linked me to, it looks like the 1.12.1 branch in this repo is the source for the jar I've got in my mods folder, even with releases just for version parity taken into account.

Draco18s commented 2 years ago

Yeah, I was pretty sure you were on that version, as 1.14+ doesn't have this dumb logic. Mostly because it never really worked all that well even when there weren't issues like this.

I'm not sure I have a functional 1.12 workspace atm, but I'll check.

theavandiepen commented 2 years ago

Haha, we all learn how to do things better after we do them not so great.

Sounds good! If I could do the thing and save you some time, I definitely would

Draco18s commented 2 years ago

Good news, I have a functional 1.12 workspace.

But I don't have RR's ("Harder Stuff") source in it. I can pull the java code just fine, but I never pushed the resources, so lets see if I can recover those from somewhere...

theavandiepen commented 2 years ago

Huzzah! And fingers crossed!

Draco18s commented 2 years ago

Nah, the stuff exists. I just didn't want to have to pull apart a jar file for them.

Also need COG's source, located, fetching...

Draco18s commented 2 years ago

Oh. This is. Depressing.

I don't need a 1.12 workspace. I need a 1.7.10 workspace.

I forgot how old this sh!t is. XD

I now have to scour even older hard drives to see if I can scrape together the required bits, because the Forge mdk urls changed and it's no longer possible to run setup (which has been true for like, ten years). In theory I can do this.

theavandiepen commented 2 years ago

Oh dear lord, this is certainly one heck of a search xD

Draco18s commented 2 years ago

Yeah, it is. All the files are in one place, in my old-old user directory. It's a matter of seeing if I can still open the workspace, as there may be other files that are required stored in other parts of the file system.

Draco18s commented 2 years ago

Almost there. Almost there. Project is open and there are no errors. Just need to figure out how to set up a run configuration...

Draco18s commented 2 years ago

Ok, can't run things in the workspace, but after some updated maven URLs I can compile. So that'll have to do.

Draco18s commented 2 years ago

Alright, give this a shot: Full mod set or Just Wildlife Depending on how you acquired things originally.

theavandiepen commented 2 years ago

Testing it right now- will let you know what happens!

theavandiepen commented 2 years ago

All right, so the mod isn't loading at all, but that would be because it's for the wrong Minecraft version, looks like.

This is the version I originally got

Draco18s commented 2 years ago

Ah! That is 1.12, I'll try again this evening. That source will be easier to set up. Derpity derp derp.

theavandiepen commented 2 years ago

Hahaha no worries

Draco18s commented 2 years ago

Alright, lets try this again.

https://www.dropbox.com/s/dkc0pkm44iikgg9/1.12.1-Harderfarming-7.0.0b.jar?dl=0

theavandiepen commented 2 years ago

Huzzah!

I can confirm:

Draco18s commented 2 years ago

All undead of all sorts are skipped now. Found a getCreatureType method that has an UNDEAD value. As for extreme numbers: not gonna fix it. :p It was literally allowed to go that high precisely because someone wanted animals to die instantly and I went "shrug, don't see why not."

Its not really a rational value at that point; less of a bug and more of a developer tool.

theavandiepen commented 2 years ago

Oh, nice!

Haha, yeah it didn't seem like a bug tbh. I just thought it was entertaining and made sure it was just due to config settings and nothing else (for my own peace of mind, if nothing else)

Thank you so much for doing this! I really appreciate you taking the time to fix this issue