Merge branch 'master' into 1.17
# Conflicts: # src/main/java/carpet/script/utils/SnoopyCommandSource.java # src/main/java/carpet/utils/WoolTool.java
This commit is contained in:
commit
b80b555781
9 files changed
+147
-12
No files matched your search
@@ -623,16 +623,15 @@ public class Auxiliary {
|
||||
return new FormattedTextValue(Messenger.c(values.stream().map(Value::getString).toArray()));
|
||||
});
|
||||
|
||||
expression.addContextFunction("run", 1, (c, t, lv) -> {
|
||||
BlockPos target = ((CarpetContext)c).origin;
|
||||
Vec3d posf = new Vec3d((double)target.getX()+0.5D, target.getY(),(double)target.getZ()+0.5D);
|
||||
expression.addContextFunction("run", 1, (c, t, lv) ->
|
||||
{
|
||||
ServerCommandSource s = ((CarpetContext)c).s;
|
||||
try
|
||||
{
|
||||
Text[] error = {null};
|
||||
List<Text> output = new ArrayList<>();
|
||||
Value retval = new NumericValue(s.getMinecraftServer().getCommandManager().execute(
|
||||
new SnoopyCommandSource(s, posf, error, output),
|
||||
new SnoopyCommandSource(s, error, output),
|
||||
lv.get(0).getString())
|
||||
);
|
||||
return ListValue.of(
|
||||
@@ -647,7 +646,8 @@ public class Auxiliary {
|
||||
}
|
||||
});
|
||||
|
||||
expression.addContextFunction("save", 0, (c, t, lv) -> {
|
||||
expression.addContextFunction("save", 0, (c, t, lv) ->
|
||||
{
|
||||
ServerCommandSource s = ((CarpetContext)c).s;
|
||||
s.getMinecraftServer().getPlayerManager().saveAllPlayerData();
|
||||
s.getMinecraftServer().save(true,true,true);
|
||||
|
||||
@@ -37,13 +37,13 @@ public class SnoopyCommandSource extends ServerCommandSource
|
||||
private final Text[] error;
|
||||
private final List<Text> chatOutput;
|
||||
|
||||
public SnoopyCommandSource(ServerCommandSource original, Vec3d pos, Text[] error, List<Text> chatOutput)
|
||||
public SnoopyCommandSource(ServerCommandSource original, Text[] error, List<Text> chatOutput)
|
||||
{
|
||||
super(CommandOutput.DUMMY, pos, Vec2f.ZERO, original.getWorld(), CarpetSettings.runPermissionLevel,
|
||||
super(CommandOutput.DUMMY, original.getPosition(), original.getRotation(), original.getWorld(), CarpetSettings.runPermissionLevel,
|
||||
original.getName(), original.getDisplayName(), original.getMinecraftServer(), original.getEntity(), false,
|
||||
(ctx, succ, res) -> { }, EntityAnchorArgumentType.EntityAnchor.FEET);
|
||||
this.output = CommandOutput.DUMMY;
|
||||
this.position = pos;
|
||||
this.position = original.getPosition();
|
||||
this.world = original.getWorld();
|
||||
this.level = CarpetSettings.runPermissionLevel;
|
||||
this.simpleName = original.getName();
|
||||
@@ -52,7 +52,7 @@ public class SnoopyCommandSource extends ServerCommandSource
|
||||
this.entity = original.getEntity();
|
||||
this.resultConsumer = (ctx, succ, res) -> { };
|
||||
this.entityAnchor = original.getEntityAnchor();
|
||||
this.rotation = Vec2f.ZERO;
|
||||
this.rotation = original.getRotation();
|
||||
this.error = error;
|
||||
this.chatOutput = chatOutput;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class SnoopyCommandSource extends ServerCommandSource
|
||||
this.entity = player;
|
||||
this.resultConsumer = (ctx, succ, res) -> { };
|
||||
this.entityAnchor = EntityAnchorArgumentType.EntityAnchor.FEET;
|
||||
this.rotation = Vec2f.ZERO;
|
||||
this.rotation = player.getRotationClient(); // not a client call really
|
||||
this.error = error;
|
||||
this.chatOutput = output;
|
||||
}
|
||||
@@ -158,6 +158,7 @@ public class SnoopyCommandSource extends ServerCommandSource
|
||||
return new SnoopyCommandSource(output, position, rotation, world, level, simpleName, name, server, entity, resultConsumer, entityAnchor, error, chatOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerCommandSource withLookingAt(Vec3d position)
|
||||
{
|
||||
Vec3d vec3d = this.entityAnchor.positionAt(this);
|
||||
|
||||
Reference in new issue
Block a user