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

+2 -2
View File
@@ -5,8 +5,8 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html
minecraft_version=20w22a
yarn_mappings=20w22a+build.10
loader_version=0.8.5+build.199
yarn_mappings=20w22a+build.14
loader_version=0.8.6+build.200
# Mod Properties
mod_version = 1.3.25+v200527
+2 -2
View File
@@ -524,7 +524,7 @@ public class CarpetSettings
public static class ChangeSpawnChunksValidator extends Validator<Integer> {
public static void changeSpawnSize(int size)
{
ServerWorld overworld = CarpetServer.minecraft_server.getWorld(World.field_25179); // OW
ServerWorld overworld = CarpetServer.minecraft_server.getWorld(World.OVERWORLD); // OW
if (overworld != null) {
ChunkPos centerChunk = new ChunkPos(new BlockPos(
overworld.getLevelProperties().getSpawnX(),
@@ -546,7 +546,7 @@ public class CarpetSettings
//must been some startup thing
return newValue;
}
ServerWorld currentOverworld = CarpetServer.minecraft_server.getWorld(World.field_25179); // OW
ServerWorld currentOverworld = CarpetServer.minecraft_server.getWorld(World.OVERWORLD); // OW
if (currentOverworld != null)
{
changeSpawnSize(newValue);
@@ -238,7 +238,7 @@ public class PlayerCommand
);
RegistryKey<World> dimType = tryGetArg(
() -> DimensionArgumentType.getDimensionArgument(context, "dimension"),
() -> source.getWorld().method_27983() // dimension.getType()
() -> source.getWorld().getRegistryKey() // dimension.getType()
);
GameMode mode = GameMode.CREATIVE;
try
@@ -161,7 +161,7 @@ public class FeatureGenerator
structureToFeature.put(StructureFeature.VILLAGE, Arrays.asList("village", "village_desert", "village_savanna", "village_taiga", "village_snowy"));
structureToFeature.put(StructureFeature.MANSION, Collections.singletonList("mansion"));
structureToFeature.put(StructureFeature.BURIED_TREASURE, Collections.singletonList("treasure"));
structureToFeature.put(StructureFeature.field_24851, Collections.singletonList("witch_hut"));
structureToFeature.put(StructureFeature.SWAMP_HUT, Collections.singletonList("witch_hut"));
structureToFeature.put(StructureFeature.STRONGHOLD, Collections.singletonList("stronghold"));
structureToFeature.put(StructureFeature.DESERT_PYRAMID, Collections.singletonList("desert_temple"));
structureToFeature.put(StructureFeature.JUNGLE_PYRAMID, Collections.singletonList("jungle_temple"));
@@ -188,7 +188,7 @@ public class FeatureGenerator
put("igloo", ((StructureFeatureInterface)StructureFeature.IGLOO)::gridAnywhere);
put("shipwreck", gridCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS));
put("shipwreck2", gridCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS));
put("witch_hut", ((StructureFeatureInterface)StructureFeature.field_24851)::gridAnywhere);
put("witch_hut", ((StructureFeatureInterface)StructureFeature.SWAMP_HUT)::gridAnywhere);
put("stronghold", ((StructureFeatureInterface)StructureFeature.STRONGHOLD)::gridAnywhere);
put("ocean_ruin_small", gridCustomStructure(StructureFeature.OCEAN_RUIN,
@@ -308,7 +308,7 @@ public class FeatureGenerator
put("igloo", ((StructureFeatureInterface)StructureFeature.IGLOO)::plopAnywhere);
put("shipwreck", spawnCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS));
put("shipwreck2", spawnCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS));
put("witch_hut", ((StructureFeatureInterface)StructureFeature.field_24851)::plopAnywhere);
put("witch_hut", ((StructureFeatureInterface)StructureFeature.SWAMP_HUT)::plopAnywhere);
put("stronghold", ((StructureFeatureInterface)StructureFeature.STRONGHOLD)::plopAnywhere);
put("ocean_ruin_small", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
@@ -51,7 +51,7 @@ public class HopperCounter
{
if (startTick == 0)
{
startTick = server.getWorld(World.field_25179).getTime(); //OW
startTick = server.getWorld(World.OVERWORLD).getTime(); //OW
startMillis = System.currentTimeMillis();
}
Item item = stack.getItem();
@@ -62,7 +62,7 @@ public class HopperCounter
public void reset(MinecraftServer server)
{
counter.clear();
startTick = server.getWorld(World.field_25179).getTime(); //OW
startTick = server.getWorld(World.OVERWORLD).getTime(); //OW
startMillis = System.currentTimeMillis();
// pubSubProvider.publish();
}
@@ -106,7 +106,7 @@ public class HopperCounter
return Collections.singletonList(Messenger.s(String.format("No items for %s yet", color.getName())));
}
long total = getTotalItems();
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getWorld(World.field_25179).getTime() - startTick, 1); //OW
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getWorld(World.OVERWORLD).getTime() - startTick, 1); //OW
if (total == 0)
{
if (brief)
@@ -33,16 +33,16 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
{
if (CarpetSettings.flatWorldStructureSpawning)
{
if (accessor.method_28388(pos, true, StructureFeature.field_24851).hasChildren())
if (accessor.method_28388(pos, true, StructureFeature.SWAMP_HUT).hasChildren())
{ //swamp hut
if (group == SpawnGroup.MONSTER)
{
return StructureFeature.field_24851.getMonsterSpawns();
return StructureFeature.SWAMP_HUT.getMonsterSpawns();
}
if (group == SpawnGroup.CREATURE)
{
return StructureFeature.field_24851.getCreatureSpawns();
return StructureFeature.SWAMP_HUT.getCreatureSpawns();
}
}
@@ -49,7 +49,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
private int setupTracking(ChunkTicketManager chunkTicketManager)
{
int j = chunkTicketManager.getSpawningChunkCount();
RegistryKey<World> dim = this.world.method_27983(); // getDimensionType;
RegistryKey<World> dim = this.world.getRegistryKey(); // getDimensionType;
//((WorldInterface)world).getPrecookedMobs().clear(); not needed because mobs are compared with predefined BBs
SpawnReporter.chunkCounts.put(dim, j);
@@ -79,7 +79,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
{
for (SpawnGroup cat: SpawnGroup.values())
{
RegistryKey<World> dim = world.method_27983(); // getDimensionType;
RegistryKey<World> dim = world.getRegistryKey(); // getDimensionType;
Pair key = Pair.of(dim, cat);
int spawnTries = SpawnReporter.spawn_tries.get(cat);
if (!SpawnReporter.local_spawns.containsKey(cat))
@@ -95,7 +95,7 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
private void logPreviousCoordinates(RegistryKey<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{
previousLocation = getPos();
previousDimension = world.method_27983(); //dimension type
previousDimension = world.getRegistryKey(); //dimension type
}
@Inject(method = "changeDimension", at = @At("RETURN"))
@@ -105,7 +105,7 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
{
ServerPlayerEntity player = (ServerPlayerEntity) (Object)this;
Vec3d to = null;
if (!notInAnyWorld || previousDimension != World.field_25181 || newDimension != World.field_25179) // end ow
if (!notInAnyWorld || previousDimension != World.END || newDimension != World.OVERWORLD) // end ow
{
to = getPos();
}
@@ -281,7 +281,7 @@ public class SpawnHelperMixin
SpawnGroup entityCategory = var6[var8];
if ((spawnAnimals || !entityCategory.isPeaceful()) && (spawnMonsters || entityCategory.isPeaceful()) && (shouldSpawnAnimals || !entityCategory.isAnimal()) )
{
RegistryKey<World> dim = world.method_27983(); // getDimensionType;
RegistryKey<World> dim = world.getRegistryKey(); // getDimensionType;
int newCap = (int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4))));
int int_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning
int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits
@@ -120,7 +120,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
if (itemStack_1.getItem() == Items.EMERALD)
{
GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null);
if (bedPos == null || bedPos.getDimension() != world.method_27983()) // get DImension
if (bedPos == null || bedPos.getDimension() != world.getRegistryKey()) // get DImension
{
sayNo();
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
@@ -74,7 +74,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
playerShadow.dataTracker.set(PLAYER_MODEL_PARTS, player.getDataTracker().get(PLAYER_MODEL_PARTS));
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.world.method_27983());
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.world.getRegistryKey());
server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, playerShadow));
player.getServerWorld().getChunkManager().updateCameraPosition(playerShadow);
return playerShadow;
@@ -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()));
@@ -139,7 +139,7 @@ public class SettingsManager
private File getFile()
{
return server.method_27050(WorldSavePath.ROOT).resolve(identifier+".conf").toFile();
return server.getSavePath(WorldSavePath.ROOT).resolve(identifier+".conf").toFile();
}
public void disableBooleanCommands()
@@ -56,7 +56,7 @@ public class CarpetProfiler
private static String getSectionString(World world, String section)
{
return String.format("%s.%s%s",
world.method_27983().getValue().toString().replaceFirst("minecraft:", ""),
world.getRegistryKey().getValue().toString().replaceFirst("minecraft:", ""),
section, // ^ getDImension getId
world.isClient ? " (Client)" : "");
}
@@ -64,7 +64,7 @@ public class CarpetProfiler
private static String getEntityString(World world, Entity e)
{
return String.format("%s.%s%s",
world.method_27983().getValue().toString().replaceFirst("minecraft:", ""),
world.getRegistryKey().getValue().toString().replaceFirst("minecraft:", ""),
Registry.ENTITY_TYPE.getId(e.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : "");
}
@@ -72,7 +72,7 @@ public class CarpetProfiler
private static String getTEntityString(World world, BlockEntity be)
{
return String.format("%s.%s%s",
world.method_27983().getValue().toString().replaceFirst("minecraft:", ""),
world.getRegistryKey().getValue().toString().replaceFirst("minecraft:", ""),
Registry.BLOCK_ENTITY_TYPE.getId(be.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : "");
}
@@ -60,17 +60,17 @@ public class HUDController
if (LoggerRegistry.__mobcaps)
LoggerRegistry.getLogger("mobcaps").log((option, player) -> {
RegistryKey<World> dim = player.world.method_27983(); //getDimType
RegistryKey<World> dim = player.world.getRegistryKey(); //getDimType
switch (option)
{
case "overworld":
dim = World.field_25179; // OW
dim = World.OVERWORLD; // OW
break;
case "nether":
dim = World.field_25180; // nether
dim = World.NETHER; // nether
break;
case "end":
dim = World.field_25181; // end
dim = World.END; // end
break;
}
return new BaseText[]{SpawnReporter.printMobcapsForDimension(server.getWorld(dim), false).get(0)};
+1 -1
View File
@@ -254,7 +254,7 @@ public class Messenger
public static void m(ServerCommandSource source, Object ... fields)
{
if (source != null)
source.sendFeedback(Messenger.c(fields),source.getMinecraftServer() != null && source.getMinecraftServer().getWorld(World.field_25179) != null); //OW
source.sendFeedback(Messenger.c(fields),source.getMinecraftServer() != null && source.getMinecraftServer().getWorld(World.OVERWORLD) != null); //OW
}
public static void m(PlayerEntity player, Object ... fields)
{
@@ -75,7 +75,7 @@ public class SpawnReporter
return;
}
}
Pair<RegistryKey<World>, SpawnGroup> key = Pair.of(mob.world.method_27983(), cat);
Pair<RegistryKey<World>, SpawnGroup> key = Pair.of(mob.world.getRegistryKey(), cat);
long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L);
spawn_stats.get(key).put(mob.getType(), count + 1);
spawned_mobs.get(key).put(Pair.of(mob.getType(), pos));
@@ -85,7 +85,7 @@ public class SpawnReporter
public static List<BaseText> printMobcapsForDimension(ServerWorld world, boolean multiline)
{
RegistryKey<World> dim = world.method_27983();
RegistryKey<World> dim = world.getRegistryKey();
String name = dim.toString();
List<BaseText> lst = new ArrayList<>();
if (multiline)
@@ -149,7 +149,7 @@ public class SpawnReporter
String type_code = creature_type.getName();
lst.add(Messenger.s(String.format("Recent %s spawns:",type_code)));
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.method_27983(), creature_type)).keySet()) // getDImTYpe
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.getRegistryKey(), creature_type)).keySet()) // getDImTYpe
{
lst.add( Messenger.c(
"w - ",
@@ -305,7 +305,7 @@ public class SpawnReporter
{
spawn_tries.put(enumcreaturetype, 1);
}
for (RegistryKey<World> dim : Arrays.asList(World.field_25179, World.field_25180, World.field_25181))
for (RegistryKey<World> dim : Arrays.asList(World.OVERWORLD, World.NETHER, World.END))
{
Pair<RegistryKey<World>, SpawnGroup> key = Pair.of(dim, enumcreaturetype);
overall_spawn_ticks.put(key, 0L);