Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Add LootTableLoadEvent, methods on LootPool/LootTable #113

Merged
merged 9 commits into from
Jul 21, 2020

Conversation

kitlith
Copy link
Contributor

@kitlith kitlith commented Jul 9, 2020

The mixin to LootManager is messy, and I'm open to alternative ways to doing it, even if it involves doing it in a completely different way from how forge does it. For now, I'm going to get this up so that bikeshedding can happen.

I'm using the "net.patchworkmc.api.*.Forge" pattern for interfaces that describe public methods added by Forge for use by mods in this commit. This is up for bikeshedding.

This is untested other than starting up Minecraft and opening a world. I was originally going to at least use the mod mentioned in #110, but it doesn't appear to have a version for 1.14.4, and I didn't feel like trying to run a 1.15.2 mod through patcher and hoping it worked.

The reason why this PR doesn't simply add/dispatch the LootTableLoadEvent is because many consumers of the event (according to github search) call methods on LootPool and/or LootTable.

@rikka0w0
Copy link
Contributor

rikka0w0 commented Jul 10, 2020

https://github.com/rikka0w0/AdditionalLootTables/tree/master-1.15.2
This version works in both 1.14.4 and 1.15.2, you can use this for testing.

Rename the following to .jar:
AdditionalLootTables-1.15.2-2.0.3.zip

@kitlith
Copy link
Contributor Author

kitlith commented Jul 10, 2020

Turns out it uses FMLServerStoppedEvent which isn't implemented yet. >_>

I'll try and implement it later today (assuming nobody else swoops in), right now I just want to take a short break.

@TheGlitch76 TheGlitch76 added the in progress This is being worked on and is not ready for final review label Jul 10, 2020
@kitlith
Copy link
Contributor Author

kitlith commented Jul 11, 2020

Okay, well, the game runs if FMLServerStoppedEvent is implemented, but the mod performs reflection on ForgeHooks, which, well, #115

@kitlith
Copy link
Contributor Author

kitlith commented Jul 11, 2020

FMLServerStoppedEvent can be moved to another PR entirely, just including it here for now since it's why I implemented it in the first place.

@kitlith
Copy link
Contributor Author

kitlith commented Jul 11, 2020

rebase'd

@kitlith
Copy link
Contributor Author

kitlith commented Jul 13, 2020

note: i should remember to rebase/add a couple things to patchwork-god-classes once #127 is merged.

@kitlith
Copy link
Contributor Author

kitlith commented Jul 17, 2020

Rebased, added ForgeHooks and such.

@kitlith kitlith requested a review from TwilightFlower July 18, 2020 02:15
@kitlith
Copy link
Contributor Author

kitlith commented Jul 19, 2020

rebased

kitlith added 9 commits July 21, 2020 16:30
The mixin to LootManager is messy, and I'm open to alternative ways to
doing it, even if it involves scrapping the 'forge way' of doing it and
doing it a different way. For now, I'm going to get this up so that
bikeshedding can happen.

I'm using the "net.patchworkmc.api.*.Forge<classname>" pattern for
interfaces that describe public methods added by Forge for use by mods
in this commit. This is up for bikeshedding.

This is untested other than starting up Minecraft and opening a world.
The idea is to add an inject in the same place as the method we would be
redirecting (but are instead cancelling) so that we can capture locals,
and grab the builder that we would otherwise be missing.

The downside is that we are effectively overwriting the lambda that
vanilla uses in favor of our own.
Mainly adding Override annotations to methods for interfaces, but a few
other things as well.
@kitlith
Copy link
Contributor Author

kitlith commented Jul 21, 2020

rebased to fix merge conflicts

@TheGlitch76 TheGlitch76 merged commit 657afda into PatchworkMC:master Jul 21, 2020
@kitlith kitlith deleted the loottableload branch July 21, 2020 23:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress This is being worked on and is not ready for final review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants