From a229c2084c850c041f7a8bea772da8d9f961dfc4 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 15 Apr 2020 22:46:58 -0300 Subject: [PATCH 1/3] added new structure info --- docs/scarpet/Full.md | 15 +++++++++++++++ docs/scarpet/api/BlocksAndWorldAccess.md | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index b212f553..56398e7d 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2127,6 +2127,13 @@ Structure list: * `village_savanna`: Savanna, acacia village. * `village_taiga`: Taiga, spruce village. * `village_snowy`: Resolute, Canada. +* `nether_fossil`: Pile of bones (1.16) +* `ruined_portal`: Ruined portal, random variant. +* `bastion_remnant`: Piglin bastion, random variant for the chunk (1.16) +* `bastion_remnant_housing`: Housing units version of a piglin bastion (1.16) +* `bastion_remnant_stable`: Hoglin stables version of q piglin bastion (1.16) +* `bastion_remnant_treasure`: Treasure room version of a piglin bastion (1.16) +* `bastion_remnant_bridge` : Bridge version of a piglin bastion (1.16) Feature list: @@ -2183,6 +2190,14 @@ Feature list: * `coral`: random coral structure. Require water to spawn. * `sea_pickle` * `boulder`: A rocky, mossy formation from a giant taiga biome. Doesn't update client properly, needs relogging. +* `crimson_fungus` (1.16) +* `warped_fungus` (1.16) +* `nether_sprouts` (1.16) +* `crimson_roots` (1.16) +* `warped_roots` (1.16) +* `weeping_vines` (1.16) +* `twisting_vines` (1.16) +* `basalt_pillar` (1.16) ### `reset_chunk(pos)`, `reset_chunk(from_pos, to_pos)`, `reset_chunk(l(pos, ...))` Removes and resets the chunk, all chunks in the specified area or all chunks in a list at once, removing all previous diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index 1ec333d7..0847bbbf 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -590,6 +590,13 @@ Structure list: * `village_savanna`: Savanna, acacia village. * `village_taiga`: Taiga, spruce village. * `village_snowy`: Resolute, Canada. +* `nether_fossil`: Pile of bones (1.16) +* `ruined_portal`: Ruined portal, random variant. +* `bastion_remnant`: Piglin bastion, random variant for the chunk (1.16) +* `bastion_remnant_housing`: Housing units version of a piglin bastion (1.16) +* `bastion_remnant_stable`: Hoglin stables version of q piglin bastion (1.16) +* `bastion_remnant_treasure`: Treasure room version of a piglin bastion (1.16) +* `bastion_remnant_bridge` : Bridge version of a piglin bastion (1.16) Feature list: @@ -646,6 +653,14 @@ Feature list: * `coral`: random coral structure. Require water to spawn. * `sea_pickle` * `boulder`: A rocky, mossy formation from a giant taiga biome. Doesn't update client properly, needs relogging. +* `crimson_fungus` (1.16) +* `warped_fungus` (1.16) +* `nether_sprouts` (1.16) +* `crimson_roots` (1.16) +* `warped_roots` (1.16) +* `weeping_vines` (1.16) +* `twisting_vines` (1.16) +* `basalt_pillar` (1.16) ### `reset_chunk(pos)`, `reset_chunk(from_pos, to_pos)`, `reset_chunk(l(pos, ...))` Removes and resets the chunk, all chunks in the specified area or all chunks in a list at once, removing all previous From 9a588cf19a565f8da33b838b2b62fd98640a12f3 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 15 Apr 2020 23:58:59 -0300 Subject: [PATCH 2/3] fixes #225 --- src/main/java/carpet/script/value/EntityValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 3cd5726e..ce033fa1 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -118,7 +118,7 @@ public class EntityValue extends Value @Override public String getString() { - return entity.getDisplayName().getString(); + return entity.getName().getString(); } @Override From 022addf4e171a537ed1ea5566761599acf9d499a Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 16 Apr 2020 00:24:02 -0300 Subject: [PATCH 3/3] fixed #225 yet again, added display_name, command_name and team option for entities. --- docs/scarpet/Full.md | 18 ++++++++++++++++-- docs/scarpet/api/Entities.md | 18 ++++++++++++++++-- .../java/carpet/script/value/EntityValue.java | 6 +++++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index 56398e7d..45d8eb9e 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2370,15 +2370,25 @@ Triple of entity motion vector, `l(motion_x, motion_y, motion_z)` Respective component of the motion vector -### `query(e,'name'), query(e,'custom_name'), query(e,'type')` +### `query(e,'name'), query(e,'display_name'), query(e,'custom_name'), query(e,'type')` String of entity name -
query(e,'name')  => Leatherworker
+
+query(e,'name')  => Leatherworker
 query(e,'custom_name')  => null
 query(e,'type')  => villager
 
+## `query(e, 'command_name')` + +Returns a valid string to be used in commands to address an entity. Its UUID for all entities except +player, where its their name. + +
+run('/kill ' + e~'command_name');
+
+ ### `query(e,'is_riding')` Boolean. True if riding another entity. @@ -2522,6 +2532,10 @@ Returns `null` if the argument is not a player, otherwise: * `shadow`: any carpet-shadowed real player * `realms`: ? +### `query(e, 'team')` + +Team name for entity, or `null` if no team is assigned. + ### `query(e,'ping')` Player's ping in milliseconds, or `null` if its not a player. diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 5fec0d0b..3bd7634f 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -113,15 +113,25 @@ Triple of entity motion vector, `l(motion_x, motion_y, motion_z)` Respective component of the motion vector -### `query(e,'name'), query(e,'custom_name'), query(e,'type')` +### `query(e,'name'), query(e,'display_name'), query(e,'custom_name'), query(e,'type')` String of entity name -
query(e,'name')  => Leatherworker
+
+query(e,'name')  => Leatherworker
 query(e,'custom_name')  => null
 query(e,'type')  => villager
 
+## `query(e, 'command_name')` + +Returns a valid string to be used in commands to address an entity. Its UUID for all entities except +player, where its their name. + +
+run('/kill ' + e~'command_name');
+
+ ### `query(e,'is_riding')` Boolean. True if riding another entity. @@ -265,6 +275,10 @@ Returns `null` if the argument is not a player, otherwise: * `shadow`: any carpet-shadowed real player * `realms`: ? +### `query(e, 'team')` + +Team name for entity, or `null` if no team is assigned. + ### `query(e,'ping')` Player's ping in milliseconds, or `null` if its not a player. diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index ce033fa1..88c9f14a 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -220,7 +220,9 @@ public class EntityValue extends Value put("motion_x", (e, a) -> new NumericValue(e.getVelocity().x)); put("motion_y", (e, a) -> new NumericValue(e.getVelocity().y)); put("motion_z", (e, a) -> new NumericValue(e.getVelocity().z)); - put("name", (e, a) -> new StringValue(e.getDisplayName().getString())); + put("name", (e, a) -> new StringValue(e.getName().getString())); + put("display_name", (e, a) -> new StringValue(e.getDisplayName().getString())); + put("command_name", (e, a) -> new StringValue(e.getEntityName())); put("custom_name", (e, a) -> e.hasCustomName()?new StringValue(e.getCustomName().getString()):Value.NULL); put("type", (e, a) -> new StringValue(nameFromRegistryId(Registry.ENTITY_TYPE.getId(e.getType())))); put("is_riding", (e, a) -> new NumericValue(e.hasVehicle())); @@ -331,6 +333,8 @@ public class EntityValue extends Value return Value.NULL; }); + put("team", (e, a) -> e.getScoreboardTeam()==null?Value.NULL:new StringValue(e.getScoreboardTeam().getName())); + put("ping", (e, a) -> { if (e instanceof ServerPlayerEntity) {