final changes

This commit is contained in:
rycbar0 2022-10-03 21:39:53 +02:00
parent 5cd1c9d15d
commit f9c5386e7a
3 changed files with 11 additions and 9 deletions

View File

@ -35,10 +35,10 @@ public class LitematicaCommand extends Command {
@Override @Override
public void execute(String label, IArgConsumer args) throws CommandException { public void execute(String label, IArgConsumer args) throws CommandException {
int schematic = 0; int schematic = 0;
if(args.hasAny()) { if (args.hasAny()) {
args.requireMax(1); args.requireMax(1);
if (args.is(Integer.class)) { if (args.is(Integer.class)) {
schematic = args.getAs(Integer.class)-1; schematic = args.getAs(Integer.class) - 1;
} }
} }
try { try {

View File

@ -81,7 +81,7 @@ public enum DefaultSchematicFormats implements ISchematicFormat {
return new LitematicaSchematic(nbt, false); return new LitematicaSchematic(nbt, false);
case 5: //1.13-1.17 case 5: //1.13-1.17
case 6: //1.18+ case 6: //1.18+
throw new UnsupportedOperationException("This litematic Verion is to new."); throw new UnsupportedOperationException("This litematic Verion is too new.");
default: default:
throw new UnsupportedOperationException("Unsuported Version of a Litematica Schematic"); throw new UnsupportedOperationException("Unsuported Version of a Litematica Schematic");
} }

View File

@ -32,8 +32,9 @@ import javax.annotation.Nullable;
import java.util.Optional; import java.util.Optional;
/** /**
* @author Emerson * Based on EmersonDove's work
* @since 12/27/2020 * <a href="https://github.com/cabaletta/baritone/pull/2544">...</a>
*
* @author rycbar * @author rycbar
* @since 22.09.2022 * @since 22.09.2022
*/ */
@ -43,7 +44,7 @@ public final class LitematicaSchematic extends StaticSchematic {
/** /**
* @param nbtTagCompound a decompressed file stream aka nbt data. * @param nbtTagCompound a decompressed file stream aka nbt data.
* @param rotated if the schematic is rotated by 90° aka x and z size are switched. * @param rotated if the schematic is rotated by 90°.
*/ */
public LitematicaSchematic(NBTTagCompound nbtTagCompound, boolean rotated) { public LitematicaSchematic(NBTTagCompound nbtTagCompound, boolean rotated) {
this.nbt = nbtTagCompound; this.nbt = nbtTagCompound;
@ -167,10 +168,10 @@ public final class LitematicaSchematic extends StaticSchematic {
* @return if the current block is part of the subregion. * @return if the current block is part of the subregion.
*/ */
private static boolean inSubregion(NBTTagCompound nbt, String subReg, int x, int y, int z) { private static boolean inSubregion(NBTTagCompound nbt, String subReg, int x, int y, int z) {
return return x >= 0 && y >= 0 && z >= 0 &&
x < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("x")) && x < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("x")) &&
y < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("y")) && y < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("y")) &&
z < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("z")); z < Math.abs(nbt.getCompoundTag("Regions").getCompoundTag(subReg).getCompoundTag("Size").getInteger("z"));
} }
/** /**
@ -273,6 +274,7 @@ public final class LitematicaSchematic extends StaticSchematic {
/** /**
* @author maruohon * @author maruohon
* Class from the Litematica mod by maruohon * Class from the Litematica mod by maruohon
* Usage under LGPLv3 with the permission of the author.
* <a href="https://github.com/maruohon/litematica">...</a> * <a href="https://github.com/maruohon/litematica">...</a>
*/ */
private static class LitematicaBitArray { private static class LitematicaBitArray {