From 3915a5d88911e2d65514cbfefd5505b4d7d4ab11 Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 19 Apr 2021 09:23:42 -0300 Subject: [PATCH 1/2] fixed some run command behaviours. --- .../java/carpet/script/utils/FixedCommandSource.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/carpet/script/utils/FixedCommandSource.java b/src/main/java/carpet/script/utils/FixedCommandSource.java index beb5e566..2355e9b7 100644 --- a/src/main/java/carpet/script/utils/FixedCommandSource.java +++ b/src/main/java/carpet/script/utils/FixedCommandSource.java @@ -16,6 +16,7 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.util.math.Vec2f; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.dimension.DimensionType; import java.util.List; import java.util.function.BinaryOperator; @@ -24,8 +25,8 @@ public class FixedCommandSource extends ServerCommandSource { private Vec3d position; private ServerWorld world; - private final String simpleName; - private final Text name; + private String simpleName; + private Text name; private final MinecraftServer server; private Entity entity; private ResultConsumer resultConsumer; @@ -56,6 +57,8 @@ public class FixedCommandSource extends ServerCommandSource public ServerCommandSource withEntity(Entity entity) { this.entity = entity; + this.simpleName = entity.getName().getString(); + this.name = entity.getDisplayName(); return this; } @@ -107,6 +110,8 @@ public class FixedCommandSource extends ServerCommandSource public ServerCommandSource withWorld(ServerWorld world) { this.world = world; + double d = DimensionType.method_31109(this.world.getDimension(), world.getDimension()); + this.position = new Vec3d(this.position.x * d, this.position.y, this.position.z * d); return this; } From 6677c538fa4eab9b5107af622b28fe1d525f367f Mon Sep 17 00:00:00 2001 From: gnembon Date: Mon, 19 Apr 2021 09:32:33 -0300 Subject: [PATCH 2/2] simple --- docs/scarpet/api/Entities.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 21efb79a..47c79225 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -57,20 +57,8 @@ living entities based on their spawn group. Negative descriptor resolves to all category. * All entity tags including those provided with datapacks. Built-in entity tags include: `skeletons`, `raiders`, `beehive_inhabitors` (bee, duh), `arrows` and `impact_projectiles`. -* Any of the following standard entity types (equivalent to selection from `/summon` vanilla command: -`area_effect_cloud`, `armor_stand`, `arrow`, `bat`, `bee`, `blaze`, `boat`, `cat`, `cave_spider`, `chest_minecart`, -`chicken`, `cod`, `command_block_minecart`, `cow`, `creeper`, `dolphin`, `donkey`, `dragon_fireball`, `drowned`, -`egg`, `elder_guardian`, `end_crystal`, `ender_dragon`, `ender_pearl`, `enderman`, `endermite`, `evoker`, -`evoker_fangs`, `experience_bottle`, `experience_orb`, `eye_of_ender`, `falling_block`, `fireball`, `firework_rocket`, -`fishing_bobber`, `fox`, `furnace_minecart`, `ghast`, `giant`, `guardian`, `hoglin`, `hopper_minecart`, `horse`, -`husk`, `illusioner`, `iron_golem`, `item`, `item_frame`, `leash_knot`, `lightning_bolt`, `llama`, `llama_spit`, -`magma_cube`, `minecart`, `mooshroom`, `mule`, `ocelot`, `painting`, `panda`, `parrot`, `phantom`, `pig`, `piglin`, -`piglin_brute`, `pillager`, `player`, `polar_bear`, `potion`, `pufferfish`, `rabbit`, `ravager`, `salmon`, `sheep`, -`shulker`, `shulker_bullet`, `silverfish`, `skeleton`, `skeleton_horse`, `slime`, `small_fireball`, `snow_golem`, -`snowball`, `spawner_minecart`, `spectral_arrow`, `spider`, `squid`, `stray`, `strider`, `tnt`, `tnt_minecart`, -`trader_llama`, `trident`, `tropical_fish`, `turtle`, `vex`, `villager`, `vindicator`, `wandering_trader`, `witch`, -`wither`, `wither_skeleton`, `wither_skull`, `wolf`, `zoglin`, `zombie`, `zombie_horse`, `zombie_villager`, -`zombified_piglin` +* Any of the standard entity types, equivalent to selection from `/summon` vanilla command, which is one of the options returned +by `entity_types()`, except for `'fishing_bobber'` and `'player'`. All categories can be preceded with `'!'` which will fetch all entities (unless otherwise noted) that are valid (health > 0) but not belonging to that group.