DevotedMC / HiddenOre

Allows after-map generation positive rebalance via fine-control over custom drops - Anti-Xray - Built for Minecraft and Paper 1.16.4
https://www.devotedmc.com/hiddenore.html
MIT License
11 stars 29 forks source link

Separate configs are generated for each world. #31

Closed Sharpcastle33 closed 6 years ago

Sharpcastle33 commented 7 years ago

Don't worry about it man, there are some other problems I need to address. I did some quick cursory testing and it seemed as if all configs were being used for the overworld? I looked around in BMS' code but couldn't figure out how it chose which config to realize into drops. I need to look into it some more but I haven't had time the past two days.

ProgrammerDan commented 7 years ago

It happens quickly -- the decision is done on point of break, where it picks the configuration to use, iirc. Been a while since I fully reviewed all points of this PR myself, so I could be wrong, but I don't remember it being missing :)

Sharpcastle33 commented 7 years ago

I'm fairly certain now that no checks for which config to use are made. For one, it looks like it's currently set up so each config overwrites the last and that only the last config loaded is used. Not sure how to best quote code here especially because it's a bit messy, but for each world on the server doLoadWorldConfig() is called, which explicitly overwrites instance with the world's config. Block breaks appear to also only refer to instance.

I'm going to setup a system to store multiple configs and then decide on break which config to refer to. Hopefully if I don't break anything it should be good to go.

ProgrammerDan commented 7 years ago

A few things still seem a little off but I'm too tired ATM to pick them apart. Have you tested? In spite of appearance is it working? What have you tried to verify it works? Thanks!

Sharpcastle33 commented 7 years ago

I still need to clean up a lot of stuff as well as make sure everything is working -- I made quite a mess with debug messages and such trying to figure out a few kinks which took way more hours than it should've.

I only tested very briefly; I went into the configs and quickly made redstone common in one world, emeralds common in another, and lapis common in a third, and got the correct ore in each world. HiddenOre now maintains a list of configs, and based on the world a block was broken in, hands off a corresponding config to the rest of the plugin. BMS had disabled a lot of the chat prefix functionality and the like, I simply added it as a 'global' config, which made chat messages re-appear, but I haven't thoroughly tested it or anything.

I had one problem that I still honestly don't understand, that took like 2-3 hours to solve. I had been maintaining the list of instances in the Config class because originally the Config instance was maintained there. However, that caused problems when loading individual world configs to a map. Looping through each world and calling instances.put(worldName,i) (with i being the Config created for the world in question) resulted in me receiving a hashmap with only one world, rather than the several that I expected. This really through me off and took a while to narrow down the cause. I think it probably had to do with the way Java handles scopes or something but I'm honestly not sure. I moved instances to the HiddenOre class and it worked without changing anything else. Maintaining instances of Configs inside the Config class felt really messy anyways so it was probably for the better.

Oh, I also temporarily disabled the whole clear_ores functionality, because it was called before some of the stuff it relies on is actually registered. I have to look into how I want to best fix that.

ProgrammerDan commented 7 years ago

Alright sounds good, lmk if you run into roadblocks otherwise, I'll hold further comments for a bit while you sort out the issues you've already identified.

ProgrammerDan commented 6 years ago

is this still something you intend to do?

Sharpcastle33 commented 6 years ago

My fork has all the features I need on it, I don't plan on re-implementing clear ores functionality.

ProgrammerDan commented 6 years ago

I see; so you have no intent to push your changes upstream?

ProgrammerDan commented 6 years ago

I've spent some time considering these changes. I don't prefer the multiple file approach as defined here; it's a perfectly valid approach in general, but a more elegant and minimal-change approach is possible just injecting optional-world defines into the main config. I've got some ideas sketched out in an uncommitted branch, which will likely go online tonight / tomorrow, including example config. Once I do that, I'll probably close this / these.

That said, thanks for your efforts on this, and for illustrating well the need for this sort of support!

ProgrammerDan commented 6 years ago

See latest master commits, v. 1.4.2 release forthcoming. Then, on to 1.13