20w17a
This commit is contained in:
1 parent
d749bbe3ff
commit
f2e9a9de91
16 files changed
+75
-58
No files matched your search
@@ -15,6 +15,7 @@ import carpet.utils.Messenger;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import net.minecraft.class_5218;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class CarpetScriptServer
|
||||
|
||||
public Module getModule(String name, boolean allowLibraries)
|
||||
{
|
||||
File folder = CarpetServer.minecraft_server.method_27050().resolve("scripts").toFile();
|
||||
File folder = CarpetServer.minecraft_server.method_27050(class_5218.field_24188).resolve("scripts").toFile();
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
if (listOfFiles != null)
|
||||
for (File script : listOfFiles)
|
||||
@@ -109,7 +110,7 @@ public class CarpetScriptServer
|
||||
if (!mi.isLibrary()) moduleNames.add(mi.getName());
|
||||
}
|
||||
}
|
||||
File folder = CarpetServer.minecraft_server.method_27050().resolve("scripts").toFile();
|
||||
File folder = CarpetServer.minecraft_server.method_27050(class_5218.field_24188).resolve("scripts").toFile();
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
if (listOfFiles == null)
|
||||
return moduleNames;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package carpet.script.bundled;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.minecraft.class_5218;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
||||
import java.io.File;
|
||||
@@ -34,7 +35,7 @@ public abstract class Module
|
||||
public static Tag getData(Module module, String file, boolean isShared)
|
||||
{
|
||||
if (!isShared && (module == null || module.getName() == null)) return null;
|
||||
File dataFile = CarpetServer.minecraft_server.method_27050().resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
|
||||
File dataFile = CarpetServer.minecraft_server.method_27050(class_5218.field_24188).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
|
||||
if (!Files.exists(dataFile.toPath()) || !(dataFile.isFile())) return null;
|
||||
return read(dataFile);
|
||||
}
|
||||
@@ -42,7 +43,7 @@ public abstract class Module
|
||||
public static boolean saveData(Module module, String file, Tag globalState, boolean isShared)
|
||||
{
|
||||
if (!isShared && (module == null || module.getName() == null)) return false;
|
||||
File dataFile =CarpetServer.minecraft_server.method_27050().resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
|
||||
File dataFile =CarpetServer.minecraft_server.method_27050(class_5218.field_24188).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
|
||||
if (!Files.exists(dataFile.toPath().getParent()) && !dataFile.getParentFile().mkdirs()) return false;
|
||||
return write(globalState, dataFile);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package carpet.script.utils;
|
||||
|
||||
import carpet.fakes.MinecraftServerInterface;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
@@ -24,9 +25,7 @@ public class WorldTools
|
||||
if (region == null) return false;
|
||||
return region.hasChunk(chpos);
|
||||
}
|
||||
Path regionPath = world.getDimension().getType().getSaveDirectory(
|
||||
world.getSaveHandler().getWorldDir()
|
||||
).toPath().resolve("region");
|
||||
Path regionPath = new File(((MinecraftServerInterface )world.getServer()).getCMSession().method_27424(world.getDimension().getType()), "region").toPath();
|
||||
Path regionFilePath = regionPath.resolve(currentRegionName);
|
||||
File regionFile = regionFilePath.toFile();
|
||||
if (!regionFile.exists())
|
||||
|
||||
Reference in new issue
Block a user