mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Remove Java identity wording from spawn hook
This commit is contained in:
1 parent
d4bb9a2598
commit
96e0000c86
4 files changed
+11
-22
No files matched your search
@@ -5111,8 +5111,8 @@ impl Game<'_> {
|
||||
|
||||
/// Possible natural spawns at a server position (NeoForge's
|
||||
/// `LevelEvent.PotentialSpawns`, `NaturalSpawner.mobsAt`). Mods may add or
|
||||
/// remove entries, or cancel to make the list empty. Added entries must
|
||||
/// be globally unique instances. @API:native_potential_spawns@.
|
||||
/// remove entries, or cancel to make the list empty.
|
||||
/// @API:native_potential_spawns@.
|
||||
pub(super) fn native_potential_spawns(
|
||||
&self,
|
||||
dimension: &str,
|
||||
|
||||
+2
-2
@@ -4510,8 +4510,8 @@ pub trait Hooks: Send + Sync {
|
||||
}
|
||||
/// Possible natural spawns at a server position (NeoForge's
|
||||
/// `LevelEvent.PotentialSpawns`, `NaturalSpawner.mobsAt`). Mods may add or
|
||||
/// remove entries, or cancel to make the list empty. Added entries must
|
||||
/// be globally unique instances. @API:native_potential_spawns@.
|
||||
/// remove entries, or cancel to make the list empty.
|
||||
/// @API:native_potential_spawns@.
|
||||
///
|
||||
/// Return `Flow::Cancel` to take it: this sets `canceled`, and later mods are skipped.
|
||||
fn potential_spawns(&self, host: &dyn Host, event: &mut PotentialSpawnsEvent<'_>) -> Flow {
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
}
|
||||
],
|
||||
"rust_summary": "Possible natural spawn entries, mutable and cancellable (`native_potential_spawns`).",
|
||||
"doc_summary": "`native_potential_spawns(dimension, category, pos, entries, canceled)`, run on the server when natural spawning builds its possible spawn list (NeoForge's `LevelEvent.PotentialSpawns`, vanilla's `NaturalSpawner.mobsAt`). Mods may add or remove entries; canceling empties the list. Added entries must be globally unique instances. Bundles need \"hooks\": @API:native_potential_spawns@."
|
||||
"doc_summary": "`native_potential_spawns(dimension, category, pos, entries, canceled)`, run on the server when natural spawning builds its possible spawn list (NeoForge's `LevelEvent.PotentialSpawns`, vanilla's `NaturalSpawner.mobsAt`). Mods may add or remove entries; canceling empties the list. Bundles need \"hooks\": @API:native_potential_spawns@."
|
||||
}
|
||||
+6
-17
@@ -1672,27 +1672,16 @@ mod tests {
|
||||
"native_item_damaged: the let _ = (…); placeholder needs its dispatch call; run cargo run -p xtask -- mod-api"
|
||||
);
|
||||
assert_eq!(std::fs::read_to_string(&hooks).unwrap(), placeholder);
|
||||
let catalog = root.join("native-hooks.json");
|
||||
let shipped_catalog = std::fs::read_to_string(&catalog).unwrap();
|
||||
let mut json: Value = serde_json::from_str(&shipped_catalog).unwrap();
|
||||
let hook = json["hooks"]
|
||||
.as_array_mut()
|
||||
.unwrap()
|
||||
.iter_mut()
|
||||
.find(|hook| {
|
||||
hook["target"]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.ends_with("::native_item_damaged")
|
||||
})
|
||||
.unwrap();
|
||||
hook.as_object_mut().unwrap().remove("mod_api");
|
||||
std::fs::write(&catalog, json.to_string()).unwrap();
|
||||
let fragment = root.join("tools/native-hook-fragments/native_item_damaged.json");
|
||||
let shipped_fragment = std::fs::read_to_string(&fragment).unwrap();
|
||||
let mut json: Value = serde_json::from_str(&shipped_fragment).unwrap();
|
||||
json["hooks"][0].as_object_mut().unwrap().remove("mod_api");
|
||||
std::fs::write(&fragment, json.to_string()).unwrap();
|
||||
assert_eq!(
|
||||
super::generate(&root, false).unwrap_err(),
|
||||
"hook item_damaged has no mod_api entry: add one"
|
||||
);
|
||||
std::fs::write(&catalog, shipped_catalog).unwrap();
|
||||
std::fs::write(&fragment, shipped_fragment).unwrap();
|
||||
super::generate(&root, false).unwrap();
|
||||
// The generator writes LF; a Windows checkout (core.autocrlf) has CRLF.
|
||||
let lf = |s: &str| s.replace("\r\n", "\n");
|
||||
|
||||
Reference in new issue
Block a user