Skip to content

Feat: neroagriculture apis - #35

Open
Dario-Maselli wants to merge 3 commits into
mainfrom
feat/neroagriculture-apis
Open

Feat: neroagriculture apis#35
Dario-Maselli wants to merge 3 commits into
mainfrom
feat/neroagriculture-apis

Conversation

@Dario-Maselli

Copy link
Copy Markdown
Member

Summary

Related issue

Type of change

  • 🐞 Bug fix
  • ✨ New feature / content
  • 🎨 Assets / textures / models
  • 🧹 Refactor / cleanup
  • 📖 Docs

Checklist

  • All six loader cells pass (:neoforge:26.1.2:build, :neoforge:26.2:build, :forge:26.1.2:build, :forge:26.2:build, :fabric:26.1.2:build, :fabric:26.2:build) with BUILD SUCCESSFUL.
  • New blocks/items have models + textures (or are intentionally placeholder).
  • No new compiler warnings.
  • I understand the project is All Rights Reserved and have the right to contribute this code.

Notes for reviewers

Introduces a new `za.co.neroland.nerospace.api` surface for planet visits/events, immutable environment snapshots, bounded oxygen contributions, and claim-gated reversible terraforming overlays, backed by new persisted state models (`PlanetVisitState`, `OxygenContributionState`, `TerraformOverlayState`). Hooks visit tracking and erasure into runtime (`OxygenManager`, `NerospaceCommon`) and adds plain-JVM JUnit coverage for atmosphere rules, visit persistence/erasure, oxygen decay, and overlay rollback/authorization. Also bumps Nerospace to `1.0.0-beta.8`, raises required Neroland Core to `1.8.0`, and updates changelog/docs/wiki plus NeoForge test wiring to run shared common tests.
Copilot AI review requested due to automatic review settings July 12, 2026 22:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a4f7291cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Optional<PlanetId> planet = NerospacePlanets.byDimension(level.dimension());
PlanetTraits traits = planet.map(NerospacePlanets::traits).orElse(null);
Hazard hazard = traits == null ? Hazard.NONE : traits.hazard();
double gravity = planet.isEmpty() ? 1.0D : NerospacePlanets.gravityAt(level, pos);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check chunk load before resolving exact gravity

When an API consumer queries an unloaded Nerospace position, this resolves exact gravity before the hasChunkAt guard. GravityManager.factorAt reads the biome and can call level.getChunkAt(pos), so the environment probe may synchronously load/generate the chunk instead of returning the documented fail-closed vacuum snapshot. Move the loaded check ahead of exact gravity resolution, or use default gravity for unloaded positions.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new public integration surface under za.co.neroland.nerospace.api (planet visits, environment snapshots, external oxygen contributions, and reversible terraforming overlays) intended for other “Nero” mods to integrate without accessing internal managers, while also bumping Nerospace/Core version requirements and adding unit tests + wiki/docs coverage.

Changes:

  • Added public API contracts for historical planet visits + first-visit events, environment snapshots, oxygen contributions, and claim-guarded terraforming overlays.
  • Implemented new persisted server-side state for visits, oxygen contributions, and overlay regions, and wired them into tick + data-erasure.
  • Added plain-JVM JUnit tests (executed from NeoForge nodes) plus changelog/wiki/docs updates and version bumps.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wiki/Public-API.md New wiki page describing the public integration API surface and privacy constraints.
wiki/Home.md Adds the new Public Integration API page to the wiki index.
neoforge/build.gradle Wires common/src/test/java into NeoForge test source set and adds JUnit 5 config.
gradle.properties Bumps Nerospace version to 1.0.0-beta.8 and raises Core floor to 1.8.0.
docs/USING-CORE.md Documents resolving Neroland Core via Maven Local or GitHub Packages.
common/src/test/java/za/co/neroland/nerospace/world/TerraformOverlayStateTest.java Adds codec + authorization/rollback tests for overlay persistence.
common/src/test/java/za/co/neroland/nerospace/world/OxygenContributionStateTest.java Adds bounded contribution + decay + prune tests.
common/src/test/java/za/co/neroland/nerospace/progression/PlanetVisitStateTest.java Adds persistence + erasure behavior tests for planet visit history.
common/src/test/java/za/co/neroland/nerospace/api/EnvironmentRulesTest.java Adds unit tests for unloaded fail-closed behavior and atmosphere resolution rules.
common/src/main/java/za/co/neroland/nerospace/world/TerraformOverlayState.java New persisted reversible overlay store + lookup-by-position logic.
common/src/main/java/za/co/neroland/nerospace/world/OxygenManager.java Records visits on tick; integrates overlay + external oxygen checks into breathability.
common/src/main/java/za/co/neroland/nerospace/world/OxygenContributionState.java New persisted oxygen contribution store with linear time/distance decay.
common/src/main/java/za/co/neroland/nerospace/progression/PlanetVisitState.java New persisted UUID→planet visit history with erasure support.
common/src/main/java/za/co/neroland/nerospace/NerospaceCommon.java Hooks planet-visit state into Core’s player-data erasure callback.
common/src/main/java/za/co/neroland/nerospace/api/TerraformRequest.java New validated request record for overlay mutation.
common/src/main/java/za/co/neroland/nerospace/api/TerraformRegion.java New immutable public snapshot of overlay regions (no owner identity).
common/src/main/java/za/co/neroland/nerospace/api/TerraformClaimPolicy.java New functional interface for server-installed claim authorization.
common/src/main/java/za/co/neroland/nerospace/api/README.md Expands developer docs with visits/environment/oxygen/overlay sections.
common/src/main/java/za/co/neroland/nerospace/api/PlanetVisitEvents.java New first-visit event bus for integrations.
common/src/main/java/za/co/neroland/nerospace/api/package-info.java Updates package-level Javadoc to include new API facets.
common/src/main/java/za/co/neroland/nerospace/api/NerospaceVisits.java New facade for visit observation + query + export.
common/src/main/java/za/co/neroland/nerospace/api/NerospaceTerraforming.java New claim-guarded apply/rollback facade over overlay state.
common/src/main/java/za/co/neroland/nerospace/api/NerospaceOxygen.java New bounded external oxygen contribution facade.
common/src/main/java/za/co/neroland/nerospace/api/NerospaceEnvironment.java New environment snapshot facade combining planet traits, oxygen, and terraforming.
common/src/main/java/za/co/neroland/nerospace/api/EnvironmentSnapshot.java New immutable environment snapshot record with validation/clamping.
common/src/main/java/za/co/neroland/nerospace/api/EnvironmentRules.java New pure rules helper for mapping snapshot inputs to atmosphere/breathable states.
common/src/main/java/za/co/neroland/nerospace/api/Atmosphere.java New enum for coarse atmosphere states used by integrations.
CHANGELOG.md Documents the new public APIs and the raised Core version requirement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +27
Optional<PlanetId> planet = NerospacePlanets.byDimension(level.dimension());
PlanetTraits traits = planet.map(NerospacePlanets::traits).orElse(null);
Hazard hazard = traits == null ? Hazard.NONE : traits.hazard();
double gravity = planet.isEmpty() ? 1.0D : NerospacePlanets.gravityAt(level, pos);
if (!level.hasChunkAt(pos)) {
return EnvironmentRules.resolve(false, planet, hazard, gravity, 0, 0, false);
}
Comment on lines 213 to +218
if (OxygenFieldManager.get(level).isBreathable(center)) {
return true;
}
if (NerospaceOxygen.pressureAt(level, center) >= 6) {
return true;
}
Comment on lines +99 to +103
private static TerraformOverlayState decode(List<Entry> entries) {
TerraformOverlayState state = new TerraformOverlayState();
entries.forEach(entry -> state.entries.put(entry.id(), entry));
return state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants