Merge branch 'master' into 1.17
This commit is contained in:
commit
253604b34a
18 files changed
+381
-32
No files matched your search
@@ -577,6 +577,7 @@ public class Auxiliary {
|
||||
|
||||
expression.addLazyFunction("seed", -1, (c, t, lv) -> {
|
||||
ServerCommandSource s = ((CarpetContext)c).s;
|
||||
c.host.issueDeprecation("seed()");
|
||||
Value ret = new NumericValue(s.getWorld().getSeed());
|
||||
return (cc, tt) -> ret;
|
||||
});
|
||||
@@ -785,6 +786,7 @@ public class Auxiliary {
|
||||
boolean shared = false;
|
||||
if (lv.size()>0)
|
||||
{
|
||||
c.host.issueDeprecation("load_app_data(...) with arguments");
|
||||
file = recognizeResource(lv.get(0).evalValue(c));
|
||||
if (lv.size() > 1)
|
||||
{
|
||||
@@ -807,6 +809,7 @@ public class Auxiliary {
|
||||
boolean shared = false;
|
||||
if (lv.size()>1)
|
||||
{
|
||||
c.host.issueDeprecation("store_app_data(...) with more than one argument");
|
||||
file = recognizeResource(lv.get(1).evalValue(c));
|
||||
if (lv.size() > 2)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Scoreboards {
|
||||
}
|
||||
String objectiveName = lv.get(0).evalValue(c).getString();
|
||||
ScoreboardObjective objective = scoreboard.getObjective(objectiveName);
|
||||
if (objective == null) throw new InternalExpressionException("Unknown objective: "+objectiveName);
|
||||
if (objective == null) return LazyValue.NULL;
|
||||
if (lv.size()==1)
|
||||
{
|
||||
Value ret = ListValue.wrap(scoreboard.getAllPlayerScores(objective).stream().map(s -> new StringValue(s.getPlayerName())).collect(Collectors.toList()));
|
||||
@@ -143,7 +143,7 @@ public class Scoreboards {
|
||||
}
|
||||
String objectiveString = target.getString();
|
||||
ScoreboardObjective objective = scoreboard.getObjective(objectiveString);
|
||||
if (objective == null) throw new InternalExpressionException("Objective doesn't exist: "+objectiveString);
|
||||
if (objective == null) return LazyValue.NULL;
|
||||
scoreboard.setObjectiveSlot(slot, objective);
|
||||
return (_c, _t) -> new NumericValue(slot);
|
||||
});
|
||||
|
||||
@@ -543,6 +543,7 @@ public class WorldAccess {
|
||||
// Deprecated, use loaded_status as more indicative
|
||||
expression.addLazyFunction("loaded_ep", -1, (c, t, lv) ->
|
||||
{
|
||||
c.host.issueDeprecation("loaded_ep(...)");
|
||||
BlockPos pos = BlockArgument.findIn((CarpetContext)c, lv, 0).block.getPos();
|
||||
Value retval = ((CarpetContext)c).s.getWorld().getChunkManager().shouldTickChunk(new ChunkPos(pos))?Value.TRUE : Value.FALSE;
|
||||
return (c_, t_) -> retval;
|
||||
@@ -739,11 +740,12 @@ public class WorldAccess {
|
||||
return (c_, t_) -> Value.FALSE;
|
||||
BlockState finalSourceBlockState = sourceBlockState;
|
||||
BlockPos targetPos = targetLocator.block.getPos();
|
||||
Boolean[] result = new Boolean[]{true};
|
||||
cc.s.getMinecraftServer().submitAndJoin( () ->
|
||||
{
|
||||
Clearable.clear(world.getBlockEntity(targetPos));
|
||||
world.setBlockState(targetPos, finalSourceBlockState, 2);
|
||||
if (finalData != null)
|
||||
boolean success = world.setBlockState(targetPos, finalSourceBlockState, 2);
|
||||
if (success && finalData != null)
|
||||
{
|
||||
BlockEntity be = world.getBlockEntity(targetPos);
|
||||
if (be != null)
|
||||
@@ -756,7 +758,9 @@ public class WorldAccess {
|
||||
be.markDirty();
|
||||
}
|
||||
}
|
||||
result[0] = success;
|
||||
});
|
||||
if (!result[0]) return LazyValue.FALSE;
|
||||
Value retval = new BlockValue(finalSourceBlockState, world, targetLocator.block.getPos());
|
||||
return (c_, t_) -> retval;
|
||||
});
|
||||
@@ -962,6 +966,7 @@ public class WorldAccess {
|
||||
// Deprecated for block_state()
|
||||
expression.addLazyFunction("property", -1, (c, t, lv) ->
|
||||
{
|
||||
c.host.issueDeprecation("property(...)");
|
||||
BlockArgument locator = BlockArgument.findIn((CarpetContext) c, lv, 0);
|
||||
BlockState state = locator.block.getBlockState();
|
||||
if (lv.size() <= locator.offset)
|
||||
@@ -978,6 +983,7 @@ public class WorldAccess {
|
||||
// Deprecated for block_state()
|
||||
expression.addLazyFunction("block_properties", -1, (c, t, lv) ->
|
||||
{
|
||||
c.host.issueDeprecation("block_properties(...)");
|
||||
BlockArgument locator = BlockArgument.findIn((CarpetContext) c, lv, 0);
|
||||
BlockState state = locator.block.getBlockState();
|
||||
StateManager<Block, BlockState> states = state.getBlock().getStateManager();
|
||||
|
||||
Reference in new issue
Block a user