moved everything to switch statement
It all works now
This commit is contained in:
1 parent
33f6b90839
commit
a1b6ef204a
1 file changed
+19
-61
@@ -289,44 +289,22 @@ public class DrawCommand
|
|||||||
private static int drawCircle(ServerCommandSource source, BlockPos pos, int offset, int radius,BlockStateArgument block, String orientation,
|
private static int drawCircle(ServerCommandSource source, BlockPos pos, int offset, int radius,BlockStateArgument block, String orientation,
|
||||||
Predicate<CachedBlockPosition> replacement, List<BlockPos> list, BlockPos.Mutable mbpos){
|
Predicate<CachedBlockPosition> replacement, List<BlockPos> list, BlockPos.Mutable mbpos){
|
||||||
int successes=0;
|
int successes=0;
|
||||||
if(orientation=="x"){
|
for(int axis1=-radius;axis1<=radius;++axis1){
|
||||||
for(int y=-radius;y<=radius;++y){
|
|
||||||
|
|
||||||
for(int z=-radius;z<=radius;++z){
|
for(int axis2=-radius;axis2<=radius;++axis2){
|
||||||
|
|
||||||
if(y*y+z*z<=radius*radius){
|
if(axis1*axis1+axis2*axis2<=radius*radius){
|
||||||
successes+=blockset(source, pos.getX()+offset, pos.getY()+y, pos.getZ()+z, replacement, list, mbpos, block);
|
switch (orientation){
|
||||||
}
|
case "x":successes+=blockset(source, pos.getX()+offset, pos.getY()+axis1, pos.getZ()+axis2,replacement, list, mbpos, block);break;
|
||||||
}
|
case "y":successes+=blockset(source, pos.getX()+axis1, pos.getY()+offset, pos.getZ()+axis2,replacement, list, mbpos, block);break;
|
||||||
}
|
case "z":successes+=blockset(source, pos.getX()+axis2, pos.getY()+axis1, pos.getZ()+offset,replacement, list, mbpos, block);break;
|
||||||
}
|
default:Messenger.m(source,"gi Invalid orientation, must be x, y or z");return 0;
|
||||||
|
|
||||||
if(orientation=="y"){
|
|
||||||
for(int x=-radius;x<=radius;++x){
|
|
||||||
|
|
||||||
for(int z=-radius;z<=radius;++z){
|
|
||||||
|
|
||||||
if(x*x+z*z<=radius*radius){
|
|
||||||
successes+=blockset(source, pos.getX()+x, pos.getY()+offset, pos.getZ()+z, replacement, list, mbpos, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(orientation=="z"){
|
|
||||||
for(int y=-radius;y<=radius;++y){
|
|
||||||
|
|
||||||
for(int x=-radius;x<=radius;++x){
|
|
||||||
|
|
||||||
if(y*y+x*x<=radius*radius){
|
|
||||||
successes+=blockset(source, pos.getX()+x, pos.getY()+y, pos.getZ()+offset, replacement, list, mbpos, block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return successes;
|
return successes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int drawSquare(ServerCommandSource source, BlockPos pos, int offset, int radius, BlockStateArgument block, String orientation,
|
private static int drawSquare(ServerCommandSource source, BlockPos pos, int offset, int radius, BlockStateArgument block, String orientation,
|
||||||
Predicate<CachedBlockPosition> replacement, List<BlockPos> list, BlockPos.Mutable mbpos){
|
Predicate<CachedBlockPosition> replacement, List<BlockPos> list, BlockPos.Mutable mbpos){
|
||||||
int success=0;
|
int success=0;
|
||||||
@@ -334,14 +312,11 @@ public class DrawCommand
|
|||||||
for(int axis1=-radius;axis1<=radius;++axis1){
|
for(int axis1=-radius;axis1<=radius;++axis1){
|
||||||
|
|
||||||
for(int axis2=-radius;axis2<=radius;++axis2){
|
for(int axis2=-radius;axis2<=radius;++axis2){
|
||||||
if(orientation=="x"){
|
switch (orientation){
|
||||||
success+=blockset(source, pos.getX()+offset, pos.getY()+axis1, pos.getZ()+axis2,replacement, list, mbpos, block);
|
case "x":success+=blockset(source, pos.getX()+offset, pos.getY()+axis1, pos.getZ()+axis2,replacement, list, mbpos, block);break;
|
||||||
}
|
case "y":success+=blockset(source, pos.getX()+axis1, pos.getY()+offset, pos.getZ()+axis2,replacement, list, mbpos, block);break;
|
||||||
if(orientation=="y"){
|
case "z":success+=blockset(source, pos.getX()+axis2, pos.getY()+axis1, pos.getZ()+offset,replacement, list, mbpos, block);break;
|
||||||
success+=blockset(source, pos.getX()+axis1, pos.getY()+offset, pos.getZ()+axis2,replacement, list, mbpos, block);
|
default:Messenger.m(source,"gi Invalid orientation, must be x, y or z");return 0;
|
||||||
}
|
|
||||||
if(orientation=="z"){
|
|
||||||
success+=blockset(source, pos.getX()+axis2, pos.getY()+axis1, pos.getZ()+offset,replacement, list, mbpos, block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,17 +341,6 @@ public class DrawCommand
|
|||||||
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
|
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
|
||||||
|
|
||||||
int r = radius;
|
int r = radius;
|
||||||
|
|
||||||
switch (orientation){
|
|
||||||
case "x":break;
|
|
||||||
case "y":break;
|
|
||||||
case "z":break;
|
|
||||||
default:{
|
|
||||||
Messenger.m(source,"gi Invalid orientation, must be x,y or z");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for(int i =0; i<height;++i) {
|
for(int i =0; i<height;++i) {
|
||||||
if(pointup){
|
if(pointup){
|
||||||
@@ -385,18 +349,12 @@ public class DrawCommand
|
|||||||
r=radius*i/height;
|
r=radius*i/height;
|
||||||
}
|
}
|
||||||
switch(shape){
|
switch(shape){
|
||||||
case "circle":{
|
case "circle":affected+=drawCircle(source, pos, i, (int) Math.round(r), block, orientation, replacement, list, mbpos);break;
|
||||||
affected+=drawCircle(source, pos, i, (int) Math.round(r), block, orientation, replacement, list, mbpos);
|
|
||||||
Messenger.m(source,"gi Test circle "+shape+" I hope this works");
|
case "square":affected+=drawSquare(source, pos, i, (int) Math.round(r), block, orientation, replacement, list, mbpos);break;
|
||||||
}
|
|
||||||
case "square":{
|
default:Messenger.m(source,"gi "+shape+" is an incorrect shape, read options for which shapes are available");return 0;
|
||||||
affected+=drawSquare(source, pos, i, (int) Math.round(r), block, orientation, replacement, list, mbpos);
|
|
||||||
Messenger.m(source,"gi Test circle "+shape+" I hope this works");
|
|
||||||
}
|
|
||||||
/*default:{
|
|
||||||
Messenger.m(source,"gi !"+shape+"| is an incorrect shape, read options for which shapes are available");
|
|
||||||
return 0;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user