Merge branch 'master' into 1.17
# Conflicts: # src/main/java/carpet/script/api/Auxiliary.java # src/main/java/carpet/script/utils/ShapeDispatcher.java # src/main/java/carpet/script/value/EntityValue.java # src/main/java/carpet/script/value/ListValue.java
This commit is contained in:
commit
c720c2c935
18 files changed
+83
-110
No files matched your search
@@ -460,7 +460,7 @@ public class Auxiliary {
|
||||
if (lv.get(0).isNull()) return Value.FALSE;
|
||||
NbtElement source = ((NBTSerializableValue)(NBTSerializableValue.fromValue(lv.get(0)))).getTag();
|
||||
NbtElement match = ((NBTSerializableValue)(NBTSerializableValue.fromValue(lv.get(1)))).getTag();
|
||||
return new NumericValue(NbtHelper.matches(match, source, numParam == 2 || lv.get(2).getBoolean()));
|
||||
return BooleanValue.of(NbtHelper.matches(match, source, numParam == 2 || lv.get(2).getBoolean()));
|
||||
});
|
||||
|
||||
expression.addFunction("encode_nbt", lv -> {
|
||||
@@ -799,7 +799,7 @@ public class Auxiliary {
|
||||
return;
|
||||
if (what.equalsIgnoreCase("boulder")) // there might be more of those
|
||||
WorldTools.forceChunkUpdate(locator.block.getPos(), ((CarpetContext) c).s.getWorld());
|
||||
result[0] = new NumericValue(res);
|
||||
result[0] = BooleanValue.of(res);
|
||||
});
|
||||
return result[0];
|
||||
});
|
||||
|
||||
@@ -195,7 +195,7 @@ public class Inventories {
|
||||
CarpetContext cc = (CarpetContext) c;
|
||||
NBTSerializableValue.InventoryLocator inventoryLocator = NBTSerializableValue.locateInventory(cc, lv, 0);
|
||||
if (inventoryLocator == null) return Value.NULL;
|
||||
return new NumericValue(!inventoryLocator.inventory.isEmpty());
|
||||
return BooleanValue.of(!inventoryLocator.inventory.isEmpty());
|
||||
});
|
||||
|
||||
//inventory_get(<b, e>, <n>) -> item_triple
|
||||
|
||||
@@ -8,6 +8,7 @@ import carpet.script.LazyValue;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import carpet.script.exception.ThrowStatement;
|
||||
import carpet.script.exception.Throwables;
|
||||
import carpet.script.value.BooleanValue;
|
||||
import carpet.script.value.EntityValue;
|
||||
import carpet.script.value.ListValue;
|
||||
import carpet.script.value.NullValue;
|
||||
@@ -301,7 +302,7 @@ public class Scoreboards {
|
||||
Value playerVal = lv.get(0);
|
||||
String player = EntityValue.getPlayerNameByValue(playerVal);
|
||||
if(player == null) return Value.NULL;
|
||||
return new NumericValue(scoreboard.clearPlayerTeam(player));
|
||||
return BooleanValue.of(scoreboard.clearPlayerTeam(player));
|
||||
});
|
||||
|
||||
expression.addContextFunction("team_property", -1, (c, t, lv) ->
|
||||
@@ -357,7 +358,7 @@ public class Scoreboards {
|
||||
team.setDisplayName(displayName);
|
||||
break;
|
||||
case "friendlyFire":
|
||||
if(!modifying) return new NumericValue(team.isFriendlyFireAllowed());
|
||||
if(!modifying) return BooleanValue.of(team.isFriendlyFireAllowed());
|
||||
if(!(settingVal instanceof NumericValue)) throw new InternalExpressionException("'team_property' requires a boolean as the third argument for the property " + propertyVal.getString());
|
||||
boolean friendlyFire = settingVal.getBoolean();
|
||||
team.setFriendlyFireAllowed(friendlyFire);
|
||||
@@ -378,7 +379,7 @@ public class Scoreboards {
|
||||
team.setPrefix(prefix);
|
||||
break;
|
||||
case "seeFriendlyInvisibles":
|
||||
if(!modifying) return new NumericValue(team.shouldShowFriendlyInvisibles());
|
||||
if(!modifying) return BooleanValue.of(team.shouldShowFriendlyInvisibles());
|
||||
if(!(settingVal instanceof NumericValue)) throw new InternalExpressionException("'team_property' requires a boolean as the third argument for the property " + propertyVal.getString());
|
||||
boolean seeFriendlyInvisibles = settingVal.getBoolean();
|
||||
team.setShowFriendlyInvisibles(seeFriendlyInvisibles);
|
||||
@@ -500,7 +501,7 @@ public class Scoreboards {
|
||||
bossBar.setValue(((NumericValue) propertyValue).getInt());
|
||||
return Value.TRUE;
|
||||
case "visible":
|
||||
if(propertyValue == null) return new NumericValue(bossBar.isVisible());
|
||||
if(propertyValue == null) return BooleanValue.of(bossBar.isVisible());
|
||||
|
||||
bossBar.setVisible(propertyValue.getBoolean());
|
||||
return Value.TRUE;
|
||||
|
||||
@@ -493,7 +493,7 @@ public class WorldAccess {
|
||||
});
|
||||
|
||||
expression.addContextFunction("solid", -1, (c, t, lv) ->
|
||||
genericStateTest(c, "solid", lv, (s, p, w) -> new NumericValue(s.isSolidBlock(w, p)))); // isSimpleFullBlock
|
||||
genericStateTest(c, "solid", lv, (s, p, w) -> BooleanValue.of(s.isSolidBlock(w, p)))); // isSimpleFullBlock
|
||||
|
||||
expression.addContextFunction("air", -1, (c, t, lv) ->
|
||||
booleanStateTest(c, "air", lv, (s, p) -> s.isAir()));
|
||||
@@ -526,7 +526,7 @@ public class WorldAccess {
|
||||
genericStateTest(c, "sky_light", lv, (s, p, w) -> new NumericValue(w.getLightLevel(LightType.SKY, p))));
|
||||
|
||||
expression.addContextFunction("see_sky", -1, (c, t, lv) ->
|
||||
genericStateTest(c, "see_sky", lv, (s, p, w) -> new NumericValue(w.isSkyVisible(p))));
|
||||
genericStateTest(c, "see_sky", lv, (s, p, w) -> BooleanValue.of(w.isSkyVisible(p))));
|
||||
|
||||
expression.addContextFunction("brightness", -1, (c, t, lv) ->
|
||||
genericStateTest(c, "brightness", lv, (s, p, w) -> new NumericValue(w.getBrightness(p))));
|
||||
@@ -541,7 +541,7 @@ public class WorldAccess {
|
||||
{
|
||||
BlockPos pos = BlockArgument.findIn((CarpetContext)c, lv, 0).block.getPos();
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
return new NumericValue(ChunkRandom.getSlimeRandom(
|
||||
return BooleanValue.of(ChunkRandom.getSlimeRandom(
|
||||
chunkPos.x, chunkPos.z,
|
||||
((CarpetContext)c).s.getWorld().getSeed(),
|
||||
987234911L
|
||||
@@ -594,7 +594,7 @@ public class WorldAccess {
|
||||
boolean force = false;
|
||||
if (lv.size() > locator.offset)
|
||||
force = lv.get(locator.offset).getBoolean();
|
||||
return new NumericValue(canHasChunk(((CarpetContext)c).s.getWorld(), new ChunkPos(pos), null, force));
|
||||
return BooleanValue.of(canHasChunk(((CarpetContext)c).s.getWorld(), new ChunkPos(pos), null, force));
|
||||
});
|
||||
|
||||
expression.addContextFunction("generation_status", -1, (c, t, lv) ->
|
||||
@@ -654,7 +654,7 @@ public class WorldAccess {
|
||||
});
|
||||
|
||||
expression.addContextFunction("suffocates", -1, (c, t, lv) ->
|
||||
genericStateTest(c, "suffocates", lv, (s, p, w) -> new NumericValue(s.shouldSuffocate(w, p)))); // canSuffocate
|
||||
genericStateTest(c, "suffocates", lv, (s, p, w) -> BooleanValue.of(s.shouldSuffocate(w, p)))); // canSuffocate
|
||||
|
||||
expression.addContextFunction("power", -1, (c, t, lv) ->
|
||||
genericStateTest(c, "power", lv, (s, p, w) -> new NumericValue(w.getReceivedRedstonePower(p))));
|
||||
|
||||
Reference in new issue
Block a user