This commit is contained in:
gnembon committed 2020-06-04 15:59:46 -03:00
1 parent 0a21c4fa21
commit c61429099a
24 files changed
+54 -54

No files matched your search

@@ -198,7 +198,7 @@ public class CarpetEventServer
{
handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(World.field_25179))
withWorld(CarpetServer.minecraft_server.getWorld(World.OVERWORLD))
);
}
},
@@ -209,7 +209,7 @@ public class CarpetEventServer
{
handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(World.field_25180))
withWorld(CarpetServer.minecraft_server.getWorld(World.NETHER))
);
}
},
@@ -220,7 +220,7 @@ public class CarpetEventServer
{
handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(World.field_25181))
withWorld(CarpetServer.minecraft_server.getWorld(World.END))
);
}
},
@@ -2697,7 +2697,7 @@ public class CarpetExpression
for (int i=2; i < lv.size(); i++) paramList.add(lv.get(i).evalValue(c));
params = ShapeDispatcher.parseParams(paramList);
}
params.putIfAbsent("dim", new StringValue(cc.s.getWorld().method_27983().getValue().toString()));
params.putIfAbsent("dim", new StringValue(cc.s.getWorld().getRegistryKey().getValue().toString()));
params.putIfAbsent("duration", duration);
ShapeDispatcher.ExpiringShape shape = ShapeDispatcher.create(cc, shapeType, params);
@@ -2983,7 +2983,7 @@ public class CarpetExpression
this.expr.addLazyFunction("current_dimension", 0, (c, t, lv) -> {
ServerCommandSource s = ((CarpetContext)c).s;
Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(s.getWorld().method_27983().getValue())); // getDImensionType
Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(s.getWorld().getRegistryKey().getValue())); // getDImensionType
return (cc, tt) -> retval;
});
@@ -3020,15 +3020,15 @@ public class CarpetExpression
{
case "nether":
case "the_nether":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.field_25180)); //nether
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.NETHER)); //nether
break;
case "end":
case "the_end":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.field_25181)); //end
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.END)); //end
break;
case "overworld":
case "over_world":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.field_25179)); //ow
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(World.OVERWORLD)); //ow
break;
default:
throw new InternalExpressionException("Incorrect dimension string: "+dimString);
@@ -76,7 +76,7 @@ public class CarpetScriptServer
public Module getModule(String name, boolean allowLibraries)
{
File folder = CarpetServer.minecraft_server.method_27050(WorldSavePath.ROOT).resolve("scripts").toFile();
File folder = CarpetServer.minecraft_server.getSavePath(WorldSavePath.ROOT).resolve("scripts").toFile();
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null)
for (File script : listOfFiles)
@@ -110,7 +110,7 @@ public class CarpetScriptServer
if (!mi.isLibrary()) moduleNames.add(mi.getName());
}
}
File folder = CarpetServer.minecraft_server.method_27050(WorldSavePath.ROOT).resolve("scripts").toFile();
File folder = CarpetServer.minecraft_server.getSavePath(WorldSavePath.ROOT).resolve("scripts").toFile();
File[] listOfFiles = folder.listFiles();
if (listOfFiles == null)
return moduleNames;
@@ -35,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(WorldSavePath.ROOT).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
File dataFile = CarpetServer.minecraft_server.getSavePath(WorldSavePath.ROOT).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
if (!Files.exists(dataFile.toPath()) || !(dataFile.isFile())) return null;
return read(dataFile);
}
@@ -43,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(WorldSavePath.ROOT).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
File dataFile =CarpetServer.minecraft_server.getSavePath(WorldSavePath.ROOT).resolve("scripts/"+getDescriptor(module, file, isShared)+".nbt").toFile();
if (!Files.exists(dataFile.toPath().getParent()) && !dataFile.getParentFile().mkdirs()) return false;
return write(globalState, dataFile);
}
@@ -41,16 +41,16 @@ public class ShapesRenderer
{
this.client = minecraftClient;
shapes = new HashMap<>();
shapes.put(World.field_25179, new Int2ObjectOpenHashMap<>());
shapes.put(World.field_25180, new Int2ObjectOpenHashMap<>());
shapes.put(World.field_25181, new Int2ObjectOpenHashMap<>());
shapes.put(World.OVERWORLD, new Int2ObjectOpenHashMap<>());
shapes.put(World.NETHER, new Int2ObjectOpenHashMap<>());
shapes.put(World.END, new Int2ObjectOpenHashMap<>());
}
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, double cameraX, double cameraY, double cameraZ)
{
//Camera camera = this.client.gameRenderer.getCamera();
ClientWorld iWorld = this.client.world;
RegistryKey<World> dimensionType = iWorld.method_27983();
RegistryKey<World> dimensionType = iWorld.getRegistryKey();
if (shapes.get(dimensionType).isEmpty()) return;
long currentTime = client.world.getTime();
RenderSystem.disableTexture();
@@ -168,7 +168,7 @@ public class ShapesRenderer
{
if (shape.followEntity <=0 ) return true;
if (client.world == null) return false;
if (client.world.method_27983() != dim) return false;
if (client.world.getRegistryKey() != dim) return false;
if (client.world.getEntityById(shape.followEntity) == null) return false;
return true;
}
@@ -25,7 +25,7 @@ public class WorldTools
if (region == null) return false;
return region.hasChunk(chpos);
}
Path regionPath = new File(((MinecraftServerInterface )world.getServer()).getCMSession().method_27424(world.method_27983()), "region").toPath();
Path regionPath = new File(((MinecraftServerInterface )world.getServer()).getCMSession().method_27424(world.getRegistryKey()), "region").toPath();
Path regionFilePath = regionPath.resolve(currentRegionName);
File regionFile = regionFilePath.toFile();
if (!regionFile.exists())
@@ -169,7 +169,7 @@ public class BlockValue extends Value
public int hashCode()
{
if (world != null && pos != null )
return GlobalPos.create(world.method_27983() , pos).hashCode(); //getDimension().getType()
return GlobalPos.create(world.getRegistryKey() , pos).hashCode(); //getDimension().getType()
return ("b"+getString()).hashCode();
}
@@ -249,7 +249,7 @@ public class EntityValue extends Value
put("immune_to_fire", (e, a) -> new NumericValue(e.isFireImmune()));
put("invulnerable", (e, a) -> new NumericValue(e.isInvulnerable()));
put("dimension", (e, a) -> new StringValue(nameFromRegistryId(e.world.method_27983().getValue()))); // getDimId
put("dimension", (e, a) -> new StringValue(nameFromRegistryId(e.world.getRegistryKey().getValue()))); // getDimId
put("height", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).height));
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight()));