Format and lint the command parity changes
Clippy and rustfmt clean, and the scoreboard test now expects vanilla's removeObjective, which keeps holders tracked without scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,11 @@ impl Registries {
|
||||
pub fn fill_from_export(&mut self, r: &serde_json::Value) {
|
||||
fn strings(v: &serde_json::Value) -> Vec<String> {
|
||||
v.as_array()
|
||||
.map(|a| a.iter().filter_map(|x| x.as_str().map(str::to_owned)).collect())
|
||||
.map(|a| {
|
||||
a.iter()
|
||||
.filter_map(|x| x.as_str().map(str::to_owned))
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
let fill = |field: &mut Vec<String>, key: &str| {
|
||||
@@ -135,12 +139,14 @@ impl Registries {
|
||||
}
|
||||
if self.clock_time_markers.is_empty() {
|
||||
for (clock, markers) in r["clock_time_markers"].as_object().into_iter().flatten() {
|
||||
self.clock_time_markers.insert(clock.clone(), strings(markers));
|
||||
self.clock_time_markers
|
||||
.insert(clock.clone(), strings(markers));
|
||||
}
|
||||
}
|
||||
if self.advancement_criteria.is_empty() {
|
||||
for (id, criteria) in r["advancement_criteria"].as_object().into_iter().flatten() {
|
||||
self.advancement_criteria.insert(id.clone(), strings(criteria));
|
||||
self.advancement_criteria
|
||||
.insert(id.clone(), strings(criteria));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +359,9 @@ pub fn select_resources<'a>(ids: &'a [String], pattern: &str) -> Vec<&'a String>
|
||||
} else {
|
||||
format!("minecraft:{pattern}")
|
||||
};
|
||||
ids.iter().filter(|id| wildcard_match(id, &pattern)).collect()
|
||||
ids.iter()
|
||||
.filter(|id| wildcard_match(id, &pattern))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// SlotRanges.SLOTS: every slot range name and its size, in vanilla order.
|
||||
|
||||
@@ -150,7 +150,9 @@ pub fn decode(registry: &str, t: &Tag, reg: &Registries) -> Result<(), String> {
|
||||
"minecraft:dialog_list" => &["dialogs"],
|
||||
_ => &[],
|
||||
};
|
||||
let keys: Vec<&str> = std::iter::once("title").chain(own.iter().copied()).collect();
|
||||
let keys: Vec<&str> = std::iter::once("title")
|
||||
.chain(own.iter().copied())
|
||||
.collect();
|
||||
require(map, t, &keys)
|
||||
}),
|
||||
"minecraft:worldgen/feature" | "minecraft:loot_table" => match t {
|
||||
|
||||
@@ -4,32 +4,231 @@
|
||||
//! tools/generate_command_order.py; do not edit by hand.
|
||||
|
||||
pub const ORDER: &[(&str, &[&str])] = &[
|
||||
("", &["advancement", "attribute", "execute", "bossbar", "clear", "clone", "compute", "damage", "data", "datapack", "debug", "defaultgamemode", "dialog", "difficulty", "effect", "me", "enchant", "experience", "xp", "fill", "fillbiome", "forceload", "function", "gamemode", "gamerule", "give", "help", "item", "kick", "kill", "list", "locate", "loot", "msg", "tell", "w", "swing", "particle", "place", "playsound", "posteffect", "random", "reload", "recipe", "fetchprofile", "return", "ride", "rotate", "say", "schedule", "scoreboard", "seed", "version", "setblock", "spawnpoint", "setworldspawn", "spectate", "spreadplayers", "stopsound", "stopwatch", "summon", "tag", "team", "teammsg", "tm", "teleport", "tp", "tellraw", "test", "tick", "time", "title", "trigger", "waypoint", "weather", "worldborder", "jfr", "publish", "unpublish"]),
|
||||
("execute", &["run", "if", "unless", "as", "at", "store", "positioned", "rotated", "facing", "align", "anchored", "in", "summon", "on"]),
|
||||
("execute if", &["block", "biome", "loaded", "dimension", "score", "blocks", "entity", "predicate", "function", "stopwatch", "data", "items", "slots"]),
|
||||
("execute unless", &["block", "biome", "loaded", "dimension", "score", "blocks", "entity", "predicate", "function", "stopwatch", "data", "items", "slots"]),
|
||||
(
|
||||
"",
|
||||
&[
|
||||
"advancement",
|
||||
"attribute",
|
||||
"execute",
|
||||
"bossbar",
|
||||
"clear",
|
||||
"clone",
|
||||
"compute",
|
||||
"damage",
|
||||
"data",
|
||||
"datapack",
|
||||
"debug",
|
||||
"defaultgamemode",
|
||||
"dialog",
|
||||
"difficulty",
|
||||
"effect",
|
||||
"me",
|
||||
"enchant",
|
||||
"experience",
|
||||
"xp",
|
||||
"fill",
|
||||
"fillbiome",
|
||||
"forceload",
|
||||
"function",
|
||||
"gamemode",
|
||||
"gamerule",
|
||||
"give",
|
||||
"help",
|
||||
"item",
|
||||
"kick",
|
||||
"kill",
|
||||
"list",
|
||||
"locate",
|
||||
"loot",
|
||||
"msg",
|
||||
"tell",
|
||||
"w",
|
||||
"swing",
|
||||
"particle",
|
||||
"place",
|
||||
"playsound",
|
||||
"posteffect",
|
||||
"random",
|
||||
"reload",
|
||||
"recipe",
|
||||
"fetchprofile",
|
||||
"return",
|
||||
"ride",
|
||||
"rotate",
|
||||
"say",
|
||||
"schedule",
|
||||
"scoreboard",
|
||||
"seed",
|
||||
"version",
|
||||
"setblock",
|
||||
"spawnpoint",
|
||||
"setworldspawn",
|
||||
"spectate",
|
||||
"spreadplayers",
|
||||
"stopsound",
|
||||
"stopwatch",
|
||||
"summon",
|
||||
"tag",
|
||||
"team",
|
||||
"teammsg",
|
||||
"tm",
|
||||
"teleport",
|
||||
"tp",
|
||||
"tellraw",
|
||||
"test",
|
||||
"tick",
|
||||
"time",
|
||||
"title",
|
||||
"trigger",
|
||||
"waypoint",
|
||||
"weather",
|
||||
"worldborder",
|
||||
"jfr",
|
||||
"publish",
|
||||
"unpublish",
|
||||
],
|
||||
),
|
||||
(
|
||||
"execute",
|
||||
&[
|
||||
"run",
|
||||
"if",
|
||||
"unless",
|
||||
"as",
|
||||
"at",
|
||||
"store",
|
||||
"positioned",
|
||||
"rotated",
|
||||
"facing",
|
||||
"align",
|
||||
"anchored",
|
||||
"in",
|
||||
"summon",
|
||||
"on",
|
||||
],
|
||||
),
|
||||
(
|
||||
"execute if",
|
||||
&[
|
||||
"block",
|
||||
"biome",
|
||||
"loaded",
|
||||
"dimension",
|
||||
"score",
|
||||
"blocks",
|
||||
"entity",
|
||||
"predicate",
|
||||
"function",
|
||||
"stopwatch",
|
||||
"data",
|
||||
"items",
|
||||
"slots",
|
||||
],
|
||||
),
|
||||
(
|
||||
"execute unless",
|
||||
&[
|
||||
"block",
|
||||
"biome",
|
||||
"loaded",
|
||||
"dimension",
|
||||
"score",
|
||||
"blocks",
|
||||
"entity",
|
||||
"predicate",
|
||||
"function",
|
||||
"stopwatch",
|
||||
"data",
|
||||
"items",
|
||||
"slots",
|
||||
],
|
||||
),
|
||||
("execute facing", &["entity", "pos"]),
|
||||
("datapack", &["enable", "disable", "list", "create"]),
|
||||
("datapack enable name", &["after", "before", "last", "first"]),
|
||||
(
|
||||
"datapack enable name",
|
||||
&["after", "before", "last", "first"],
|
||||
),
|
||||
("item", &["replace", "fill", "override", "modify"]),
|
||||
("item replace entity target slots", &["from", "with"]),
|
||||
("item fill entity target slots", &["from", "with"]),
|
||||
("item override entity target slots", &["from", "with"]),
|
||||
("loot replace entity entities slot", &["fish", "loot", "kill", "mine", "count"]),
|
||||
("loot replace entity entities slot fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace entity entities slot mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace entity entities slot count fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace entity entities slot count mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace block targetPos slot", &["fish", "loot", "kill", "mine", "count"]),
|
||||
("loot replace block targetPos slot fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace block targetPos slot mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace block targetPos slot count fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot replace block targetPos slot count mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot insert targetPos fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot insert targetPos mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot give players fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot give players mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot spawn targetPos fish loot_table pos", &["tool", "mainhand", "offhand"]),
|
||||
("loot spawn targetPos mine pos", &["tool", "mainhand", "offhand"]),
|
||||
("scoreboard players", &["list", "set", "get", "add", "remove", "reset", "enable", "display", "operation"]),
|
||||
(
|
||||
"loot replace entity entities slot",
|
||||
&["fish", "loot", "kill", "mine", "count"],
|
||||
),
|
||||
(
|
||||
"loot replace entity entities slot fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace entity entities slot mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace entity entities slot count fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace entity entities slot count mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace block targetPos slot",
|
||||
&["fish", "loot", "kill", "mine", "count"],
|
||||
),
|
||||
(
|
||||
"loot replace block targetPos slot fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace block targetPos slot mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace block targetPos slot count fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot replace block targetPos slot count mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot insert targetPos fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot insert targetPos mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot give players fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot give players mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot spawn targetPos fish loot_table pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"loot spawn targetPos mine pos",
|
||||
&["tool", "mainhand", "offhand"],
|
||||
),
|
||||
(
|
||||
"scoreboard players",
|
||||
&[
|
||||
"list",
|
||||
"set",
|
||||
"get",
|
||||
"add",
|
||||
"remove",
|
||||
"reset",
|
||||
"enable",
|
||||
"display",
|
||||
"operation",
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
@@ -208,7 +208,11 @@ pub fn to_text_with(
|
||||
let args: Vec<Text> = o
|
||||
.get("with")
|
||||
.and_then(Value::as_array)
|
||||
.map(|a| a.iter().map(|x| to_text_with(x, resolve, contents)).collect())
|
||||
.map(|a| {
|
||||
a.iter()
|
||||
.map(|x| to_text_with(x, resolve, contents))
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let translated = Text::translate(key, &args);
|
||||
match o.get("fallback").and_then(Value::as_str) {
|
||||
|
||||
@@ -127,7 +127,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn hash_and_order() {
|
||||
assert_eq!(java_hash("harness"), "harness".chars().fold(0i32, |h, c| h.wrapping_mul(31).wrapping_add(c as i32)));
|
||||
assert_eq!(
|
||||
java_hash("harness"),
|
||||
"harness"
|
||||
.chars()
|
||||
.fold(0i32, |h, c| h.wrapping_mul(31).wrapping_add(c as i32))
|
||||
);
|
||||
let mut o = OpenOrder::new(16, 0.5);
|
||||
for k in ["harness", "harness_h"] {
|
||||
o.insert(k);
|
||||
|
||||
@@ -54,7 +54,7 @@ impl Game<'_> {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
if std::env::var_os("HORIZON_HARNESS_DEBUG").is_some() && self.ticks % 1 == 0 {
|
||||
if std::env::var_os("HORIZON_HARNESS_DEBUG").is_some() {
|
||||
eprintln!(
|
||||
"settle: player {:?} center {:?} chunks {} pending {}",
|
||||
self.player.as_ref().map(|p| p.position),
|
||||
@@ -70,7 +70,13 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
pub(super) fn run_command_harness(&mut self, script: &Path, output: &Path) -> Result<()> {
|
||||
let deadline = Instant::now() + Duration::from_secs(std::env::var("HORIZON_HARNESS_TIMEOUT").ok().and_then(|v| v.parse().ok()).unwrap_or(600));
|
||||
let deadline = Instant::now()
|
||||
+ Duration::from_secs(
|
||||
std::env::var("HORIZON_HARNESS_TIMEOUT")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(600),
|
||||
);
|
||||
self.harness_settle(deadline)?;
|
||||
let mut out = String::new();
|
||||
for line in std::fs::read_to_string(script)?.lines() {
|
||||
|
||||
@@ -2145,7 +2145,9 @@ impl Game<'_> {
|
||||
match &v {
|
||||
horizon_world::nbt::Tag::Compound(_) => {
|
||||
let get = |k: &str| match v.get(k) {
|
||||
Some(horizon_world::nbt::Tag::Int(i)) => Some(i64::from(*i)),
|
||||
Some(horizon_world::nbt::Tag::Int(i)) => {
|
||||
Some(i64::from(*i))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
get("min").is_none_or(|m| n >= m)
|
||||
@@ -2155,8 +2157,9 @@ impl Game<'_> {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
(_, Some(v)) => present
|
||||
.is_some_and(|have| horizon_client::nbt_path::compare_nbt(&v, Some(have))),
|
||||
(_, Some(v)) => present.is_some_and(|have| {
|
||||
horizon_client::nbt_path::compare_nbt(&v, Some(have))
|
||||
}),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -2198,7 +2201,10 @@ impl Game<'_> {
|
||||
};
|
||||
let matching: Vec<bool> = all(self)
|
||||
.iter()
|
||||
.map(|s| s.as_ref().is_some_and(|s| self.stack_matches(&predicate, s)))
|
||||
.map(|s| {
|
||||
s.as_ref()
|
||||
.is_some_and(|s| self.stack_matches(&predicate, s))
|
||||
})
|
||||
.collect();
|
||||
let mut slots: Vec<&mut Option<ItemStack>> = Vec::new();
|
||||
slots.extend(self.inventory.iter_mut());
|
||||
@@ -2311,9 +2317,9 @@ impl Game<'_> {
|
||||
cache
|
||||
.entry(state)
|
||||
.or_insert_with(|| {
|
||||
self.poi_type(horizon_world::registry::BlockStateId(
|
||||
u32::from(state),
|
||||
))
|
||||
self.poi_type(horizon_world::registry::BlockStateId(u32::from(
|
||||
state,
|
||||
)))
|
||||
.filter(|t| wanted.iter().any(|w| w == t))
|
||||
})
|
||||
.is_some()
|
||||
|
||||
@@ -115,7 +115,7 @@ impl Game<'_> {
|
||||
Some(Arg::Float(s)) => *s,
|
||||
_ => 1.0,
|
||||
};
|
||||
let original = self.provider_float(&provider, &c, 0).map_err(&invalid)?;
|
||||
let original = self.provider_float(&provider, &c, 0).map_err(invalid)?;
|
||||
if !original.is_finite() {
|
||||
return Err(invalid(java_float(original)));
|
||||
}
|
||||
@@ -128,7 +128,11 @@ impl Game<'_> {
|
||||
let message = match &id {
|
||||
Some(id) => Text::translate(
|
||||
"command.compute.result.named.rounded",
|
||||
&[Text::literal(id.clone()), original_text, Text::literal(result.to_string())],
|
||||
&[
|
||||
Text::literal(id.clone()),
|
||||
original_text,
|
||||
Text::literal(result.to_string()),
|
||||
],
|
||||
),
|
||||
None => Text::translate(
|
||||
"command.compute.result.unnamed.rounded",
|
||||
@@ -154,7 +158,9 @@ impl Game<'_> {
|
||||
}
|
||||
let d = depth + 1;
|
||||
match v {
|
||||
Value::Number(n) => Ok(n.as_i64().map_or_else(|| n.as_f64().unwrap_or(0.0) as i32, |i| i as i32)),
|
||||
Value::Number(n) => Ok(n
|
||||
.as_i64()
|
||||
.map_or_else(|| n.as_f64().unwrap_or(0.0) as i32, |i| i as i32)),
|
||||
Value::Bool(b) => Ok(i32::from(*b)),
|
||||
Value::String(id) => match self.provider_file("minecraft:context_int_provider", id) {
|
||||
Some(def) => self.provider_int(&def, c, d),
|
||||
@@ -183,7 +189,8 @@ impl Game<'_> {
|
||||
};
|
||||
let overflow = || "integer overflow".to_owned();
|
||||
let long_to_int = |v: i64| -> Result<i32, Arith> {
|
||||
i32::try_from(v).map_err(|_| format!("Value {v} can't be safely converted to int"))
|
||||
i32::try_from(v)
|
||||
.map_err(|_| format!("Value {v} can't be safely converted to int"))
|
||||
};
|
||||
Ok(match ty.as_str() {
|
||||
"constant" => field(self, "value")?,
|
||||
@@ -215,13 +222,14 @@ impl Game<'_> {
|
||||
match ty.as_str() {
|
||||
"div" => a.wrapping_div(b),
|
||||
"mod" => a.wrapping_rem(b),
|
||||
"floor_mod" => a.rem_euclid(b) + if b < 0 && a.rem_euclid(b) != 0 { b } else { 0 },
|
||||
"floor_mod" => {
|
||||
a.rem_euclid(b) + if b < 0 && a.rem_euclid(b) != 0 { b } else { 0 }
|
||||
}
|
||||
_ => {
|
||||
if a == i32::MIN && b == -1 {
|
||||
return Err(overflow());
|
||||
}
|
||||
a.div_euclid(b)
|
||||
- if b < 0 && a.rem_euclid(b) != 0 { 1 } else { 0 }
|
||||
a.div_euclid(b) - if b < 0 && a.rem_euclid(b) != 0 { 1 } else { 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -391,9 +399,15 @@ impl Game<'_> {
|
||||
o: &serde_json::Map<String, Value>,
|
||||
c: &ComputeContext,
|
||||
) -> Result<Option<Value>, Arith> {
|
||||
match o.get("type").and_then(Value::as_str).map(|t| t.trim_start_matches("minecraft:")) {
|
||||
match o
|
||||
.get("type")
|
||||
.and_then(Value::as_str)
|
||||
.map(|t| t.trim_start_matches("minecraft:"))
|
||||
{
|
||||
Some("conditional") => {
|
||||
let holds = o.get("condition").is_some_and(|x| self.compute_condition(x, c));
|
||||
let holds = o
|
||||
.get("condition")
|
||||
.is_some_and(|x| self.compute_condition(x, c));
|
||||
Ok(if holds {
|
||||
o.get("on_true").cloned()
|
||||
} else {
|
||||
@@ -401,8 +415,16 @@ impl Game<'_> {
|
||||
})
|
||||
}
|
||||
Some("number_dispatcher") => {
|
||||
for case in o.get("cases").and_then(Value::as_array).into_iter().flatten() {
|
||||
if case.get("condition").is_some_and(|x| self.compute_condition(x, c)) {
|
||||
for case in o
|
||||
.get("cases")
|
||||
.and_then(Value::as_array)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if case
|
||||
.get("condition")
|
||||
.is_some_and(|x| self.compute_condition(x, c))
|
||||
{
|
||||
return Ok(case.get("value").cloned());
|
||||
}
|
||||
}
|
||||
@@ -489,7 +511,9 @@ impl Game<'_> {
|
||||
}),
|
||||
None => *b == name,
|
||||
},
|
||||
Some(Value::Array(list)) => list.iter().any(|b| b.as_str() == Some(&name)),
|
||||
Some(Value::Array(list)) => {
|
||||
list.iter().any(|b| b.as_str() == Some(&name))
|
||||
}
|
||||
_ => true,
|
||||
};
|
||||
let props_ok = o
|
||||
@@ -498,9 +522,7 @@ impl Game<'_> {
|
||||
.and_then(Value::as_object)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.all(|(k, v)| {
|
||||
s.properties.get(k).map(String::as_str) == v.as_str()
|
||||
});
|
||||
.all(|(k, v)| s.properties.get(k).map(String::as_str) == v.as_str());
|
||||
blocks_ok && props_ok
|
||||
}
|
||||
"random_chance" => {
|
||||
|
||||
@@ -149,7 +149,10 @@ impl Game<'_> {
|
||||
match target {
|
||||
Some(t) => {
|
||||
let name = self.target_name(t);
|
||||
self.feedback(Text::translate("commands.spectate.success.started", &[name]));
|
||||
self.feedback(Text::translate(
|
||||
"commands.spectate.success.started",
|
||||
&[name],
|
||||
));
|
||||
}
|
||||
None => self.feedback(Text::translate("commands.spectate.success.stopped", &[])),
|
||||
}
|
||||
@@ -209,9 +212,7 @@ impl Game<'_> {
|
||||
}
|
||||
/// The eye height the camera follows (`Camera.tick`'s entity).
|
||||
pub(in crate::game) fn camera_eye_height(&self) -> Option<f32> {
|
||||
self.cmds
|
||||
.camera
|
||||
.map(|t| self.target_eye_height(t) as f32)
|
||||
self.cmds.camera.map(|t| self.target_eye_height(t) as f32)
|
||||
}
|
||||
|
||||
// ---- /waypoint ------------------------------------------------------
|
||||
@@ -279,7 +280,11 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
fn waypoint_icon(&self, t: Target) -> WaypointIcon {
|
||||
self.cmds.waypoint_icons.get(&t).cloned().unwrap_or_default()
|
||||
self.cmds
|
||||
.waypoint_icons
|
||||
.get(&t)
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
/// `WaypointArgument.getWaypoint`.
|
||||
fn waypoint_arg(&mut self, ctx: &Context) -> R<Target> {
|
||||
@@ -324,7 +329,12 @@ impl Game<'_> {
|
||||
};
|
||||
// getFeedbackDisplayName().copy().withStyle(color): the
|
||||
// waypoint colour replaces the team colour of the name.
|
||||
let name = match (*t, self.score.board.players_team(super::super::chat::PLAYER_NAME)) {
|
||||
let name = match (
|
||||
*t,
|
||||
self.score
|
||||
.board
|
||||
.players_team(super::super::chat::PLAYER_NAME),
|
||||
) {
|
||||
(Target::Player, Some(team)) => {
|
||||
let mut n = Text::empty();
|
||||
n.push(horizon_client::scoreboard::comp_text(&team.prefix));
|
||||
@@ -407,9 +417,15 @@ impl Game<'_> {
|
||||
self.close_dialog();
|
||||
}
|
||||
let (single, multiple) = if id == "dialog.show" {
|
||||
("commands.dialog.show.single", "commands.dialog.show.multiple")
|
||||
(
|
||||
"commands.dialog.show.single",
|
||||
"commands.dialog.show.multiple",
|
||||
)
|
||||
} else {
|
||||
("commands.dialog.clear.single", "commands.dialog.clear.multiple")
|
||||
(
|
||||
"commands.dialog.clear.single",
|
||||
"commands.dialog.clear.multiple",
|
||||
)
|
||||
};
|
||||
let message = if n == 1 {
|
||||
Text::translate(single, &[self.target_name(targets[0])])
|
||||
@@ -477,7 +493,9 @@ impl Game<'_> {
|
||||
"commands.posteffect.clear.success.single",
|
||||
&[self.target_name(changed[0])],
|
||||
),
|
||||
("clear", _) => Text::translate("commands.posteffect.clear.success.multiple", &[num(n)]),
|
||||
("clear", _) => {
|
||||
Text::translate("commands.posteffect.clear.success.multiple", &[num(n)])
|
||||
}
|
||||
(_, 1) => Text::translate(
|
||||
&format!("commands.posteffect.{key}.success.single"),
|
||||
&[effect_text, self.target_name(changed[0])],
|
||||
@@ -509,7 +527,11 @@ impl Game<'_> {
|
||||
}
|
||||
// reset*/clear*: TestCommand.reset throws CLEAR_NO_TESTS too.
|
||||
"test.clear" => {
|
||||
if ctx.literals.iter().any(|l| l == "resetthat" || l == "clearthat") {
|
||||
if ctx
|
||||
.literals
|
||||
.iter()
|
||||
.any(|l| l == "resetthat" || l == "clearthat")
|
||||
{
|
||||
self.source_player()?;
|
||||
}
|
||||
Err(err("commands.test.clear.error.no_tests", &[]))
|
||||
@@ -548,9 +570,20 @@ impl Game<'_> {
|
||||
p.position.y + f64::from(p.dimensions.eye_height),
|
||||
p.position.z,
|
||||
);
|
||||
let (yaw, pitch) = (f64::from(self.yaw).to_radians(), f64::from(self.pitch).to_radians());
|
||||
let dir = [-yaw.sin() * pitch.cos(), -pitch.sin(), yaw.cos() * pitch.cos()];
|
||||
let end = Vec3::new(eye.x + dir[0] * 10.0, eye.y + dir[1] * 10.0, eye.z + dir[2] * 10.0);
|
||||
let (yaw, pitch) = (
|
||||
f64::from(self.yaw).to_radians(),
|
||||
f64::from(self.pitch).to_radians(),
|
||||
);
|
||||
let dir = [
|
||||
-yaw.sin() * pitch.cos(),
|
||||
-pitch.sin(),
|
||||
yaw.cos() * pitch.cos(),
|
||||
];
|
||||
let end = Vec3::new(
|
||||
eye.x + dir[0] * 10.0,
|
||||
eye.y + dir[1] * 10.0,
|
||||
eye.z + dir[2] * 10.0,
|
||||
);
|
||||
let hit = traverse_blocks(eye, end, 256, |b: BlockPos| {
|
||||
let state = self.world.block(b.x, b.y, b.z);
|
||||
(!self.res.facts.is_air(state)).then_some([b.x, b.y, b.z])
|
||||
@@ -687,10 +720,16 @@ impl Game<'_> {
|
||||
clickable.push(item(
|
||||
"commands.fetchprofile.summon_mannequin",
|
||||
&[],
|
||||
Some(format!("summon minecraft:mannequin ~ ~ ~ {{profile:{profile}}}")),
|
||||
Some(format!(
|
||||
"summon minecraft:mannequin ~ ~ ~ {{profile:{profile}}}"
|
||||
)),
|
||||
));
|
||||
clickable.push(" ");
|
||||
clickable.push(item("commands.fetchprofile.copy_text", &[placeholder], None));
|
||||
clickable.push(item(
|
||||
"commands.fetchprofile.copy_text",
|
||||
&[placeholder],
|
||||
None,
|
||||
));
|
||||
let _ = head;
|
||||
self.feedback(Text::translate(
|
||||
"commands.fetchprofile.entity.success",
|
||||
@@ -837,7 +876,11 @@ impl Game<'_> {
|
||||
let message = if traced.len() == 1 {
|
||||
Text::translate(
|
||||
"commands.debug.function.success.single",
|
||||
&[num(total), Text::literal(traced[0].clone()), Text::literal(output)],
|
||||
&[
|
||||
num(total),
|
||||
Text::literal(traced[0].clone()),
|
||||
Text::literal(output),
|
||||
],
|
||||
)
|
||||
} else {
|
||||
Text::translate(
|
||||
@@ -898,7 +941,10 @@ impl Game<'_> {
|
||||
.map_or(Ok(()), std::fs::create_dir_all)
|
||||
.and_then(|()| std::fs::write(&path, report.to_string()));
|
||||
if let Err(e) = written {
|
||||
return Err(tr_error("commands.jfr.dump.failed", &[Text::literal(e.to_string())]));
|
||||
return Err(tr_error(
|
||||
"commands.jfr.dump.failed",
|
||||
&[Text::literal(e.to_string())],
|
||||
));
|
||||
}
|
||||
let file = Text::literal(relative).underlined().with_style(&Style {
|
||||
hover: Some(Box::new(Text::translate("chat.copy.click", &[]))),
|
||||
@@ -926,8 +972,14 @@ impl Game<'_> {
|
||||
"commands.version.protocol",
|
||||
vec![num(protocol), Text::literal(format!("0x{protocol:x}"))],
|
||||
),
|
||||
("commands.version.build_time", vec![Text::literal(BUILD_TIME)]),
|
||||
("commands.version.pack.resource", vec![Text::literal("97.1")]),
|
||||
(
|
||||
"commands.version.build_time",
|
||||
vec![Text::literal(BUILD_TIME)],
|
||||
),
|
||||
(
|
||||
"commands.version.pack.resource",
|
||||
vec![Text::literal("97.1")],
|
||||
),
|
||||
("commands.version.pack.data", vec![Text::literal("121.0")]),
|
||||
] {
|
||||
send(self, Text::translate(key, &args));
|
||||
@@ -973,6 +1025,13 @@ impl Game<'_> {
|
||||
},
|
||||
);
|
||||
let h = format!("{id:032x}");
|
||||
format!("{}-{}-{}-{}-{}", &h[..8], &h[8..12], &h[12..16], &h[16..20], &h[20..])
|
||||
format!(
|
||||
"{}-{}-{}-{}-{}",
|
||||
&h[..8],
|
||||
&h[8..12],
|
||||
&h[12..16],
|
||||
&h[16..20],
|
||||
&h[20..]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,8 +353,7 @@ impl Game<'_> {
|
||||
Value::Object(_) => {
|
||||
let mut stack = stack?;
|
||||
// 26.3 item modifiers: a single `condition`, dispatched on `type`.
|
||||
if !m["condition"].is_null()
|
||||
&& !self.conditions_hold(&m["condition"], this, origin)
|
||||
if !m["condition"].is_null() && !self.conditions_hold(&m["condition"], this, origin)
|
||||
{
|
||||
return Some(stack);
|
||||
}
|
||||
@@ -464,7 +463,7 @@ impl Game<'_> {
|
||||
Some(Tag::List(l)) => l.clone(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
let new = list_operation(&m, old, lines);
|
||||
let new = list_operation(m, old, lines);
|
||||
c.insert("minecraft:lore".into(), Tag::List(new));
|
||||
});
|
||||
}
|
||||
@@ -549,7 +548,10 @@ impl Game<'_> {
|
||||
display.push((
|
||||
"hidden_components",
|
||||
Tag::List(
|
||||
hidden.iter().map(|h| Tag::String(h.as_str().into())).collect(),
|
||||
hidden
|
||||
.iter()
|
||||
.map(|h| Tag::String(h.as_str().into()))
|
||||
.collect(),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -151,7 +151,10 @@ impl Game<'_> {
|
||||
return Ok(0);
|
||||
};
|
||||
// BlockPosArgument.getLoadedBlockPos on both corners first.
|
||||
let (a, b) = (self.block_pos_arg(ctx, "from")?, self.block_pos_arg(ctx, "to")?);
|
||||
let (a, b) = (
|
||||
self.block_pos_arg(ctx, "from")?,
|
||||
self.block_pos_arg(ctx, "to")?,
|
||||
);
|
||||
// Quantize to biome cells (`QuartPos`), then work with the box.
|
||||
let q = |v: i32| (v >> 2) << 2;
|
||||
let lo = [
|
||||
@@ -486,7 +489,9 @@ impl Game<'_> {
|
||||
let drops = match self.res.items.loot_random_sequence(&table) {
|
||||
Some(seq) => {
|
||||
let random = self.rand_sequences.get(&seq, self.level.seed);
|
||||
self.res.items.loot_table(&table, false, held.as_ref(), random)
|
||||
self.res
|
||||
.items
|
||||
.loot_table(&table, false, held.as_ref(), random)
|
||||
}
|
||||
None => self.res.items.loot_table(
|
||||
&table,
|
||||
|
||||
@@ -20,7 +20,10 @@ impl Game<'_> {
|
||||
nbt_values.borrow_mut().push(o.clone());
|
||||
}
|
||||
};
|
||||
fn walk(v: &serde_json::Value, f: &mut dyn FnMut(&serde_json::Map<String, serde_json::Value>)) {
|
||||
fn walk(
|
||||
v: &serde_json::Value,
|
||||
f: &mut dyn FnMut(&serde_json::Map<String, serde_json::Value>),
|
||||
) {
|
||||
match v {
|
||||
serde_json::Value::Object(o) => {
|
||||
f(o);
|
||||
@@ -119,7 +122,9 @@ impl Game<'_> {
|
||||
}
|
||||
first = false;
|
||||
let piece = if interpret {
|
||||
horizon_client::scoreboard::comp_text(&horizon_client::scoreboard::tag_to_json(&tag))
|
||||
horizon_client::scoreboard::comp_text(&horizon_client::scoreboard::tag_to_json(
|
||||
&tag,
|
||||
))
|
||||
} else if plain {
|
||||
Text::literal(horizon_client::snbt::pretty(&tag).plain())
|
||||
} else {
|
||||
|
||||
@@ -54,7 +54,10 @@ impl Game<'_> {
|
||||
let n = n.as_i64().unwrap_or(1);
|
||||
(n, n)
|
||||
}
|
||||
b => (b["min"].as_i64().unwrap_or(1), b["max"].as_i64().unwrap_or(8)),
|
||||
b => (
|
||||
b["min"].as_i64().unwrap_or(1),
|
||||
b["max"].as_i64().unwrap_or(8),
|
||||
),
|
||||
};
|
||||
(max - min + 1).max(0) as i32
|
||||
}
|
||||
@@ -690,7 +693,14 @@ impl Game<'_> {
|
||||
.has_modifier(Some(key), &modifier_id)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Err(text_error("commands.attribute.failed.modifier_already_present", &[Text::literal(modifier_id.clone()), description.clone(), name.clone()]));
|
||||
return Err(text_error(
|
||||
"commands.attribute.failed.modifier_already_present",
|
||||
&[
|
||||
Text::literal(modifier_id.clone()),
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
],
|
||||
));
|
||||
}
|
||||
let op = ctx
|
||||
.literals
|
||||
@@ -712,7 +722,14 @@ impl Game<'_> {
|
||||
.has_modifier(Some(key), &modifier_id)
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Err(text_error("commands.attribute.failed.no_modifier", &[description.clone(), name.clone(), Text::literal(modifier_id.clone())]));
|
||||
return Err(text_error(
|
||||
"commands.attribute.failed.no_modifier",
|
||||
&[
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
Text::literal(modifier_id.clone()),
|
||||
],
|
||||
));
|
||||
}
|
||||
let _ =
|
||||
player.set_modifier(&attribute, &modifier_id, 0.0, "add_value", false);
|
||||
@@ -739,7 +756,14 @@ impl Game<'_> {
|
||||
.ok()
|
||||
.flatten();
|
||||
let Some(v) = found else {
|
||||
return Err(text_error("commands.attribute.failed.no_modifier", &[description.clone(), name.clone(), Text::literal(modifier_id.clone())]));
|
||||
return Err(text_error(
|
||||
"commands.attribute.failed.no_modifier",
|
||||
&[
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
Text::literal(modifier_id.clone()),
|
||||
],
|
||||
));
|
||||
};
|
||||
self.feedback(Text::translate(
|
||||
"commands.attribute.modifier.value.get.success",
|
||||
@@ -833,10 +857,20 @@ impl Game<'_> {
|
||||
));
|
||||
Ok(1)
|
||||
}
|
||||
_ => Err(text_error("commands.attribute.failed.no_modifier", &[description.clone(), name.clone(), Text::literal(modifier_id.clone())])),
|
||||
_ => Err(text_error(
|
||||
"commands.attribute.failed.no_modifier",
|
||||
&[
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
Text::literal(modifier_id.clone()),
|
||||
],
|
||||
)),
|
||||
}
|
||||
}
|
||||
_ => Err(text_error("commands.attribute.failed.entity", &[name.clone()])),
|
||||
_ => Err(text_error(
|
||||
"commands.attribute.failed.entity",
|
||||
std::slice::from_ref(&name),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,7 +906,11 @@ impl Game<'_> {
|
||||
let no_modifier = || {
|
||||
text_error(
|
||||
"commands.attribute.failed.no_modifier",
|
||||
&[description.clone(), name.clone(), Text::literal(modifier_id)],
|
||||
&[
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
Text::literal(modifier_id),
|
||||
],
|
||||
)
|
||||
};
|
||||
let catalog = self.motion.attributes.clone();
|
||||
@@ -893,7 +931,11 @@ impl Game<'_> {
|
||||
} else {
|
||||
"commands.attribute.base_value.get.success"
|
||||
};
|
||||
(k, vec![description.clone(), name.clone(), java_double_text(v)], (v * scale) as i32)
|
||||
(
|
||||
k,
|
||||
vec![description.clone(), name.clone(), java_double_text(v)],
|
||||
(v * scale) as i32,
|
||||
)
|
||||
}
|
||||
"attribute.base.set" => {
|
||||
map.edit(key, |a, o| {
|
||||
@@ -901,7 +943,11 @@ impl Game<'_> {
|
||||
});
|
||||
(
|
||||
"commands.attribute.base_value.set.success",
|
||||
vec![description.clone(), name.clone(), java_double_text(value_arg)],
|
||||
vec![
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
java_double_text(value_arg),
|
||||
],
|
||||
1,
|
||||
)
|
||||
}
|
||||
@@ -918,7 +964,11 @@ impl Game<'_> {
|
||||
if map.has_modifier(key, modifier_id) {
|
||||
return Err(text_error(
|
||||
"commands.attribute.failed.modifier_already_present",
|
||||
&[Text::literal(modifier_id), description.clone(), name.clone()],
|
||||
&[
|
||||
Text::literal(modifier_id),
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
],
|
||||
));
|
||||
}
|
||||
let operation = match op {
|
||||
@@ -926,14 +976,18 @@ impl Game<'_> {
|
||||
"add_multiplied_total" => Operation::AddMultipliedTotal,
|
||||
_ => Operation::AddValue,
|
||||
};
|
||||
let m = Modifier::new(modifier_id, value_arg, operation)
|
||||
.map_err(|_| no_attribute())?;
|
||||
let m =
|
||||
Modifier::new(modifier_id, value_arg, operation).map_err(|_| no_attribute())?;
|
||||
map.edit(key, |a, o| {
|
||||
let _ = a.add_permanent(m, o);
|
||||
});
|
||||
(
|
||||
"commands.attribute.modifier.add.success",
|
||||
vec![Text::literal(modifier_id), description.clone(), name.clone()],
|
||||
vec![
|
||||
Text::literal(modifier_id),
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
],
|
||||
1,
|
||||
)
|
||||
}
|
||||
@@ -946,7 +1000,11 @@ impl Game<'_> {
|
||||
});
|
||||
(
|
||||
"commands.attribute.modifier.remove.success",
|
||||
vec![Text::literal(modifier_id), description.clone(), name.clone()],
|
||||
vec![
|
||||
Text::literal(modifier_id),
|
||||
description.clone(),
|
||||
name.clone(),
|
||||
],
|
||||
1,
|
||||
)
|
||||
}
|
||||
@@ -1145,8 +1203,20 @@ impl Game<'_> {
|
||||
}
|
||||
let p = &mut points[i];
|
||||
let before = *p;
|
||||
p[0] = if p[0] < min_x { min_x } else if p[0] > max_x { max_x } else { p[0] };
|
||||
p[1] = if p[1] < min_z { min_z } else if p[1] > max_z { max_z } else { p[1] };
|
||||
p[0] = if p[0] < min_x {
|
||||
min_x
|
||||
} else if p[0] > max_x {
|
||||
max_x
|
||||
} else {
|
||||
p[0]
|
||||
};
|
||||
p[1] = if p[1] < min_z {
|
||||
min_z
|
||||
} else if p[1] > max_z {
|
||||
max_z
|
||||
} else {
|
||||
p[1]
|
||||
};
|
||||
if before != *p {
|
||||
collisions = true;
|
||||
}
|
||||
@@ -1273,7 +1343,12 @@ impl Game<'_> {
|
||||
.items
|
||||
.block_tags
|
||||
.get("entities_can_teleport_to")
|
||||
.or_else(|| self.res.items.block_tags.get("minecraft:entities_can_teleport_to"))
|
||||
.or_else(|| {
|
||||
self.res
|
||||
.items
|
||||
.block_tags
|
||||
.get("minecraft:entities_can_teleport_to")
|
||||
})
|
||||
.is_some_and(|set| {
|
||||
set.contains(&*name) || set.contains(name.trim_start_matches("minecraft:"))
|
||||
});
|
||||
|
||||
@@ -638,7 +638,10 @@ impl Game<'_> {
|
||||
return Err(err("commands.datapack.enable.failed", &[&name]));
|
||||
}
|
||||
if let Some((_, flag)) = FEATURE_PACKS.iter().find(|(p, _)| *p == name) {
|
||||
return Err(err("commands.datapack.enable.failed.no_flags", &[&name, flag]));
|
||||
return Err(err(
|
||||
"commands.datapack.enable.failed.no_flags",
|
||||
&[&name, flag],
|
||||
));
|
||||
}
|
||||
if name == "vanilla" {
|
||||
self.cmds.vanilla_disabled = false;
|
||||
|
||||
@@ -535,7 +535,11 @@ impl Items {
|
||||
.map(str::to_owned)
|
||||
}
|
||||
/// `LootTable.getRandomItems` of an inline table.
|
||||
pub fn inline_loot_table<R: RandomSource>(&self, table: &Value, random: &mut R) -> Vec<ItemStack> {
|
||||
pub fn inline_loot_table<R: RandomSource>(
|
||||
&self,
|
||||
table: &Value,
|
||||
random: &mut R,
|
||||
) -> Vec<ItemStack> {
|
||||
let empty = BTreeMap::new();
|
||||
let ctx = LootContext {
|
||||
items: self,
|
||||
@@ -921,7 +925,12 @@ impl LootContext<'_> {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn choose<R: RandomSource>(&self, entries: &[Value], random: &mut R, produced: &mut Vec<ItemStack>) {
|
||||
fn choose<R: RandomSource>(
|
||||
&self,
|
||||
entries: &[Value],
|
||||
random: &mut R,
|
||||
produced: &mut Vec<ItemStack>,
|
||||
) {
|
||||
let mut candidates = Vec::new();
|
||||
for e in entries {
|
||||
self.expand(e, random, &mut candidates);
|
||||
|
||||
@@ -37,8 +37,8 @@ pub mod enchant;
|
||||
pub mod entities;
|
||||
pub mod entity_nbt;
|
||||
pub mod environment;
|
||||
pub mod fog;
|
||||
pub mod fastutil_order;
|
||||
pub mod fog;
|
||||
pub mod font;
|
||||
pub mod gamerules;
|
||||
pub mod gfx;
|
||||
|
||||
@@ -636,8 +636,12 @@ impl Scoreboard {
|
||||
for t in &self.teams {
|
||||
self.team_order.insert(&t.name);
|
||||
}
|
||||
let rank: BTreeMap<&str, usize> =
|
||||
self.team_order.keys().enumerate().map(|(i, k)| (k, i)).collect();
|
||||
let rank: BTreeMap<&str, usize> = self
|
||||
.team_order
|
||||
.keys()
|
||||
.enumerate()
|
||||
.map(|(i, k)| (k, i))
|
||||
.collect();
|
||||
self.teams
|
||||
.sort_by_key(|t| rank.get(t.name.as_str()).copied().unwrap_or(usize::MAX));
|
||||
}
|
||||
@@ -1079,7 +1083,9 @@ mod tests {
|
||||
sb.set_display_objective("sidebar", Some("kills"));
|
||||
sb.remove_objective("kills");
|
||||
assert!(sb.display_objective("sidebar").is_none());
|
||||
assert!(sb.tracked().is_empty());
|
||||
// Scoreboard.removeObjective keeps the holder, now without scores.
|
||||
assert_eq!(sb.tracked(), vec!["Steve".to_owned()]);
|
||||
assert!(sb.holder_scores("Steve").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -377,19 +377,50 @@ pub fn java_hash_order(
|
||||
// savers write them, as far as it is known here.
|
||||
const WRITE_ORDER: &[&str] = &[
|
||||
// ItemStack.CODEC.
|
||||
"id", "count", "components",
|
||||
"id",
|
||||
"count",
|
||||
"components",
|
||||
// Entity.saveWithoutId.
|
||||
"Pos", "Motion", "Rotation", "fall_distance", "Fire", "Air", "OnGround",
|
||||
"Invulnerable", "PortalCooldown", "UUID", "CustomName", "CustomNameVisible",
|
||||
"Silent", "NoGravity", "Glowing", "TicksFrozen", "HasVisualFire", "Tags",
|
||||
"data", "Passengers",
|
||||
"Pos",
|
||||
"Motion",
|
||||
"Rotation",
|
||||
"fall_distance",
|
||||
"Fire",
|
||||
"Air",
|
||||
"OnGround",
|
||||
"Invulnerable",
|
||||
"PortalCooldown",
|
||||
"UUID",
|
||||
"CustomName",
|
||||
"CustomNameVisible",
|
||||
"Silent",
|
||||
"NoGravity",
|
||||
"Glowing",
|
||||
"TicksFrozen",
|
||||
"HasVisualFire",
|
||||
"Tags",
|
||||
"data",
|
||||
"Passengers",
|
||||
// LivingEntity.addAdditionalSaveData.
|
||||
"Health", "HurtTime", "DeathTime", "AbsorptionAmount",
|
||||
"current_impulse_context_reset_grace_time", "current_explosion_impact_pos",
|
||||
"attributes", "active_effects", "FallFlying", "sleeping_pos", "Brain",
|
||||
"Health",
|
||||
"HurtTime",
|
||||
"DeathTime",
|
||||
"AbsorptionAmount",
|
||||
"current_impulse_context_reset_grace_time",
|
||||
"current_explosion_impact_pos",
|
||||
"attributes",
|
||||
"active_effects",
|
||||
"FallFlying",
|
||||
"sleeping_pos",
|
||||
"Brain",
|
||||
"equipment",
|
||||
// ArmorStand.
|
||||
"Invisible", "Small", "ShowArms", "DisabledSlots", "NoBasePlate", "Marker",
|
||||
"Invisible",
|
||||
"Small",
|
||||
"ShowArms",
|
||||
"DisabledSlots",
|
||||
"NoBasePlate",
|
||||
"Marker",
|
||||
"Pose",
|
||||
];
|
||||
// BlockEntity.saveMetadata writes the position after the entity's data.
|
||||
|
||||
@@ -48,17 +48,14 @@ impl Behaviours {
|
||||
sim: &mut sim,
|
||||
features,
|
||||
};
|
||||
let unbounded = crate::worldgen::structure::BoundingBox::new(
|
||||
[i32::MIN; 3],
|
||||
[i32::MAX; 3],
|
||||
);
|
||||
let unbounded =
|
||||
crate::worldgen::structure::BoundingBox::new([i32::MIN; 3], [i32::MAX; 3]);
|
||||
for piece in &jigsaw.pieces {
|
||||
let mut place_feature = |w: &mut LevelFeatureWorld<'_, '_, L>,
|
||||
r: &mut horizon_core::random::LegacyRandom,
|
||||
name: &str,
|
||||
p: [i32; 3]| {
|
||||
Ok(features.place_placed(name, w, r, p))
|
||||
};
|
||||
let mut place_feature =
|
||||
|w: &mut LevelFeatureWorld<'_, '_, L>,
|
||||
r: &mut horizon_core::random::LegacyRandom,
|
||||
name: &str,
|
||||
p: [i32; 3]| { Ok(features.place_placed(name, w, r, p)) };
|
||||
if let Err(e) = piece.place(
|
||||
&mut world,
|
||||
&jigsaw.resources,
|
||||
|
||||
Reference in New Issue
Block a user