From 986909c1f4297a547d980ed941c41dacb758589d Mon Sep 17 00:00:00 2001 From: Ghoulboy Date: Wed, 17 Jun 2020 17:11:01 +0200 Subject: [PATCH 1/3] Add support for triples of positions in volume (#321) * Add support for triples of positions in volume it work good! * Updating docs * made it work with 5 arguments so like volume(x,y,z,pos) or volume(pos,x,y,z). Also renamed previous variables * updated docs * making it smarter * made it work for rect and diamond and cleaned up some earlier code * updated docs * did all ur stuffs * fixin the issues --- docs/scarpet/Full.md | 19 ++- docs/scarpet/api/BlockIterations.md | 17 ++- .../java/carpet/script/CarpetExpression.java | 131 +++++++++--------- 3 files changed, 90 insertions(+), 77 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index f82c80a7..e74e1dad 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2346,10 +2346,11 @@ which would cause the expression not be evaluated for their boolean value. `scan` also handles `continue` and `break` statements, using `continue`'s return value to use in place of expression return value. `break` return value has no effect. -### `volume(x1, y1, z1, x2, y2, z2, expr)` +### `volume(x1, y1, z1, x2, y2, z2, expr), volume(pos1, pos2, expr)` Evaluates expression for each block in the area, the same as the `scan` function, but using two opposite corners of the rectangular cuboid. Any corners can be specified, its like you would do with `/fill` command. +You can use a position or three coordinates to specify, it doesn't matter. For return value and handling `break` and `continue` statements, see `scan` function above. @@ -2361,15 +2362,19 @@ Returns the list of 6 neighbouring blocks to the argument. Commonly used with ot for(neighbours(x,y,z),air(_)) => 4 // number of air blocks around a block -### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?)` +### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?), rect(centre, difference?, positive_diff?)` -returns an iterator, just like `range` function that iterates over rectangular cubarea of blocks. If only center -point is specified, it iterates over 27 blocks. If `d` arguments are specified, expands selection by the respective -number of blocks in each direction. If `p` arguments are specified, it uses `d` for negative offset, and `p` for positive. +Returns an iterator, just like `range` function that iterates over a rectangular area of blocks. If only center +point is specified, it iterates over 27 blocks. If `d` (`difference`) arguments are specified, expands selection by the respective +number of blocks in each direction. If `p` (`positive_diff`) arguments are specified, it uses `d` (`difference`) for negative offset, and `p` for positive. -### `diamond(cx, cy, cz, radius?, height?)` +`centre` can be defined either as three coordinates, a list of three coords, or a block value. +`difference` and `positive_diff` can have the same representations, just if its a block, it computes the distance to the center +as range instead of taking the values as is.` -Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle +### `diamond(cx, cy, cz, radius?, height?), diamond(centre, radius?, height?)` + +Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle `centre = l(cx, cy, cz)` (block + neighbours). With a radius specified, it expands shape on x and z coords, and with a custom height, on y. Any of these can be zero as well. radius of 0 makes a stick, height of 0 makes a diamond shape pad. # Entity API diff --git a/docs/scarpet/api/BlockIterations.md b/docs/scarpet/api/BlockIterations.md index f60375c8..d8f87e25 100644 --- a/docs/scarpet/api/BlockIterations.md +++ b/docs/scarpet/api/BlockIterations.md @@ -18,10 +18,11 @@ which would cause the expression not be evaluated for their boolean value. `scan` also handles `continue` and `break` statements, using `continue`'s return value to use in place of expression return value. `break` return value has no effect. -### `volume(x1, y1, z1, x2, y2, z2, expr)` +### `volume(x1, y1, z1, x2, y2, z2, expr), volume(pos1, pos2, expr)` Evaluates expression for each block in the area, the same as the `scan` function, but using two opposite corners of the rectangular cuboid. Any corners can be specified, its like you would do with `/fill` command. +You can use a position or three coordinates to specify, it doesn't matter. For return value and handling `break` and `continue` statements, see `scan` function above. @@ -33,13 +34,17 @@ Returns the list of 6 neighbouring blocks to the argument. Commonly used with ot for(neighbours(x,y,z),air(_)) => 4 // number of air blocks around a block -### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?)` +### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?), rect(centre, difference?, positive_diff?)` -returns an iterator, just like `range` function that iterates over rectangular cubarea of blocks. If only center -point is specified, it iterates over 27 blocks. If `d` arguments are specified, expands selection by the respective -number of blocks in each direction. If `p` arguments are specified, it uses `d` for negative offset, and `p` for positive. +Returns an iterator, just like `range` function that iterates over a rectangular area of blocks. If only center +point is specified, it iterates over 27 blocks. If `d` (`difference`) arguments are specified, expands selection by the respective +number of blocks in each direction. If `p` (`positive_diff`) arguments are specified, it uses `d` (`difference`) for negative offset, and `p` for positive. -### `diamond(cx, cy, cz, radius?, height?)` +`centre` can be defined either as three coordinates, a list of three coords, or a block value. +`difference` and `positive_diff` can have the same representations, just if its a block, it computes the distance to the center +as range instead of taking the values as is.` + +### `diamond(cx, cy, cz, radius?, height?), diamond(centre, radius?, height?)` Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle (block + neighbours). With a radius specified, it expands shape on x and z coords, and with a custom height, on y. diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index efec613d..04e2be88 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -2221,21 +2221,28 @@ public class CarpetExpression return (c_, t_) -> new NumericValue(finalSCount); }); - this.expr.addLazyFunction("volume", 7, (c, t, lv) -> + this.expr.addLazyFunction("volume", -1, (c, t, lv) -> { - int xi = (int) NumericValue.asNumber(lv.get(0).evalValue(c)).getLong(); - int yi = (int) NumericValue.asNumber(lv.get(1).evalValue(c)).getLong(); - int zi = (int) NumericValue.asNumber(lv.get(2).evalValue(c)).getLong(); - int xj = (int) NumericValue.asNumber(lv.get(3).evalValue(c)).getLong(); - int yj = (int) NumericValue.asNumber(lv.get(4).evalValue(c)).getLong(); - int zj = (int) NumericValue.asNumber(lv.get(5).evalValue(c)).getLong(); - int minx = min(xi, xj); - int miny = min(yi, yj); - int minz = min(zi, zj); - int maxx = max(xi, xj); - int maxy = max(yi, yj); - int maxz = max(zi, zj); - LazyValue expr = lv.get(6); + CarpetContext cc = (CarpetContext)c; + + BlockArgument pos1Locator = BlockArgument.findIn(cc, lv, 0); + BlockArgument pos2Locator = BlockArgument.findIn(cc, lv, pos1Locator.offset); + BlockPos pos2 = pos2Locator.block.getPos(); + BlockPos pos1 = pos1Locator.block.getPos(); + + int x1 = pos1.getX(); + int y1 = pos1.getY(); + int z1 = pos1.getZ(); + int x2 = pos2.getX(); + int y2 = pos2.getY(); + int z2 = pos2.getZ(); + int minx = min(x1, x2); + int miny = min(y1, y2); + int minz = min(z1, z2); + int maxx = max(x1, x2); + int maxy = max(y1, y2); + int maxz = max(z1, z2); + LazyValue expr = lv.get(pos2Locator.offset); //saving outer scope LazyValue _x = c.getVariable("_x"); @@ -2305,10 +2312,8 @@ public class CarpetExpression this.expr.addLazyFunction("rect", -1, (c, t, lv)-> { - if (lv.size() != 3 && lv.size() != 6 && lv.size() != 9) - { - throw new InternalExpressionException("Rectangular region should be specified with 3, 6, or 9 coordinates"); - } + CarpetContext cc = (CarpetContext) c; + int cx; int cy; int cz; @@ -2318,44 +2323,39 @@ public class CarpetExpression int smaxx; int smaxy; int smaxz; - try - { - cx = (int)((NumericValue) lv.get(0).evalValue(c)).getLong(); - cy = (int)((NumericValue) lv.get(1).evalValue(c)).getLong(); - cz = (int)((NumericValue) lv.get(2).evalValue(c)).getLong(); - if (lv.size()==3) // only done this way because of stupid Java lambda final reqs - { - sminx = 1; - sminy = 1; - sminz = 1; - smaxx = 1; - smaxy = 1; - smaxz = 1; - } - else if (lv.size()==6) - { - sminx = (int) ((NumericValue) lv.get(3).evalValue(c)).getLong(); - sminy = (int) ((NumericValue) lv.get(4).evalValue(c)).getLong(); - sminz = (int) ((NumericValue) lv.get(5).evalValue(c)).getLong(); + + BlockArgument cposLocator = BlockArgument.findIn(cc, lv, 0); + BlockPos cpos = cposLocator.block.getPos(); + + cx = cpos.getX(); + cy = cpos.getY(); + cz = cpos.getZ(); + + if(lv.size()>cposLocator.offset){ + BlockArgument diff_Locator = BlockArgument.findIn(cc, lv, cposLocator.offset); + BlockPos difference = diff_Locator.block.getPos(); + sminx = difference.getX(); + sminy = difference.getY(); + sminz = difference.getZ(); + if(lv.size()>diff_Locator.offset){ + BlockPos pos_diff=BlockArgument.findIn(cc,lv,diff_Locator.offset).block.getPos(); + smaxx = pos_diff.getX(); + smaxy = pos_diff.getY(); + smaxz = pos_diff.getZ(); + }else{ smaxx = sminx; smaxy = sminy; smaxz = sminz; } - else // size == 9 - { - sminx = (int) ((NumericValue) lv.get(3).evalValue(c)).getLong(); - sminy = (int) ((NumericValue) lv.get(4).evalValue(c)).getLong(); - sminz = (int) ((NumericValue) lv.get(5).evalValue(c)).getLong(); - smaxx = (int)((NumericValue) lv.get(6).evalValue(c)).getLong(); - smaxy = (int)((NumericValue) lv.get(7).evalValue(c)).getLong(); - smaxz = (int)((NumericValue) lv.get(8).evalValue(c)).getLong(); - } + }else{ + sminx = 1; + sminy = 1; + sminz = 1; + smaxx = 1; + smaxy = 1; + smaxz = 1; } - catch (ClassCastException exc) - { - throw new InternalExpressionException("Attempted to pass a non-number to rect"); - } - CarpetContext cc = (CarpetContext)c; + return (c_, t_) -> new LazyListValue() { final int minx = cx-sminx; @@ -2364,6 +2364,7 @@ public class CarpetExpression final int maxx = cx+smaxx; final int maxy = cy+smaxy; final int maxz = cz+smaxz; + int x; int y; int z; @@ -2423,10 +2424,9 @@ public class CarpetExpression this.expr.addLazyFunction("diamond", -1, (c, t, lv)-> { CarpetContext cc = (CarpetContext)c; - if (lv.size() != 3 && lv.size() != 4 && lv.size() != 5) - { - throw new InternalExpressionException("'diamond' region should be specified with 3 to 5 coordinates"); - } + + BlockArgument cposLocator=BlockArgument.findIn((CarpetContext)c,lv,0); + BlockPos cpos = cposLocator.block.getPos(); int cx; int cy; @@ -2435,10 +2435,11 @@ public class CarpetExpression int height; try { - cx = (int)((NumericValue) lv.get(0).evalValue(c)).getLong(); - cy = (int)((NumericValue) lv.get(1).evalValue(c)).getLong(); - cz = (int)((NumericValue) lv.get(2).evalValue(c)).getLong(); - if (lv.size()==3) + cx = cpos.getX(); + cy = cpos.getY(); + cz = cpos.getZ(); + + if (lv.size()==1+cposLocator.offset) { Value retval = ListValue.of( BlockValue.fromCoords(cc, cx, cy-1, cz), @@ -2451,15 +2452,17 @@ public class CarpetExpression ); return (_c, _t ) -> retval; } - else if (lv.size()==4) + else if (lv.size()==2+cposLocator.offset) { - width = (int) ((NumericValue) lv.get(3).evalValue(c)).getLong(); + width = (int) ((NumericValue) lv.get(cposLocator.offset).evalValue(c)).getLong(); height = 0; } - else // size == 5 + else if(lv.size()==3+cposLocator.offset) { - width = (int) ((NumericValue) lv.get(3).evalValue(c)).getLong(); - height = (int) ((NumericValue) lv.get(4).evalValue(c)).getLong(); + width = (int) ((NumericValue) lv.get(cposLocator.offset).evalValue(c)).getLong(); + height = (int) ((NumericValue) lv.get(cposLocator.offset+1).evalValue(c)).getLong(); + } else{ + throw new InternalExpressionException("Incorrect number of arguments for diamond"); } } catch (ClassCastException exc) From 7764217710a1e3a22655384801a4e8d562b0cf9a Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Jun 2020 13:08:34 -0300 Subject: [PATCH 2/3] fixing diamonds --- docs/scarpet/Full.md | 19 ++--- docs/scarpet/api/BlockIterations.md | 17 ++-- .../java/carpet/script/CarpetExpression.java | 78 +++++++++++-------- 3 files changed, 65 insertions(+), 49 deletions(-) diff --git a/docs/scarpet/Full.md b/docs/scarpet/Full.md index e74e1dad..641319a0 100644 --- a/docs/scarpet/Full.md +++ b/docs/scarpet/Full.md @@ -2330,7 +2330,7 @@ This function is tentative - will likely change when chunk ticket API is properl These functions help scan larger areas of blocks without using generic loop functions, like nested `loop`. -### `scan(cx, cy, cz, dx, dy, dz, px?, py?, pz?, expr)`, `scan(center, range, lower_range?, expr)` +### `scan(center, range, lower_range?, expr)` Evaluates expression over area of blocks defined by its center `center = (cx, cy, cz)`, expanded in all directions by `range = (dx, dy, dz)` blocks, or optionally in negative with `range` coords, and `upper_range` coords in @@ -2346,7 +2346,7 @@ which would cause the expression not be evaluated for their boolean value. `scan` also handles `continue` and `break` statements, using `continue`'s return value to use in place of expression return value. `break` return value has no effect. -### `volume(x1, y1, z1, x2, y2, z2, expr), volume(pos1, pos2, expr)` +### `volume(from_pos, to_pos, expr)` Evaluates expression for each block in the area, the same as the `scan` function, but using two opposite corners of the rectangular cuboid. Any corners can be specified, its like you would do with `/fill` command. @@ -2354,7 +2354,7 @@ You can use a position or three coordinates to specify, it doesn't matter. For return value and handling `break` and `continue` statements, see `scan` function above. -### `neighbours(x, y, z), neighbours(block), neighbours(l(x,y,z))` +### `neighbours(pos)` Returns the list of 6 neighbouring blocks to the argument. Commonly used with other loop functions like `for`. @@ -2362,19 +2362,20 @@ Returns the list of 6 neighbouring blocks to the argument. Commonly used with ot for(neighbours(x,y,z),air(_)) => 4 // number of air blocks around a block -### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?), rect(centre, difference?, positive_diff?)` +### `rect(centre, range?, positive_range?)` Returns an iterator, just like `range` function that iterates over a rectangular area of blocks. If only center -point is specified, it iterates over 27 blocks. If `d` (`difference`) arguments are specified, expands selection by the respective -number of blocks in each direction. If `p` (`positive_diff`) arguments are specified, it uses `d` (`difference`) for negative offset, and `p` for positive. +point is specified, it iterates over 27 blocks. If `range` arguments are specified, expands selection by the respective +number of blocks in each direction. If `positive_range` arguments are specified, + it uses `range` for negative offset, and `positive_range` for positive. `centre` can be defined either as three coordinates, a list of three coords, or a block value. -`difference` and `positive_diff` can have the same representations, just if its a block, it computes the distance to the center +`range` and `positive_range` can have the same representations, just if its a block, it computes the distance to the center as range instead of taking the values as is.` -### `diamond(cx, cy, cz, radius?, height?), diamond(centre, radius?, height?)` +### `diamond(centre_pos, radius?, height?)` -Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle `centre = l(cx, cy, cz)` +Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle (block + neighbours). With a radius specified, it expands shape on x and z coords, and with a custom height, on y. Any of these can be zero as well. radius of 0 makes a stick, height of 0 makes a diamond shape pad. # Entity API diff --git a/docs/scarpet/api/BlockIterations.md b/docs/scarpet/api/BlockIterations.md index d8f87e25..29d39cf3 100644 --- a/docs/scarpet/api/BlockIterations.md +++ b/docs/scarpet/api/BlockIterations.md @@ -2,7 +2,7 @@ These functions help scan larger areas of blocks without using generic loop functions, like nested `loop`. -### `scan(cx, cy, cz, dx, dy, dz, px?, py?, pz?, expr)`, `scan(center, range, lower_range?, expr)` +### `scan(center, range, lower_range?, expr)` Evaluates expression over area of blocks defined by its center `center = (cx, cy, cz)`, expanded in all directions by `range = (dx, dy, dz)` blocks, or optionally in negative with `range` coords, and `upper_range` coords in @@ -18,7 +18,7 @@ which would cause the expression not be evaluated for their boolean value. `scan` also handles `continue` and `break` statements, using `continue`'s return value to use in place of expression return value. `break` return value has no effect. -### `volume(x1, y1, z1, x2, y2, z2, expr), volume(pos1, pos2, expr)` +### `volume(from_pos, to_pos, expr)` Evaluates expression for each block in the area, the same as the `scan` function, but using two opposite corners of the rectangular cuboid. Any corners can be specified, its like you would do with `/fill` command. @@ -26,7 +26,7 @@ You can use a position or three coordinates to specify, it doesn't matter. For return value and handling `break` and `continue` statements, see `scan` function above. -### `neighbours(x, y, z), neighbours(block), neighbours(l(x,y,z))` +### `neighbours(pos)` Returns the list of 6 neighbouring blocks to the argument. Commonly used with other loop functions like `for`. @@ -34,17 +34,18 @@ Returns the list of 6 neighbouring blocks to the argument. Commonly used with ot for(neighbours(x,y,z),air(_)) => 4 // number of air blocks around a block -### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?), rect(centre, difference?, positive_diff?)` +### `rect(centre, range?, positive_range?)` Returns an iterator, just like `range` function that iterates over a rectangular area of blocks. If only center -point is specified, it iterates over 27 blocks. If `d` (`difference`) arguments are specified, expands selection by the respective -number of blocks in each direction. If `p` (`positive_diff`) arguments are specified, it uses `d` (`difference`) for negative offset, and `p` for positive. +point is specified, it iterates over 27 blocks. If `range` arguments are specified, expands selection by the respective +number of blocks in each direction. If `positive_range` arguments are specified, + it uses `range` for negative offset, and `positive_range` for positive. `centre` can be defined either as three coordinates, a list of three coords, or a block value. -`difference` and `positive_diff` can have the same representations, just if its a block, it computes the distance to the center +`range` and `positive_range` can have the same representations, just if its a block, it computes the distance to the center as range instead of taking the values as is.` -### `diamond(cx, cy, cz, radius?, height?), diamond(centre, radius?, height?)` +### `diamond(centre_pos, radius?, height?)` Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle (block + neighbours). With a radius specified, it expands shape on x and z coords, and with a custom height, on y. diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 04e2be88..ec802386 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -119,6 +119,7 @@ import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.EulerAngle; import net.minecraft.util.math.BlockBox; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.util.registry.Registry; @@ -2227,8 +2228,8 @@ public class CarpetExpression BlockArgument pos1Locator = BlockArgument.findIn(cc, lv, 0); BlockArgument pos2Locator = BlockArgument.findIn(cc, lv, pos1Locator.offset); - BlockPos pos2 = pos2Locator.block.getPos(); BlockPos pos1 = pos1Locator.block.getPos(); + BlockPos pos2 = pos2Locator.block.getPos(); int x1 = pos1.getX(); int y1 = pos1.getY(); @@ -2313,41 +2314,54 @@ public class CarpetExpression this.expr.addLazyFunction("rect", -1, (c, t, lv)-> { CarpetContext cc = (CarpetContext) c; - - int cx; - int cy; - int cz; - int sminx; - int sminy; - int sminz; - int smaxx; - int smaxy; - int smaxz; - + int cx, cy, cz; + int sminx, sminy, sminz; + int smaxx, smaxy, smaxz; BlockArgument cposLocator = BlockArgument.findIn(cc, lv, 0); BlockPos cpos = cposLocator.block.getPos(); - cx = cpos.getX(); cy = cpos.getY(); cz = cpos.getZ(); - - if(lv.size()>cposLocator.offset){ - BlockArgument diff_Locator = BlockArgument.findIn(cc, lv, cposLocator.offset); - BlockPos difference = diff_Locator.block.getPos(); - sminx = difference.getX(); - sminy = difference.getY(); - sminz = difference.getZ(); - if(lv.size()>diff_Locator.offset){ - BlockPos pos_diff=BlockArgument.findIn(cc,lv,diff_Locator.offset).block.getPos(); - smaxx = pos_diff.getX(); - smaxy = pos_diff.getY(); - smaxz = pos_diff.getZ(); - }else{ + if (lv.size() > cposLocator.offset) + { + Vector3Argument diffLocator = Vector3Argument.findIn(cc, lv, cposLocator.offset); + if (diffLocator.fromBlock) + { + sminx = MathHelper.floor(abs(diffLocator.vec.x - cx)); + sminy = MathHelper.floor(abs(diffLocator.vec.y - cx)); + sminz = MathHelper.floor(abs(diffLocator.vec.z - cx)); + } + else + { + sminx = MathHelper.floor(abs(diffLocator.vec.x)); + sminy = MathHelper.floor(abs(diffLocator.vec.y)); + sminz = MathHelper.floor(abs(diffLocator.vec.z)); + } + if (lv.size() > diffLocator.offset) + { + Vector3Argument posDiff = Vector3Argument.findIn(cc, lv, diffLocator.offset); + if (posDiff.fromBlock) + { + smaxx = MathHelper.floor(abs(posDiff.vec.x - cx)); + smaxy = MathHelper.floor(abs(posDiff.vec.y - cx)); + smaxz = MathHelper.floor(abs(posDiff.vec.z - cx)); + } + else + { + smaxx = MathHelper.floor(abs(posDiff.vec.x)); + smaxy = MathHelper.floor(abs(posDiff.vec.y)); + smaxz = MathHelper.floor(abs(posDiff.vec.z)); + } + } + else + { smaxx = sminx; smaxy = sminy; smaxz = sminz; } - }else{ + } + else + { sminx = 1; sminy = 1; sminz = 1; @@ -2439,7 +2453,7 @@ public class CarpetExpression cy = cpos.getY(); cz = cpos.getZ(); - if (lv.size()==1+cposLocator.offset) + if (lv.size()==cposLocator.offset) { Value retval = ListValue.of( BlockValue.fromCoords(cc, cx, cy-1, cz), @@ -2452,22 +2466,22 @@ public class CarpetExpression ); return (_c, _t ) -> retval; } - else if (lv.size()==2+cposLocator.offset) + else if (lv.size()==1+cposLocator.offset) { width = (int) ((NumericValue) lv.get(cposLocator.offset).evalValue(c)).getLong(); height = 0; } - else if(lv.size()==3+cposLocator.offset) + else if(lv.size()==2+cposLocator.offset) { width = (int) ((NumericValue) lv.get(cposLocator.offset).evalValue(c)).getLong(); height = (int) ((NumericValue) lv.get(cposLocator.offset+1).evalValue(c)).getLong(); } else{ - throw new InternalExpressionException("Incorrect number of arguments for diamond"); + throw new InternalExpressionException("Incorrect number of arguments for 'diamond'"); } } catch (ClassCastException exc) { - throw new InternalExpressionException("Attempted to pass a non-number to diamond"); + throw new InternalExpressionException("Attempted to pass a non-number to 'diamond'"); } if (height == 0) { From aeb67d118676ca56a01027d56d7eae833b9cad78 Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 17 Jun 2020 16:57:32 -0300 Subject: [PATCH 3/3] 1.3.32 --- gradle.properties | 2 +- src/main/java/carpet/CarpetSettings.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 99380f82..21a06bdd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.8.7+build.201 # Mod Properties - mod_version = 1.3.31+v200616 + mod_version = 1.3.32+v200617 maven_group = carpet archives_base_name = fabric-carpet diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index e6ef5646..eb930cc1 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -34,7 +34,7 @@ import static carpet.settings.RuleCategory.CLIENT; @SuppressWarnings("CanBeFinal") public class CarpetSettings { - public static final String carpetVersion = "1.3.31+v200616"; + public static final String carpetVersion = "1.3.32+v200617"; public static final Logger LOG = LogManager.getLogger(); public static boolean skipGenerationChecks = false; public static boolean impendingFillSkipUpdates = false; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 099e824f..47b892d0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "carpet", - "version": "1.3.31", + "version": "1.3.32", "name": "Carpet Mod in Fabric", "description": "Carpet made out of fabric",