Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ore and worldgen #3662

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft

Conversation

RecursivePineapple
Copy link
Contributor

@RecursivePineapple RecursivePineapple commented Dec 17, 2024

Summary:

  • Unify the ore worldgen system (moved all GT vein generation to GT, moved asteroid gen to galacticgreg)
  • Moved gt++ and bartworks veins into Oremixes
  • Removed all ore tiles
  • Changed ore blocks to use the standard GT ISBRH
  • Fix the weird bartworks vein info in NEI (removed the bartworks NEI ore page entirely)
  • Improve vein discoverability in NEI (find recipes for oreproc items will show veins)
  • Clean up detrav scanner code & stop it from blocking the server thread
  • Optimize asteroid generation & make them look better
  • Add ice asteroids (nitrogen, ammonia, oxygen, etc)
  • Add new ore stone types for galaxyspace planets

Todo:

  • Test the random code that I touched
  • Make a PR for the byte -> int meta change

Changes:

  • Remove GT and BW TileEntities for ores
  • Make new interface for placing, mining, and inspecting ores (OreManager) to unify all three systems (can be removed after the material system is added if we want)
  • Unify the ore vein config into OreMixes
  • Remove the various ore gein generators and unify them into the GT one
  • Refactor the GT ore vein gen (the logic shouldn't be changed at all for GT veins, GT++ and BW have slight changes due to moving the random calls around)
  • Remove the GT++ and BW ore ISBRHs and use the existing GT renderer (via a new interface, IBlockWithTextures)
  • Improve the NEI orevein integration
  • Refactor void miner code a bit
  • Refactor detrav scanner & prevent it from freezing server (scan is now async via coroutine/generator)
  • Improve GT asteroids & GT end asteroids (I made sure to chunkify and optimize the worldgen, it's basically instant)
  • Move end asteroid generator to galacticgreg and move space orevein gen to GT to unify them
  • Clean up some galacticgreg code (I tried to avoid touching code as much as possible, but I had to largely rewrite the asteroid generator)
  • Changed dimension matching to operate on dimension names instead of the chunk provider name
  • Added ice asteroids to asteroid dimensions (same 'ore' as IRL - oxygen, hydrogen, methane, ammonia, co2, sulfur dioxide, etc - see OreMixes for full list)
  • Added stone system to make it easier to add new stone types for ores
  • Refactor some GT machine & tool code to accept int metadata instead of byte metadata
  • Add temporary IMaterial interface to allow the ore system to accept any material that implements it (will be removed when the new material system is done)
  • Remove ore packets since they aren't needed anymore
  • Optimize the GT++ worldgen a bit
  • Add co-operative scheduler that lets you run expensive tasks on the main thread without blocking it (asynchronously)
  • Added a way to query worldgen ore layers, instead of doing it manually each time
  • Add an Everglades dimension block
  • Rename the GT++ raw ore oredict from oreRaw to rawOre (which is what it should've been)
  • Optimize drilling plants (halved the time taken from ~120k ns to ~60k ns)

@RecursivePineapple RecursivePineapple added refactor For PRs rewritting a part of the code to have a nicer code overall. bug fix Fix a bug. Please link it in the PR. new feature Add something new. Please explain in detail how it works. labels Dec 17, 2024
@Dream-Master Dream-Master requested a review from a team December 17, 2024 19:29
@spacebuilder2020
Copy link
Contributor

Changing to use dimension name will probably break FE's multiworld since you can name a dimension. This would effectively defeat the purpose of not using hardcoded dims since you would not be able to create a multiworld with GT ores in it again...
https://github.com/ForgeEssentials/ForgeEssentials/blob/1.7.10/develop/src/main/java/com/forgeessentials/multiworld/MultiworldManager.java#L281

@RecursivePineapple
Copy link
Contributor Author

@spacebuilder2020 I've never used forge essentials, but it looks like it'll be fine as long as the multiworld uses the proper provider. It determines what ores to generate based on the provider's dimension name, so if you make a multiworld with the nether provider it'll generate everything normally.

https://github.com/ForgeEssentials/ForgeEssentials/blob/1.7.10/develop/src/main/java/com/forgeessentials/multiworld/MultiworldManager.java#L243

@spacebuilder2020
Copy link
Contributor

ok, I thought it was based on the world name. If it is the provider dim name then it is probably fine, but I want to know what your reasoning for changing it to the name?

@RecursivePineapple
Copy link
Contributor Author

RecursivePineapple commented Dec 23, 2024

End asteroids:

https://spark.lucko.me/ODrz28E2Co
image
image

Some examples:
2024-12-23_15 06 55
2024-12-23_15 04 00
2024-12-23_15 05 32
2024-12-23_15 05 37
2024-12-23_15 04 48
2024-12-23_15 05 48

@boubou19
Copy link
Member

this must not be merged until VP is made compatible again

@YannickMG
Copy link
Contributor

Just to make sure, does this require a sister PR of some sort for dreamcraft or any other mod which has compat for GT ores?

@RecursivePineapple
Copy link
Contributor Author

Copy link
Contributor

@YannickMG YannickMG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an amazing improvement that the pack codebase sorely needs if we want to keep being able to evolve the pack. Due to the size of this PR (each bullet point in your PR description could have been it's own PR) I cannot meaningfully review every change to the logic, but thankfully this system is critical enough that we should find any hidden issue soon enough.

What I can do is review changes to existing APIs as well as review the usability and readability of new APIs. I also pointed changes that seemed odd, inconsistent or confusing.

I hope to help ensure new APIs are as usable as possible and make our codebase as clear and maintainable as can be so that if/when a bug is found in the code that was added, it is as simple as possible to resolve it.

src/main/java/gregtech/common/ores/GTOreAdapter.java Outdated Show resolved Hide resolved
src/main/java/gregtech/common/ores/GTOreAdapter.java Outdated Show resolved Hide resolved
src/main/java/gregtech/common/ores/OreManager.java Outdated Show resolved Hide resolved
src/main/java/gtneioreplugin/util/GT5OreLayerHelper.java Outdated Show resolved Hide resolved
src/main/java/gtneioreplugin/util/GT5OreSmallHelper.java Outdated Show resolved Hide resolved
src/main/java/gtneioreplugin/util/GT5OreSmallHelper.java Outdated Show resolved Hide resolved
- Misc minor clean up
- Removed several unused or useless methods and parameters
- Encapsulated several fields behind getters
- Made several public fields private where possible
- Used generic interface for collections where possible
- Used new (Immutable)BlockMeta types and removed old gcgreg classes
  that the new types replace
- Removed replaceable block system in gcgreg to prevent duplication of
  responsibility, since that's handled by the new stone type system now
- Fixed mehen belt asteroid gen (dim name was wrong)
- Changed asteroid gen to use murmurhash to prevent ore banding (old
  bespoke hash algorithm was terrible)
  - Couldn't use google hash lib because those objects can't be reset -
    this code is in a hot-path, so allocations need to be as low as
    possible
- Added custom pair type for detectPrefix
- Added ice and clay stones for Seth to increase oregen (not needed due
  to void miners, but it looks nicer now)
- Added @Nullable/@nonnull for several methods
- Added oregen event for visual prospecting, to remove its mixin (along
  with a new GT event bus)
- Added lots of comments to critical methods
- Changed singleton enums to proper final class instance singletons
- Changed ore hardness/explosion resistance to reflect backing stone
  hardness
- Changed GT++ ores to use the adapter drop logic (I forgot to change
  this before)
- Removed old ambiguous BaseOreComponent constructor
@YannickMG YannickMG dismissed their stale review January 10, 2025 23:02

Comments have been addressed

@Caedis
Copy link
Member

Caedis commented Jan 13, 2025

Can you add EFR's deepslate as another stone type for OW ores?

@YannickMG
Copy link
Contributor

If we're doing that I think I also saw the ore generate in tuff? Not sure if it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fix a bug. Please link it in the PR. new feature Add something new. Please explain in detail how it works. refactor For PRs rewritting a part of the code to have a nicer code overall.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants