2022-09-28 10:09:38 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Baritone.
|
|
|
|
*
|
|
|
|
* Baritone is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Baritone is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package baritone.utils.schematic.litematica;
|
|
|
|
|
2022-09-28 12:15:48 +00:00
|
|
|
import fi.dy.masa.litematica.Litematica;
|
2022-09-30 11:32:31 +00:00
|
|
|
import fi.dy.masa.litematica.data.DataManager;
|
2022-09-28 10:09:38 +00:00
|
|
|
import fi.dy.masa.litematica.schematic.placement.SchematicPlacement;
|
2022-09-30 11:32:31 +00:00
|
|
|
import fi.dy.masa.litematica.schematic.placement.SchematicPlacementManager;
|
2022-09-28 10:09:38 +00:00
|
|
|
import net.minecraft.util.math.Vec3i;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.List;
|
|
|
|
|
2022-09-30 11:32:31 +00:00
|
|
|
public final class LitematicaHelper {
|
2022-09-28 10:09:38 +00:00
|
|
|
public static boolean isLitematicaPresent() {
|
|
|
|
try {
|
2022-09-28 12:15:48 +00:00
|
|
|
Class.forName(Litematica.class.getName());
|
2022-09-28 10:09:38 +00:00
|
|
|
return true;
|
|
|
|
} catch (ClassNotFoundException | NoClassDefFoundError ex) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2022-09-30 11:32:31 +00:00
|
|
|
//TODO compact into one line when debugging is done
|
|
|
|
public static boolean hasLoadedSchematic() {
|
|
|
|
System.out.println("start checking for schematic"); //TODO debug line remove
|
|
|
|
SchematicPlacementManager a = DataManager.getSchematicPlacementManager();
|
|
|
|
System.out.println("manager aquired"); //TODO debug line remove
|
|
|
|
List< SchematicPlacement> b = a.getAllSchematicPlacements();
|
|
|
|
System.out.println("list aquired"); //TODO debug line remove
|
|
|
|
return b.size()>0;
|
2022-09-28 10:09:38 +00:00
|
|
|
}
|
2022-09-30 11:32:31 +00:00
|
|
|
public static String getName(int i) {
|
|
|
|
return DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getName();
|
|
|
|
}
|
|
|
|
public static Vec3i getOrigin(int i) {
|
2022-09-28 10:09:38 +00:00
|
|
|
int x,y,z;
|
2022-09-30 11:32:31 +00:00
|
|
|
x=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getX();
|
|
|
|
y=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getY();
|
|
|
|
z=DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getOrigin().getZ();
|
2022-09-28 10:09:38 +00:00
|
|
|
return new Vec3i(x,y,z);
|
|
|
|
}
|
2022-09-30 11:32:31 +00:00
|
|
|
public static File getSchematicFile(int i) {
|
|
|
|
return DataManager.getSchematicPlacementManager().getAllSchematicPlacements().get(i).getSchematicFile();
|
2022-09-28 10:09:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|