Skip to content

Commit

Permalink
fix cuboid loading error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 18, 2021
1 parent ceef220 commit 958a703
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Expand Up @@ -178,10 +178,13 @@ public static void registerTags(ObjectTagProcessor<? extends AreaContainmentObje
// -->
processor.registerTag("contains", (attribute, area) -> {
if (!attribute.hasContext(1)) {
attribute.echoError("AreaObject.contains[...] tag must have an input.");
return null;
}
return new ElementTag(area.doesContainLocation(attribute.contextAsType(1, LocationTag.class)));
LocationTag loc = attribute.contextAsType(1, LocationTag.class);
if (loc == null) {
return null;
}
return new ElementTag(area.doesContainLocation(loc));
}, "contains_location");

// <--[tag]
Expand Down Expand Up @@ -237,7 +240,6 @@ public static void registerTags(ObjectTagProcessor<? extends AreaContainmentObje
// -->
processor.registerTag("blocks_flagged", (attribute, area) -> {
if (!attribute.hasContext(1)) {
attribute.echoError("AreaObject.blocks_flagged[...] must have an input value.");
return null;
}
return area.getBlocksFlagged(CoreUtilities.toLowerCase(attribute.getContext(1)), attribute);
Expand All @@ -261,10 +263,12 @@ public static void registerTags(ObjectTagProcessor<? extends AreaContainmentObje
// -->
processor.registerTag("is_within", (attribute, area) -> {
if (!attribute.hasContext(1)) {
attribute.echoError("The tag AreaObject.is_within[...] must have a value.");
return null;
}
CuboidTag cub2 = attribute.contextAsType(1, CuboidTag.class);
if (cub2 == null) {
return null;
}
CuboidTag cuboid = area instanceof CuboidTag ? (CuboidTag) area : area.getCuboidBoundary();
if (cub2 != null) {
boolean contains = true;
Expand Down Expand Up @@ -302,7 +306,6 @@ public static void registerTags(ObjectTagProcessor<? extends AreaContainmentObje
// -->
processor.registerTag("with_world", (attribute, area) -> {
if (!attribute.hasContext(1)) {
attribute.echoError("AreaObject.with_world[...] tag must have an input.");
return null;
}
WorldTag world = attribute.contextAsType(1, WorldTag.class);
Expand Down
Expand Up @@ -345,11 +345,11 @@ public CuboidTag(Location point_1, Location point_2) {
}

public void addPair(LocationTag point_1, LocationTag point_2) {
if (point_1.getWorld() != point_2.getWorld()) {
if (!point_1.getWorldName().equals(point_2.getWorldName())) {
Debug.echoError("Tried to make cross-world cuboid!");
return;
}
if (pairs.size() > 0 && point_1.getWorld() != getWorld()) {
if (pairs.size() > 0 && !point_1.getWorldName().equals(getWorld().getName())) {
Debug.echoError("Tried to make cross-world cuboid set!");
return;
}
Expand Down
Expand Up @@ -121,6 +121,7 @@ public void adjust(Mechanism mechanism) {
// Each item in the list is formatted as: TRAIL,FLICKER,TYPE,RED,GREEN,BLUE,RED,GREEN,BLUE
// For example: true,false,BALL,255,0,0,0,255,0 would create a trailing ball firework that fades from red to green.
// Optionally add a list entry that's just a single number to set the power.
// Types: ball, ball_large, star, burst, or creeper
// @tags
// <ItemTag.firework>
// -->
Expand Down

0 comments on commit 958a703

Please sign in to comment.