20w21a ohboi

This commit is contained in:
gnembon committed 2020-05-21 02:59:17 -03:00
1 parent 838211edba
commit bec5259216
40 files changed
+445 -347

No files matched your search

+2 -2
View File
@@ -4,8 +4,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=20w20b minecraft_version=20w21a
yarn_mappings=20w20b+build.13 yarn_mappings=20w21a+build.2
loader_version=0.8.4+build.198 loader_version=0.8.4+build.198
# Mod Properties # Mod Properties
+2 -2
View File
@@ -530,7 +530,7 @@ public class CarpetSettings
public static class ChangeSpawnChunksValidator extends Validator<Integer> { public static class ChangeSpawnChunksValidator extends Validator<Integer> {
public static void changeSpawnSize(int size) public static void changeSpawnSize(int size)
{ {
ServerWorld overworld = CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD); ServerWorld overworld = CarpetServer.minecraft_server.getWorld(DimensionType.field_24753); // OW
if (overworld != null) { if (overworld != null) {
ChunkPos centerChunk = new ChunkPos(new BlockPos( ChunkPos centerChunk = new ChunkPos(new BlockPos(
overworld.getLevelProperties().getSpawnX(), overworld.getLevelProperties().getSpawnX(),
@@ -551,7 +551,7 @@ public class CarpetSettings
//must been some startup thing //must been some startup thing
return newValue; return newValue;
} }
ServerWorld currentOverworld = CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD); ServerWorld currentOverworld = CarpetServer.minecraft_server.getWorld(DimensionType.field_24753); // OW
if (currentOverworld != null) if (currentOverworld != null)
{ {
changeSpawnSize(newValue); changeSpawnSize(newValue);
@@ -15,6 +15,7 @@ import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.class_5321;
import net.minecraft.command.arguments.DimensionArgumentType; import net.minecraft.command.arguments.DimensionArgumentType;
import net.minecraft.command.arguments.RotationArgumentType; import net.minecraft.command.arguments.RotationArgumentType;
import net.minecraft.command.arguments.Vec3ArgumentType; import net.minecraft.command.arguments.Vec3ArgumentType;
@@ -234,7 +235,7 @@ public class PlayerCommand
() -> RotationArgumentType.getRotation(context, "direction").toAbsoluteRotation(context.getSource()), () -> RotationArgumentType.getRotation(context, "direction").toAbsoluteRotation(context.getSource()),
source::getRotation source::getRotation
); );
DimensionType dim = tryGetArg( class_5321<DimensionType> dimType = tryGetArg(
() -> DimensionArgumentType.getDimensionArgument(context, "dimension"), () -> DimensionArgumentType.getDimensionArgument(context, "dimension"),
() -> source.getWorld().method_27983() // dimension.getType() () -> source.getWorld().method_27983() // dimension.getType()
); );
@@ -252,7 +253,7 @@ public class PlayerCommand
return 0; return 0;
} }
MinecraftServer server = source.getMinecraftServer(); MinecraftServer server = source.getMinecraftServer();
PlayerEntity player = EntityPlayerMPFake.createFake(playerName, server, pos.x, pos.y, pos.z, facing.y, facing.x, dim, mode); PlayerEntity player = EntityPlayerMPFake.createFake(playerName, server, pos.x, pos.y, pos.z, facing.y, facing.x, dimType, mode);
if (player == null) if (player == null)
{ {
Messenger.m(context.getSource(), "rb Player " + StringArgumentType.getString(context, "player") + " doesn't exist " + Messenger.m(context.getSource(), "rb Player " + StringArgumentType.getString(context, "player") + " doesn't exist " +
@@ -11,6 +11,7 @@ import com.mojang.brigadier.arguments.BoolArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.class_5321;
import net.minecraft.command.arguments.BlockPosArgumentType; import net.minecraft.command.arguments.BlockPosArgumentType;
import net.minecraft.command.arguments.DimensionArgumentType; import net.minecraft.command.arguments.DimensionArgumentType;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
@@ -257,9 +258,9 @@ public class SpawnCommand
return 1; return 1;
} }
private static int mobcapsForDimension(ServerCommandSource source, DimensionType dim) private static int mobcapsForDimension(ServerCommandSource source, class_5321<DimensionType> dim)
{ {
Messenger.send(source, SpawnReporter.printMobcapsForDimension(source.getWorld(), true)); Messenger.send(source, SpawnReporter.printMobcapsForDimension(source.getMinecraftServer().getWorld(dim), true));
return 1; return 1;
} }
@@ -0,0 +1,9 @@
package carpet.fakes;
import net.minecraft.class_5312;
import net.minecraft.world.gen.feature.StructureFeature;
public interface BiomeInterface
{
class_5312<?, ?> getConfiguredFeature(StructureFeature<?> arg);
}
@@ -2,12 +2,17 @@ package carpet.fakes;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; import net.minecraft.world.gen.feature.FeatureConfig;
public interface StructureFeatureInterface public interface StructureFeatureInterface<C>
{ {
boolean plopAnywhere(ServerWorld world, BlockPos pos); boolean plopAnywhere(ServerWorld world, BlockPos pos);
boolean gridAnywhere(ServerWorld world, BlockPos pos); boolean gridAnywhere(ServerWorld world, BlockPos pos);
boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly); boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly,Biome biome, FeatureConfig config);
boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
} }
+106 -129
View File
@@ -1,14 +1,17 @@
package carpet.helpers; package carpet.helpers;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import carpet.fakes.BiomeInterface;
import carpet.fakes.StructureFeatureInterface; import carpet.fakes.StructureFeatureInterface;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.class_5312;
import net.minecraft.class_5314;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager; import net.minecraft.structure.StructureManager;
import net.minecraft.structure.StructureStart; import net.minecraft.structure.StructureStart;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockBox;
import net.minecraft.structure.BastionRemnantGenerator; import net.minecraft.structure.BastionRemnantGenerator;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -17,14 +20,14 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.biome.DefaultBiomeFeatures;
import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.BiomeSource; //import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.biome.source.FixedBiomeSource; //import net.minecraft.world.biome.source.FixedBiomeSource;
//import net.minecraft.world.biome.source.VanillaLayeredBiomeSource; //import net.minecraft.world.biome.source.VanillaLayeredBiomeSource;
//import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig; //import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig;
import net.minecraft.world.gen.ChunkRandom; import net.minecraft.world.gen.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGenerator; //import net.minecraft.world.gen.chunk.OverworldChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig; //import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
import net.minecraft.world.gen.decorator.BeehiveTreeDecorator; import net.minecraft.world.gen.decorator.BeehiveTreeDecorator;
import net.minecraft.world.gen.feature.BastionRemnantFeatureConfig; import net.minecraft.world.gen.feature.BastionRemnantFeatureConfig;
import net.minecraft.world.gen.feature.BoulderFeatureConfig; import net.minecraft.world.gen.feature.BoulderFeatureConfig;
@@ -50,15 +53,19 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static net.minecraft.world.biome.DefaultBiomeFeatures.FANCY_TREE_CONFIG; import static net.minecraft.world.biome.DefaultBiomeFeatures.FANCY_TREE_CONFIG;
import static net.minecraft.world.biome.DefaultBiomeFeatures.OAK_TREE_CONFIG; import static net.minecraft.world.biome.DefaultBiomeFeatures.OAK_TREE_CONFIG;
public class FeatureGenerator public class FeatureGenerator
{ {
public static String fix(String key)
{
return key.toLowerCase(Locale.ROOT);
}
@FunctionalInterface @FunctionalInterface
private interface Thing private interface Thing
{ {
@@ -104,41 +111,7 @@ public class FeatureGenerator
} }
private static Thing setupCustomStructure(StructureFeature structure, FeatureConfig conf, Biome biome, boolean wireOnly) private static Thing setupCustomStructure(StructureFeature structure, FeatureConfig conf, Biome biome, boolean wireOnly)
{ {
//if (1+2==3) return (w, p) -> ((StructureFeatureInterface)structure).plopAnywhere(w, p, w.getChunkManager().getChunkGenerator(), wireOnly, biome, conf);
// throw new RuntimeException("rebuild me");
return (w, p) -> {
ChunkGenerator chunkgen = new OverworldChunkGenerator(w.getChunkManager().getChunkGenerator().getBiomeSource(), w.getSeed(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings())
{
@Override
public <C extends FeatureConfig> C getStructureConfig(Biome biome_1, StructureFeature<C> structureFeature_1)
{
return (C)conf;
}
@Override
public BiomeSource getBiomeSource()
{
return new FixedBiomeSource(biome);
/*return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties().getSeed()))
{
@Override
public Biome getBiomeForNoiseGen(int i, int j, int k)
{
return biome;
}
@Override
public Set<Biome> getBiomesInArea(int int_1, int int_2, int int_3, int int_4)
{
return Sets.newHashSet(biome);
}
};*/
}
};
return ((StructureFeatureInterface)structure).plopAnywhere(w, p, chunkgen, wireOnly);
};
} }
public static Boolean spawn(String name, ServerWorld world, BlockPos pos) public static Boolean spawn(String name, ServerWorld world, BlockPos pos)
@@ -156,22 +129,26 @@ public class FeatureGenerator
return null; return null;
} }
public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<?> structure, boolean computeBox) public static <T extends FeatureConfig> StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<T> structure, boolean computeBox)
{ {
long seed = world.getSeed(); long seed = world.getSeed();
ChunkGenerator generator = world.getChunkManager().getChunkGenerator(); ChunkGenerator generator = world.getChunkManager().getChunkGenerator();
class_5314 params = generator.getConfig().method_28600(structure);
if (!generator.getBiomeSource().hasStructureFeature(structure)) if (!generator.getBiomeSource().hasStructureFeature(structure))
return null; return null;
BiomeAccess biomeAccess = world.getBiomeAccess().withSource(generator.getBiomeSource()); BiomeAccess biomeAccess = world.getBiomeAccess().withSource(generator.getBiomeSource());
ChunkRandom chunkRandom = new ChunkRandom(); ChunkRandom chunkRandom = new ChunkRandom();
ChunkPos chunkPos = new ChunkPos(pos); ChunkPos chunkPos = new ChunkPos(pos);
Biome biome = biomeAccess.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9)); Biome biome = biomeAccess.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9));
if (structure.method_27217(biomeAccess, generator, seed, chunkRandom, chunkPos.x, chunkPos.z, biome)) // should start at class_5312<?, ?> configuredFeature = ((BiomeInterface)biome).getConfiguredFeature(structure);
if (configuredFeature == null) return null;
ChunkPos chunkPos2 = structure.method_27218(params, seed, chunkRandom, chunkPos.x, chunkPos.z); //find some chunk I guess
if (chunkPos.x == chunkPos2.x && chunkPos.z == chunkPos2.z && ((StructureFeatureInterface)structure).shouldStartPublicAt(generator, generator.getBiomeSource(), seed, chunkRandom, chunkPos.x, chunkPos.z, biome, chunkPos, configuredFeature.field_24836)) // should start at
{ {
if (!computeBox) return StructureStart.DEFAULT; if (!computeBox) return StructureStart.DEFAULT;
StructureManager manager = world.getStructureManager(); StructureManager manager = world.getStructureManager();
StructureStart structureStart3 = structure.getStructureStartFactory().create(structure, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, seed); StructureStart<T> structureStart3 = structure.getStructureStartFactory().create((StructureFeature<T>) configuredFeature.field_24835, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, seed);
structureStart3.init(generator, manager, chunkPos.x, chunkPos.z, biome); structureStart3.init(generator, manager, chunkPos.x, chunkPos.z, biome, (T) configuredFeature.field_24836);
if (!structureStart3.hasChildren()) return null; if (!structureStart3.hasChildren()) return null;
return structureStart3; return structureStart3;
} }
@@ -183,73 +160,73 @@ public class FeatureGenerator
public static final Map<String, String> featureToStructure = new HashMap<>(); public static final Map<String, String> featureToStructure = new HashMap<>();
static static
{ {
structureToFeature.put(Feature.OCEAN_MONUMENT.getName(), Collections.singletonList("monument")); structureToFeature.put(StructureFeature.MONUMENT.getName(), Collections.singletonList("monument"));
structureToFeature.put(Feature.END_CITY.getName(), Collections.singletonList("end_city")); structureToFeature.put(StructureFeature.END_CITY.getName(), Collections.singletonList("end_city"));
structureToFeature.put(Feature.OCEAN_RUIN.getName(), Arrays.asList("ocean_ruin", "ocean_ruin_warm", "ocean_ruin_small", "ocean_ruin_warm_small", "ocean_ruin_tall", "ocean_ruin_warm_tall")); structureToFeature.put(StructureFeature.OCEAN_RUIN.getName(), Arrays.asList("ocean_ruin", "ocean_ruin_warm", "ocean_ruin_small", "ocean_ruin_warm_small", "ocean_ruin_tall", "ocean_ruin_warm_tall"));
structureToFeature.put(Feature.VILLAGE.getName(), Arrays.asList("village", "village_desert", "village_savanna", "village_taiga", "village_snowy")); structureToFeature.put(StructureFeature.VILLAGE.getName(), Arrays.asList("village", "village_desert", "village_savanna", "village_taiga", "village_snowy"));
structureToFeature.put(Feature.WOODLAND_MANSION.getName(), Collections.singletonList("mansion")); structureToFeature.put(StructureFeature.MANSION.getName(), Collections.singletonList("mansion"));
structureToFeature.put(Feature.BURIED_TREASURE.getName(), Collections.singletonList("treasure")); structureToFeature.put(StructureFeature.BURIED_TREASURE.getName(), Collections.singletonList("treasure"));
structureToFeature.put(Feature.SWAMP_HUT.getName(), Collections.singletonList("witch_hut")); structureToFeature.put(StructureFeature.field_24851.getName(), Collections.singletonList("witch_hut"));
structureToFeature.put(Feature.STRONGHOLD.getName(), Collections.singletonList("stronghold")); structureToFeature.put(StructureFeature.STRONGHOLD.getName(), Collections.singletonList("stronghold"));
structureToFeature.put(Feature.DESERT_PYRAMID.getName(), Collections.singletonList("desert_temple")); structureToFeature.put(StructureFeature.DESERT_PYRAMID.getName(), Collections.singletonList("desert_temple"));
structureToFeature.put(Feature.JUNGLE_TEMPLE.getName(), Collections.singletonList("jungle_temple")); structureToFeature.put(StructureFeature.JUNGLE_PYRAMID.getName(), Collections.singletonList("jungle_temple"));
structureToFeature.put(Feature.SHIPWRECK.getName(), Arrays.asList("shipwreck", "shipwreck2")); structureToFeature.put(StructureFeature.SHIPWRECK.getName(), Arrays.asList("shipwreck", "shipwreck2"));
structureToFeature.put(Feature.PILLAGER_OUTPOST.getName(), Collections.singletonList("pillager_outpost")); structureToFeature.put(StructureFeature.PILLAGER_OUTPOST.getName(), Collections.singletonList("pillager_outpost"));
structureToFeature.put(Feature.MINESHAFT.getName(), Arrays.asList("mineshaft", "mineshaft_mesa")); structureToFeature.put(StructureFeature.MINESHAFT.getName(), Arrays.asList("mineshaft", "mineshaft_mesa"));
structureToFeature.put(Feature.IGLOO.getName(), Collections.singletonList("igloo")); structureToFeature.put(StructureFeature.IGLOO.getName(), Collections.singletonList("igloo"));
structureToFeature.put(Feature.NETHER_BRIDGE.getName(), Collections.singletonList("fortress")); structureToFeature.put(StructureFeature.FORTRESS.getName(), Collections.singletonList("fortress"));
structureToFeature.put(Feature.NETHER_FOSSIL.getName(), Collections.singletonList("nether_fossil")); structureToFeature.put(StructureFeature.NETHER_FOSSIL.getName(), Collections.singletonList("nether_fossil"));
structureToFeature.put(Feature.BASTION_REMNANT.getName(), Arrays.asList("bastion_remnant", "bastion_remnant_housing", "bastion_remnant_stable", "bastion_remnant_treasure", "bastion_remnant_bridge")); structureToFeature.put(StructureFeature.BASTION_REMNANT.getName(), Arrays.asList("bastion_remnant", "bastion_remnant_housing", "bastion_remnant_stable", "bastion_remnant_treasure", "bastion_remnant_bridge"));
structureToFeature.put(Feature.RUINED_PORTAL.getName(), Collections.singletonList("ruined_portal")); structureToFeature.put(StructureFeature.RUINED_PORTAL.getName(), Collections.singletonList("ruined_portal"));
structureToFeature.forEach((key, value) -> value.forEach(el -> featureToStructure.put(el, key))); structureToFeature.forEach((key, value) -> value.forEach(el -> featureToStructure.put(el, key)));
} }
private static final Map<String, Thing> gridMap = new HashMap<String, Thing>() {{ private static final Map<String, Thing> gridMap = new HashMap<String, Thing>() {{
put("monument", ((StructureFeatureInterface)Feature.OCEAN_MONUMENT)::gridAnywhere); put("monument", ((StructureFeatureInterface)StructureFeature.MONUMENT)::gridAnywhere);
put("fortress", ((StructureFeatureInterface)Feature.NETHER_BRIDGE)::gridAnywhere); put("fortress", ((StructureFeatureInterface)StructureFeature.FORTRESS)::gridAnywhere);
put("mansion", ((StructureFeatureInterface)Feature.WOODLAND_MANSION)::gridAnywhere); put("mansion", ((StructureFeatureInterface)StructureFeature.MANSION)::gridAnywhere);
put("jungle_temple", ((StructureFeatureInterface)Feature.JUNGLE_TEMPLE)::gridAnywhere); put("jungle_temple", ((StructureFeatureInterface)StructureFeature.JUNGLE_PYRAMID)::gridAnywhere);
put("desert_temple", ((StructureFeatureInterface)Feature.DESERT_PYRAMID)::gridAnywhere); put("desert_temple", ((StructureFeatureInterface)StructureFeature.DESERT_PYRAMID)::gridAnywhere);
put("end_city", ((StructureFeatureInterface)Feature.END_CITY)::gridAnywhere); put("end_city", ((StructureFeatureInterface)StructureFeature.END_CITY)::gridAnywhere);
put("igloo", ((StructureFeatureInterface)Feature.IGLOO)::gridAnywhere); put("igloo", ((StructureFeatureInterface)StructureFeature.IGLOO)::gridAnywhere);
put("shipwreck", gridCustomStructure(Feature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS)); put("shipwreck", gridCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS));
put("shipwreck2", gridCustomStructure(Feature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS)); put("shipwreck2", gridCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS));
put("witch_hut", ((StructureFeatureInterface)Feature.SWAMP_HUT)::gridAnywhere); put("witch_hut", ((StructureFeatureInterface)StructureFeature.field_24851)::gridAnywhere);
put("stronghold", ((StructureFeatureInterface)Feature.STRONGHOLD)::gridAnywhere); put("stronghold", ((StructureFeatureInterface)StructureFeature.STRONGHOLD)::gridAnywhere);
put("ocean_ruin_small", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_small", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 0.0F, 0.5F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 0.0F, 0.5F), Biomes.PLAINS));
put("ocean_ruin_warm_small", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm_small", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 0.0F, 0.5F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 0.0F, 0.5F), Biomes.PLAINS));
put("ocean_ruin_tall", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_tall", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 0.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 0.0F), Biomes.PLAINS));
put("ocean_ruin_warm_tall", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm_tall", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 0.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 0.0F), Biomes.PLAINS));
put("ocean_ruin", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 1.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 1.0F), Biomes.PLAINS));
put("ocean_ruin_warm", gridCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm", gridCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 1.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 1.0F), Biomes.PLAINS));
put("treasure", ((StructureFeatureInterface)Feature.BURIED_TREASURE)::gridAnywhere); put("treasure", ((StructureFeatureInterface)StructureFeature.BURIED_TREASURE)::gridAnywhere);
put("pillager_outpost", ((StructureFeatureInterface)Feature.PILLAGER_OUTPOST)::gridAnywhere); put("pillager_outpost", ((StructureFeatureInterface)StructureFeature.PILLAGER_OUTPOST)::gridAnywhere);
put("mineshaft", gridCustomStructure(Feature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.NORMAL), Biomes.PLAINS)); put("mineshaft", gridCustomStructure(StructureFeature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.NORMAL), Biomes.PLAINS));
put("mineshaft_mesa", gridCustomStructure(Feature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.MESA), Biomes.PLAINS)); put("mineshaft_mesa", gridCustomStructure(StructureFeature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.MESA), Biomes.PLAINS));
put("village", gridCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/plains/town_centers",6), Biomes.PLAINS)); put("village", gridCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/plains/town_centers"),6), Biomes.PLAINS));
put("village_desert", gridCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/desert/town_centers", 6), Biomes.PLAINS)); put("village_desert", gridCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/desert/town_centers"), 6), Biomes.PLAINS));
put("village_savanna", gridCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/savanna/town_centers", 6), Biomes.PLAINS)); put("village_savanna", gridCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/savanna/town_centers"), 6), Biomes.PLAINS));
put("village_taiga", gridCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/taiga/town_centers", 6), Biomes.PLAINS)); put("village_taiga", gridCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/taiga/town_centers"), 6), Biomes.PLAINS));
put("village_snowy", gridCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/snowy/town_centers", 6), Biomes.PLAINS)); put("village_snowy", gridCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/snowy/town_centers"), 6), Biomes.PLAINS));
put("nether_fossil", ((StructureFeatureInterface)Feature.NETHER_FOSSIL)::gridAnywhere); put("nether_fossil", ((StructureFeatureInterface)StructureFeature.NETHER_FOSSIL)::gridAnywhere);
put("bastion_remnant", gridCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(BastionRemnantGenerator.START_POOLS_TO_SIZES), Biomes.NETHER_WASTES)); put("bastion_remnant", gridCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(BastionRemnantGenerator.START_POOLS_TO_SIZES), Biomes.NETHER_WASTES));
put("bastion_remnant_housing", gridCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/units/base", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_housing", gridCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/units/base", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_stable", gridCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/hoglin_stable/origin", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_stable", gridCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/hoglin_stable/origin", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_treasure", gridCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/treasure/starters", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_treasure", gridCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/treasure/starters", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_bridge", gridCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/bridge/start", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_bridge", gridCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/bridge/start", 60).build()), Biomes.NETHER_WASTES));
}}; }};
private static final Map<String, Thing> featureMap = new HashMap<String, Thing>() {{ private static final Map<String, Thing> featureMap = new HashMap<String, Thing>() {{
@@ -327,50 +304,50 @@ public class FeatureGenerator
put("basalt_pillar", simplePlop(Feature.BASALT_PILLAR)); put("basalt_pillar", simplePlop(Feature.BASALT_PILLAR));
//structures //structures
put("monument", ((StructureFeatureInterface)Feature.OCEAN_MONUMENT)::plopAnywhere); put("monument", ((StructureFeatureInterface)StructureFeature.MONUMENT)::plopAnywhere);
put("fortress", ((StructureFeatureInterface)Feature.NETHER_BRIDGE)::plopAnywhere); put("fortress", ((StructureFeatureInterface)StructureFeature.FORTRESS)::plopAnywhere);
put("mansion", ((StructureFeatureInterface)Feature.WOODLAND_MANSION)::plopAnywhere); put("mansion", ((StructureFeatureInterface)StructureFeature.MANSION)::plopAnywhere);
put("jungle_temple", ((StructureFeatureInterface)Feature.JUNGLE_TEMPLE)::plopAnywhere); put("jungle_temple", ((StructureFeatureInterface)StructureFeature.JUNGLE_PYRAMID)::plopAnywhere);
put("desert_temple", ((StructureFeatureInterface)Feature.DESERT_PYRAMID)::plopAnywhere); put("desert_temple", ((StructureFeatureInterface)StructureFeature.DESERT_PYRAMID)::plopAnywhere);
put("end_city", ((StructureFeatureInterface)Feature.END_CITY)::plopAnywhere); put("end_city", ((StructureFeatureInterface)StructureFeature.END_CITY)::plopAnywhere);
put("igloo", ((StructureFeatureInterface)Feature.IGLOO)::plopAnywhere); put("igloo", ((StructureFeatureInterface)StructureFeature.IGLOO)::plopAnywhere);
put("shipwreck", spawnCustomStructure(Feature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS)); put("shipwreck", spawnCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(true), Biomes.PLAINS));
put("shipwreck2", spawnCustomStructure(Feature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS)); put("shipwreck2", spawnCustomStructure(StructureFeature.SHIPWRECK, new ShipwreckFeatureConfig(false), Biomes.PLAINS));
put("witch_hut", ((StructureFeatureInterface)Feature.SWAMP_HUT)::plopAnywhere); put("witch_hut", ((StructureFeatureInterface)StructureFeature.field_24851)::plopAnywhere);
put("stronghold", ((StructureFeatureInterface)Feature.STRONGHOLD)::plopAnywhere); put("stronghold", ((StructureFeatureInterface)StructureFeature.STRONGHOLD)::plopAnywhere);
put("ocean_ruin_small", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_small", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 0.0F, 0.5F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 0.0F, 0.5F), Biomes.PLAINS));
put("ocean_ruin_warm_small", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm_small", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 0.0F, 0.5F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 0.0F, 0.5F), Biomes.PLAINS));
put("ocean_ruin_tall", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_tall", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 0.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 0.0F), Biomes.PLAINS));
put("ocean_ruin_warm_tall", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm_tall", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 0.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 0.0F), Biomes.PLAINS));
put("ocean_ruin", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 1.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.COLD, 1.0F, 1.0F), Biomes.PLAINS));
put("ocean_ruin_warm", spawnCustomStructure(Feature.OCEAN_RUIN, put("ocean_ruin_warm", spawnCustomStructure(StructureFeature.OCEAN_RUIN,
new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 1.0F), Biomes.PLAINS)); new OceanRuinFeatureConfig(OceanRuinFeature.BiomeType.WARM, 1.0F, 1.0F), Biomes.PLAINS));
put("treasure", ((StructureFeatureInterface)Feature.BURIED_TREASURE)::plopAnywhere); put("treasure", ((StructureFeatureInterface)StructureFeature.BURIED_TREASURE)::plopAnywhere);
put("pillager_outpost", ((StructureFeatureInterface)Feature.PILLAGER_OUTPOST)::plopAnywhere); put("pillager_outpost", ((StructureFeatureInterface)StructureFeature.PILLAGER_OUTPOST)::plopAnywhere);
put("mineshaft", spawnCustomStructure(Feature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.NORMAL), Biomes.PLAINS)); put("mineshaft", spawnCustomStructure(StructureFeature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.NORMAL), Biomes.PLAINS));
put("mineshaft_mesa", spawnCustomStructure(Feature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.MESA), Biomes.PLAINS)); put("mineshaft_mesa", spawnCustomStructure(StructureFeature.MINESHAFT, new MineshaftFeatureConfig(0.0, MineshaftFeature.Type.MESA), Biomes.PLAINS));
put("village", spawnCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/plains/town_centers",6), Biomes.PLAINS)); put("village", spawnCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/plains/town_centers"),6), Biomes.PLAINS));
put("village_desert", spawnCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/desert/town_centers", 6), Biomes.PLAINS)); put("village_desert", spawnCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/desert/town_centers"), 6), Biomes.PLAINS));
put("village_savanna", spawnCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/savanna/town_centers", 6), Biomes.PLAINS)); put("village_savanna", spawnCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/savanna/town_centers"), 6), Biomes.PLAINS));
put("village_taiga", spawnCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/taiga/town_centers", 6), Biomes.PLAINS)); put("village_taiga", spawnCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/taiga/town_centers"), 6), Biomes.PLAINS));
put("village_snowy", spawnCustomStructure(Feature.VILLAGE, new StructurePoolFeatureConfig("village/snowy/town_centers", 6), Biomes.PLAINS)); put("village_snowy", spawnCustomStructure(StructureFeature.VILLAGE, new StructurePoolFeatureConfig(new Identifier("village/snowy/town_centers"), 6), Biomes.PLAINS));
put("nether_fossil", ((StructureFeatureInterface)Feature.NETHER_FOSSIL)::plopAnywhere); put("nether_fossil", ((StructureFeatureInterface)StructureFeature.NETHER_FOSSIL)::plopAnywhere);
put("bastion_remnant", spawnCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(BastionRemnantGenerator.START_POOLS_TO_SIZES), Biomes.NETHER_WASTES)); put("bastion_remnant", spawnCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(BastionRemnantGenerator.START_POOLS_TO_SIZES), Biomes.NETHER_WASTES));
put("bastion_remnant_housing", spawnCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/units/base", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_housing", spawnCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/units/base", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_stable", spawnCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/hoglin_stable/origin", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_stable", spawnCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/hoglin_stable/origin", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_treasure", spawnCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/treasure/starters", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_treasure", spawnCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/treasure/starters", 60).build()), Biomes.NETHER_WASTES));
put("bastion_remnant_bridge", spawnCustomStructure(Feature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/bridge/start", 60).build()), Biomes.NETHER_WASTES)); put("bastion_remnant_bridge", spawnCustomStructure(StructureFeature.BASTION_REMNANT, new BastionRemnantFeatureConfig(new ImmutableMap.Builder<String,Integer>().put("bastion/bridge/start", 60).build()), Biomes.NETHER_WASTES));
put("ruined_portal", ((StructureFeatureInterface)Feature.RUINED_PORTAL)::plopAnywhere); put("ruined_portal", ((StructureFeatureInterface)StructureFeature.RUINED_PORTAL)::plopAnywhere);
}}; }};
@@ -50,7 +50,7 @@ public class HopperCounter
{ {
if (startTick == 0) if (startTick == 0)
{ {
startTick = server.getWorld(DimensionType.OVERWORLD).getTime(); startTick = server.getWorld(DimensionType.field_24753).getTime(); //OW
startMillis = System.currentTimeMillis(); startMillis = System.currentTimeMillis();
} }
Item item = stack.getItem(); Item item = stack.getItem();
@@ -61,7 +61,7 @@ public class HopperCounter
public void reset(MinecraftServer server) public void reset(MinecraftServer server)
{ {
counter.clear(); counter.clear();
startTick = server.getWorld(DimensionType.OVERWORLD).getTime(); startTick = server.getWorld(DimensionType.field_24753).getTime(); //OW
startMillis = System.currentTimeMillis(); startMillis = System.currentTimeMillis();
// pubSubProvider.publish(); // pubSubProvider.publish();
} }
@@ -105,7 +105,7 @@ public class HopperCounter
return Collections.singletonList(Messenger.s(String.format("No items for %s yet", color.getName()))); return Collections.singletonList(Messenger.s(String.format("No items for %s yet", color.getName())));
} }
long total = getTotalItems(); long total = getTotalItems();
long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getWorld(DimensionType.OVERWORLD).getTime() - startTick, 1); long ticks = Math.max(realTime ? (System.currentTimeMillis() - startMillis) / 50 : server.getWorld(DimensionType.field_24753).getTime() - startTick, 1); //OW
if (total == 0) if (total == 0)
{ {
if (brief) if (brief)
+2 -1
View File
@@ -5,6 +5,7 @@ import carpet.CarpetSettings;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.BaseText; import net.minecraft.text.BaseText;
import net.minecraft.util.Util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
@@ -181,7 +182,7 @@ public class Logger
public void sendPlayerMessage(ServerPlayerEntity player, BaseText ... messages) public void sendPlayerMessage(ServerPlayerEntity player, BaseText ... messages)
{ {
Arrays.stream(messages).forEach(player::sendSystemMessage); Arrays.stream(messages).forEach(message -> player.sendSystemMessage(message, Util.field_25140));
} }
/** /**
@@ -0,0 +1,23 @@
package carpet.mixins;
import carpet.fakes.BiomeInterface;
import net.minecraft.class_5312;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Map;
@Mixin(Biome.class)
public class Biome_scarpetMixin implements BiomeInterface
{
@Shadow @Final private Map<StructureFeature<?>, class_5312<?, ?>> structureFeatures;
@Override
public class_5312<?, ?> getConfiguredFeature(StructureFeature<?> arg)
{
return structureFeatures.get(arg);
}
}
@@ -13,6 +13,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ChunkGenerator.class) @Mixin(ChunkGenerator.class)
public abstract class ChunkGeneratorMixin public abstract class ChunkGeneratorMixin
{ {
// this might not be needed anymore
/*
@Inject(method = "hasStructure", at = @At("HEAD"), cancellable = true) @Inject(method = "hasStructure", at = @At("HEAD"), cancellable = true)
private void skipGenerationBiomeChecks(Biome biome_1, StructureFeature<? extends FeatureConfig> structureFeature_1, CallbackInfoReturnable<Boolean> cir) private void skipGenerationBiomeChecks(Biome biome_1, StructureFeature<? extends FeatureConfig> structureFeature_1, CallbackInfoReturnable<Boolean> cir)
{ {
@@ -22,4 +24,6 @@ public abstract class ChunkGeneratorMixin
cir.cancel(); cir.cancel();
} }
} }
*/
} }
@@ -44,11 +44,11 @@ public abstract class CoralBlockMixin implements Fertilizable
CoralFeature coral; CoralFeature coral;
int variant = random.nextInt(3); int variant = random.nextInt(3);
if (variant == 0) if (variant == 0)
coral = new CoralClawFeature(DefaultFeatureConfig::deserialize); coral = new CoralClawFeature(DefaultFeatureConfig.field_24893);
else if (variant == 1) else if (variant == 1)
coral = new CoralTreeFeature(DefaultFeatureConfig::deserialize); coral = new CoralTreeFeature(DefaultFeatureConfig.field_24893);
else else
coral = new CoralMushroomFeature(DefaultFeatureConfig::deserialize); coral = new CoralMushroomFeature(DefaultFeatureConfig.field_24893);
MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos); MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos);
BlockState proper_block = blockUnder; BlockState proper_block = blockUnder;
@@ -2,20 +2,22 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.Dynamic; //import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.AbstractTempleFeature; //import net.minecraft.world.gen.feature.AbstractTempleFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.DesertPyramidFeature; import net.minecraft.world.gen.feature.DesertPyramidFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Function; //import java.util.function.Function;
@Mixin(DesertPyramidFeature.class) @Mixin(DesertPyramidFeature.class)
public abstract class DesertPyramidFeatureMixin extends AbstractTempleFeature<DefaultFeatureConfig> public abstract class DesertPyramidFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{ {
private static final List<Biome.SpawnEntry> MONSTER_SPAWNS; private static final List<Biome.SpawnEntry> MONSTER_SPAWNS;
@@ -23,12 +25,13 @@ public abstract class DesertPyramidFeatureMixin extends AbstractTempleFeature<De
{ {
MONSTER_SPAWNS = Lists.newArrayList(new Biome.SpawnEntry(EntityType.HUSK, 1, 1, 1)); MONSTER_SPAWNS = Lists.newArrayList(new Biome.SpawnEntry(EntityType.HUSK, 1, 1, 1));
} }
public DesertPyramidFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1) public DesertPyramidFeatureMixin(Codec<DefaultFeatureConfig> codec)
{ {
super(function_1); super(codec);
} }
@Override @Override
public List<Biome.SpawnEntry> getMonsterSpawns() public List<Biome.SpawnEntry> getMonsterSpawns()
{ {
@@ -2,7 +2,8 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.Dynamic; //import com.mojang.datafixers.Dynamic;
import com.mojang.serialization.Codec;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
@@ -12,16 +13,16 @@ import org.spongepowered.asm.mixin.Mixin;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Function; //import java.util.function.Function;
@Mixin(EndCityFeature.class) @Mixin(EndCityFeature.class)
public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig> public abstract class EndCityFeatureMixin extends StructureFeature<DefaultFeatureConfig>
{ {
private static final List<Biome.SpawnEntry> spawnList = Lists.newArrayList(new Biome.SpawnEntry(EntityType.SHULKER, 10, 4, 4)); private static final List<Biome.SpawnEntry> spawnList = Lists.newArrayList(new Biome.SpawnEntry(EntityType.SHULKER, 10, 4, 4));
public EndCityFeatureMixin(Function<Dynamic<?>, ? extends DefaultFeatureConfig> function_1) public EndCityFeatureMixin(Codec<DefaultFeatureConfig> codec)
{ {
super(function_1); super(codec);
} }
@Override @Override
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
@@ -21,7 +22,7 @@ public abstract class Entity_portalSuffocationMixin
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;getLastNetherPortalDirection()Lnet/minecraft/util/math/Direction;" target = "Lnet/minecraft/entity/Entity;getLastNetherPortalDirection()Lnet/minecraft/util/math/Direction;"
)) ))
private void registerEntityDimensionChange(DimensionType newDimension, CallbackInfoReturnable<Entity> cir) private void registerEntityDimensionChange(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{ {
if (CarpetSettings.portalSuffocationFix) if (CarpetSettings.portalSuffocationFix)
{ {
@@ -43,7 +44,7 @@ public abstract class Entity_portalSuffocationMixin
} }
@Inject(method = "changeDimension", at = @At("RETURN")) @Inject(method = "changeDimension", at = @At("RETURN"))
private void removeEntity(DimensionType dimensionType_1, CallbackInfoReturnable<Entity> cir) private void removeEntity(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{ {
CarpetSettings.currentTelepotingEntityBox = null; CarpetSettings.currentTelepotingEntityBox = null;
CarpetSettings.fixedPosition = null; CarpetSettings.fixedPosition = null;
@@ -1,18 +1,20 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.block.Blocks; //import net.minecraft.block.Blocks;
import net.minecraft.class_5311;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldAccess; //import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; //import net.minecraft.world.gen.chunk.ChunkGeneratorConfig;
import net.minecraft.world.gen.chunk.FlatChunkGenerator; import net.minecraft.world.gen.chunk.FlatChunkGenerator;
import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig; //import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig;
import net.minecraft.world.gen.feature.Feature; //import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import java.util.List; import java.util.List;
@@ -20,63 +22,64 @@ import java.util.List;
@Mixin(FlatChunkGenerator.class) @Mixin(FlatChunkGenerator.class)
public abstract class FlatChunkGeneratorMixin extends ChunkGenerator public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
{ {
public FlatChunkGeneratorMixin(BiomeSource biomeSource, ChunkGeneratorConfig chunkGeneratorConfig)
public FlatChunkGeneratorMixin(BiomeSource biomeSource, class_5311 arg)
{ {
super(biomeSource, chunkGeneratorConfig); super(biomeSource, arg);
} }
@Override @Override
public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos blockPos) public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos)
{ {
if (CarpetSettings.flatWorldStructureSpawning) if (CarpetSettings.flatWorldStructureSpawning)
{ {
if (Feature.SWAMP_HUT.isApproximatelyInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, true, StructureFeature.field_24851).hasChildren())
{ { //swamp hut
if (category == SpawnGroup.MONSTER) if (group == SpawnGroup.MONSTER)
{ {
return Feature.SWAMP_HUT.getMonsterSpawns(); return StructureFeature.field_24851.getMonsterSpawns();
} }
if (category == SpawnGroup.CREATURE) if (group == SpawnGroup.CREATURE)
{ {
return Feature.SWAMP_HUT.getCreatureSpawns(); return StructureFeature.field_24851.getCreatureSpawns();
} }
} }
else if (category == SpawnGroup.MONSTER)
if (group == SpawnGroup.MONSTER)
{ {
if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren())
{ {
return Feature.PILLAGER_OUTPOST.getMonsterSpawns(); return StructureFeature.PILLAGER_OUTPOST.getMonsterSpawns();
} }
if (CarpetSettings.huskSpawningInTemples) if (CarpetSettings.huskSpawningInTemples)
{ {
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren())
{ {
return Feature.DESERT_PYRAMID.getMonsterSpawns(); return StructureFeature.DESERT_PYRAMID.getMonsterSpawns();
} }
} }
if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, false, StructureFeature.MONUMENT).hasChildren())
{ {
return Feature.OCEAN_MONUMENT.getMonsterSpawns(); return StructureFeature.MONUMENT.getMonsterSpawns();
} }
if (Feature.NETHER_BRIDGE.isInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, true, StructureFeature.FORTRESS).hasChildren())
{ {
return Feature.NETHER_BRIDGE.getMonsterSpawns(); return StructureFeature.FORTRESS.getMonsterSpawns();
} }
if (CarpetSettings.shulkerSpawningInEndCities) if (CarpetSettings.shulkerSpawningInEndCities)
{ {
if (Feature.END_CITY.isInsideStructure(structureAccessor, blockPos)) if (accessor.method_28388(pos, true, StructureFeature.END_CITY).hasChildren())
{ {
return Feature.END_CITY.getMonsterSpawns(); return StructureFeature.END_CITY.getMonsterSpawns();
} }
} }
} }
} }
return super.getEntitySpawnList(biome, accessor, group, pos);
return super.getEntitySpawnList(biome, structureAccessor, category, blockPos);
} }
} }
@@ -1,23 +1,23 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; //import carpet.CarpetSettings;
import net.minecraft.class_5284; //import net.minecraft.class_5284;
import net.minecraft.entity.SpawnGroup; //import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos; //import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome; //import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource; //import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.StructureAccessor; //import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.FloatingIslandsChunkGenerator; //import net.minecraft.world.gen.chunk.FloatingIslandsChunkGenerator;
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator; //import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
import net.minecraft.world.gen.feature.Feature; //import net.minecraft.world.gen.feature.Feature;
import org.spongepowered.asm.mixin.Mixin; //import org.spongepowered.asm.mixin.Mixin;
//
//import java.util.List;
import java.util.List; //@Mixin(FloatingIslandsChunkGenerator.class)
public abstract class FloatingIslandsChunkGeneratorMixin //extends SurfaceChunkGenerator<class_5284> //FloatingIslandsChunkGeneratorConfig
@Mixin(FloatingIslandsChunkGenerator.class)
public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGenerator<class_5284> //FloatingIslandsChunkGeneratorConfig
{ {
public FloatingIslandsChunkGeneratorMixin(BiomeSource biomeSource, long l, class_5284 arg, int i, int j, int k, boolean bl) /*public FloatingIslandsChunkGeneratorMixin(BiomeSource biomeSource, long l, class_5284 arg, int i, int j, int k, boolean bl)
{ {
super(biomeSource, l, arg, i, j, k, bl); super(biomeSource, l, arg, i, j, k, bl);
} }
@@ -33,5 +33,5 @@ public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGen
} }
} }
return super.getEntitySpawnList(biome, structureAccessor, category, pos); return super.getEntitySpawnList(biome, structureAccessor, category, pos);
} }*/
} }
@@ -6,6 +6,7 @@ import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -17,6 +18,6 @@ public class HuskEntityMixin
private static boolean isSkylightOrTempleVisible(WorldAccess WorldAccess, BlockPos blockPos_1) private static boolean isSkylightOrTempleVisible(WorldAccess WorldAccess, BlockPos blockPos_1)
{ {
return WorldAccess.isSkyVisible(blockPos_1) || return WorldAccess.isSkyVisible(blockPos_1) ||
(CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(((ServerWorld)WorldAccess).getStructureAccessor(), blockPos_1)); (CarpetSettings.huskSpawningInTemples && (((ServerWorld)WorldAccess).getStructureAccessor().method_28388(blockPos_1, false, StructureFeature.DESERT_PYRAMID).hasChildren()));
} }
} }
@@ -1,27 +1,27 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; //import carpet.CarpetSettings;
import net.minecraft.entity.SpawnGroup; //import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos; //import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldAccess; //import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome; //import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource; //import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.StructureAccessor; //import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.OverworldChunkGenerator; //import net.minecraft.world.gen.chunk.OverworldChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig; //import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator; //import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
import net.minecraft.world.gen.feature.Feature; //import net.minecraft.world.gen.feature.Feature;
import org.spongepowered.asm.mixin.Mixin; //import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; //import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; //import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List; import java.util.List;
@Mixin(OverworldChunkGenerator.class) //@Mixin(OverworldChunkGenerator.class)
public abstract class OverworldChunkGeneratorMixin extends SurfaceChunkGenerator<OverworldChunkGeneratorConfig> public abstract class OverworldChunkGeneratorMixin //extends SurfaceChunkGenerator<OverworldChunkGeneratorConfig>
{ {
public OverworldChunkGeneratorMixin(BiomeSource biomeSource, long seed, OverworldChunkGeneratorConfig arg, int i, int j, int k, boolean bl) /*public OverworldChunkGeneratorMixin(BiomeSource biomeSource, long seed, OverworldChunkGeneratorConfig arg, int i, int j, int k, boolean bl)
{ {
super(biomeSource, seed, arg, i, j, k, bl); super(biomeSource, seed, arg, i, j, k, bl);
} }
@@ -38,5 +38,5 @@ public abstract class OverworldChunkGeneratorMixin extends SurfaceChunkGenerator
cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns()); cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
} }
} }
} }*/
} }
@@ -4,6 +4,7 @@ import carpet.fakes.ServerChunkManagerInterface;
import carpet.utils.SpawnReporter; import carpet.utils.SpawnReporter;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.minecraft.class_5217; import net.minecraft.class_5217;
import net.minecraft.class_5321;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.server.world.ChunkTicketManager; import net.minecraft.server.world.ChunkTicketManager;
import net.minecraft.server.world.ServerChunkManager; import net.minecraft.server.world.ServerChunkManager;
@@ -47,7 +48,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
private int setupTracking(ChunkTicketManager chunkTicketManager) private int setupTracking(ChunkTicketManager chunkTicketManager)
{ {
int j = chunkTicketManager.getSpawningChunkCount(); int j = chunkTicketManager.getSpawningChunkCount();
DimensionType dim = this.world.method_27983(); // getDimensionType; class_5321<DimensionType> dim = this.world.method_27983(); // getDimensionType;
//((WorldInterface)world).getPrecookedMobs().clear(); not needed because mobs are compared with predefined BBs //((WorldInterface)world).getPrecookedMobs().clear(); not needed because mobs are compared with predefined BBs
SpawnReporter.chunkCounts.put(dim, j); SpawnReporter.chunkCounts.put(dim, j);
@@ -77,7 +78,7 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
{ {
for (SpawnGroup cat: SpawnGroup.values()) for (SpawnGroup cat: SpawnGroup.values())
{ {
DimensionType dim = world.method_27983(); // getDimensionType; class_5321<DimensionType> dim = world.method_27983(); // getDimensionType;
Pair key = Pair.of(dim, cat); Pair key = Pair.of(dim, cat);
int spawnTries = SpawnReporter.spawn_tries.get(cat); int spawnTries = SpawnReporter.spawn_tries.get(cat);
if (!SpawnReporter.local_spawns.containsKey(cat)) if (!SpawnReporter.local_spawns.containsKey(cat))
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.fakes.EntityInterface; import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup; import carpet.script.EntityEventsGroup;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -88,23 +89,23 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
} }
private Vec3d previousLocation; private Vec3d previousLocation;
private DimensionType previousDimension; private class_5321<DimensionType> previousDimension;
@Inject(method = "changeDimension", at = @At("HEAD")) @Inject(method = "changeDimension", at = @At("HEAD"))
private void logPreviousCoordinates(DimensionType newDimension, CallbackInfoReturnable<Entity> cir) private void logPreviousCoordinates(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{ {
previousLocation = getPos(); previousLocation = getPos();
previousDimension = dimension; previousDimension = world.method_27983(); //dimension type
} }
@Inject(method = "changeDimension", at = @At("RETURN")) @Inject(method = "changeDimension", at = @At("RETURN"))
private void atChangeDimension(DimensionType newDimension, CallbackInfoReturnable<Entity> cir) private void atChangeDimension(class_5321<DimensionType> newDimension, CallbackInfoReturnable<Entity> cir)
{ {
if (PLAYER_CHANGES_DIMENSION.isNeeded()) if (PLAYER_CHANGES_DIMENSION.isNeeded())
{ {
ServerPlayerEntity player = (ServerPlayerEntity) (Object)this; ServerPlayerEntity player = (ServerPlayerEntity) (Object)this;
Vec3d to = null; Vec3d to = null;
if (!notInAnyWorld || previousDimension != DimensionType.THE_END || newDimension != DimensionType.OVERWORLD) if (!notInAnyWorld || previousDimension != DimensionType.field_24755 || newDimension != DimensionType.field_24753) // end ow
{ {
to = getPos(); to = getPos();
} }
@@ -27,6 +27,8 @@ public abstract class ServerWorld_tickMixin extends World
@Shadow protected abstract void processSyncedBlockEvents(); @Shadow protected abstract void processSyncedBlockEvents();
//@Shadow protected abstract void sendBlockActions(); //@Shadow protected abstract void sendBlockActions();
@Shadow protected abstract void method_29203();
protected ServerWorld_tickMixin(class_5269 arg, DimensionType dimensionType, Supplier<Profiler> supplier, boolean bl, boolean bl2, long l) protected ServerWorld_tickMixin(class_5269 arg, DimensionType dimensionType, Supplier<Profiler> supplier, boolean bl, boolean bl2, long l)
{ {
super(arg, dimensionType, supplier, bl, bl2, l); super(arg, dimensionType, supplier, bl, bl2, l);
@@ -138,11 +140,11 @@ public abstract class ServerWorld_tickMixin extends World
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;tickTime()V" target = "Lnet/minecraft/server/world/ServerWorld;method_29203()V" //tickTime() // right before chunk source
)) ))
private void tickTimeConditionally(ServerWorld serverWorld) private void tickTimeConditionally(ServerWorld serverWorld)
{ {
if (TickSpeed.process_entities) this.tickTime(); if (TickSpeed.process_entities) this.method_29203();
} }
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
@@ -165,14 +167,14 @@ public abstract class ServerWorld_tickMixin extends World
if (TickSpeed.process_entities) raidManager.tick(); if (TickSpeed.process_entities) raidManager.tick();
} }
@Redirect(method = "tick", at = @At( /*@Redirect(method = "tick", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/WanderingTraderManager;tick()V" target = "Lnet/minecraft/world/WanderingTraderManager;tick()V"
)) ))
private void tickConditionally(WanderingTraderManager wanderingTraderManager) private void tickConditionally(WanderingTraderManager wanderingTraderManager)
{ {
if (TickSpeed.process_entities) wanderingTraderManager.tick(); if (TickSpeed.process_entities) wanderingTraderManager.tick();
} }*/
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
value = "INVOKE", value = "INVOKE",
@@ -6,6 +6,7 @@ import carpet.utils.SpawnReporter;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.FenceGateBlock; import net.minecraft.block.FenceGateBlock;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityData; import net.minecraft.entity.EntityData;
@@ -162,7 +163,7 @@ public class SpawnHelperMixin
if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null) if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null)
{ {
SpawnReporter.registerSpawn( SpawnReporter.registerSpawn(
world.method_27983(), // getDimensionType //dimension.getType(), // getDimensionType //world.method_27983(), // getDimensionType //dimension.getType(), // getDimensionType
(MobEntity) entity_1, (MobEntity) entity_1,
entity_1.getType().getSpawnGroup(), entity_1.getType().getSpawnGroup(),
entity_1.getBlockPos()); entity_1.getBlockPos());
@@ -280,7 +281,7 @@ public class SpawnHelperMixin
SpawnGroup entityCategory = var6[var8]; SpawnGroup entityCategory = var6[var8];
if ((spawnAnimals || !entityCategory.isPeaceful()) && (spawnMonsters || entityCategory.isPeaceful()) && (shouldSpawnAnimals || !entityCategory.isAnimal()) ) if ((spawnAnimals || !entityCategory.isPeaceful()) && (spawnMonsters || entityCategory.isPeaceful()) && (shouldSpawnAnimals || !entityCategory.isAnimal()) )
{ {
DimensionType dim = world.method_27983(); // getDimensionType; class_5321<DimensionType> dim = world.method_27983(); // getDimensionType;
int newCap = (int) ((double)entityCategory.getCapacity()*(Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)))); 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_2 = SpawnReporter.chunkCounts.get(dim); // eligible chunks for spawning
int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits int int_3 = newCap * int_2 / CHUNK_AREA; //current spawning limits
@@ -7,13 +7,14 @@ import net.minecraft.structure.StructureStart;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockBox;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.gen.ChunkRandom;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature; import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -21,31 +22,33 @@ import org.spongepowered.asm.mixin.Shadow;
import java.util.Random; import java.util.Random;
@Mixin(StructureFeature.class) @Mixin(StructureFeature.class)
public abstract class StructureFeatureMixin implements StructureFeatureInterface public abstract class StructureFeatureMixin<C extends FeatureConfig> implements StructureFeatureInterface<C>
{ {
//problem is that is seems that now chunks deal with its portion of the strucuture //problem is that is seems that now chunks deal with its portion of the strucuture
//on its own. //on its own.
@Shadow public abstract int getRadius(); //@Shadow public abstract int getRadius();
@Shadow public abstract String getName(); @Shadow public abstract String getName();
@Shadow public abstract StructureFeature.StructureStartFactory getStructureStartFactory(); @Shadow public abstract StructureFeature.StructureStartFactory getStructureStartFactory();
@Shadow protected abstract boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig);
@Override @Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos) public boolean plopAnywhere(ServerWorld world, BlockPos pos)
{ {
return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), false); return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), false, null, null);
} }
@Override @Override
public boolean gridAnywhere(ServerWorld world, BlockPos pos) public boolean gridAnywhere(ServerWorld world, BlockPos pos)
{ {
return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), true); return plopAnywhere(world, pos, world.getChunkManager().getChunkGenerator(), true, null, null);
} }
@Override @Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly) public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly, Biome biome, FeatureConfig config)
{ {
if (world.isClient()) if (world.isClient())
return false; return false;
@@ -56,7 +59,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
int j = pos.getX() >> 4; int j = pos.getX() >> 4;
int k = pos.getZ() >> 4; int k = pos.getZ() >> 4;
long chId = ChunkPos.toLong(j, k); long chId = ChunkPos.toLong(j, k);
StructureStart structurestart = forceStructureStart(world, generator, rand, chId); StructureStart structurestart = forceStructureStart(world, generator, rand, chId, biome, config);
if (structurestart == StructureStart.DEFAULT) if (structurestart == StructureStart.DEFAULT)
{ {
return false; return false;
@@ -68,18 +71,19 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
BlockBox box = structurestart.getBoundingBox(); BlockBox box = structurestart.getBoundingBox();
if (!wireOnly) if (!wireOnly)
{ {
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand, structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,box,
new BlockBox( /*new BlockBox(
pos.getX() - this.getRadius() * 16, pos.getX() - this.getRadius() * 16,
pos.getZ() - this.getRadius() * 16, pos.getZ() - this.getRadius() * 16,
pos.getX() + (this.getRadius() + 1) * 16, pos.getX() + (this.getRadius() + 1) * 16,
pos.getZ() + (1 + this.getRadius()) * 16), pos.getZ() + (1 + this.getRadius()) * 16),*/
new ChunkPos(j, k) new ChunkPos(j, k)
); );
} }
//structurestart.notifyPostProcessAt(new ChunkPos(j, k)); //structurestart.notifyPostProcessAt(new ChunkPos(j, k));
int i = Math.max(box.getBlockCountX(),box.getBlockCountZ())/16+1; //size
int i = getRadius(); //int i = getRadius();
for (int k1 = j - i; k1 <= j + i; ++k1) for (int k1 = j - i; k1 <= j + i; ++k1)
{ {
for (int l1 = k - i; l1 <= k + i; ++l1) for (int l1 = k - i; l1 <= k + i; ++l1)
@@ -108,7 +112,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return true; return true;
} }
private StructureStart forceStructureStart(ServerWorld worldIn, ChunkGenerator generator, Random rand, long packedChunkPos) private StructureStart forceStructureStart(ServerWorld worldIn, ChunkGenerator generator, Random rand, long packedChunkPos, Biome biome, FeatureConfig config)
{ {
ChunkPos chunkpos = new ChunkPos(packedChunkPos); ChunkPos chunkpos = new ChunkPos(packedChunkPos);
StructureStart structurestart; StructureStart structurestart;
@@ -124,9 +128,14 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return structurestart; return structurestart;
} }
} }
Biome biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 ); Biome biome_1 = biome;
if (biome == null)
biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed()); StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed());
structurestart1.init(generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1); if (config == null)
config = new DefaultFeatureConfig();
structurestart1.init(generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT; structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
if (structurestart.hasChildren()) if (structurestart.hasChildren())
@@ -137,4 +146,10 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
//long2objectmap.put(packedChunkPos, structurestart); //long2objectmap.put(packedChunkPos, structurestart);
return structurestart; return structurestart;
} }
@Override
public boolean shouldStartPublicAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long l, ChunkRandom chunkRandom, int i, int j, Biome biome, ChunkPos chunkPos, C featureConfig)
{
return shouldStartAt(chunkGenerator, biomeSource, l, chunkRandom, i, j, biome, chunkPos, featureConfig);
}
} }
@@ -0,0 +1,48 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_5311;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
//import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
@Mixin(SurfaceChunkGenerator.class)
public abstract class SurfaceChunkGenerator_husksSpawnMixin extends ChunkGenerator
{
public SurfaceChunkGenerator_husksSpawnMixin(BiomeSource biomeSource, class_5311 arg)
{
super(biomeSource, arg);
}
@Inject(method = "getEntitySpawnList", at = @At("HEAD"), cancellable = true)
private void isInsidePyramid(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
if (CarpetSettings.huskSpawningInTemples && group == SpawnGroup.MONSTER)
{
if (accessor.method_28388(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren())
{
cir.setReturnValue(StructureFeature.DESERT_PYRAMID.getMonsterSpawns());
}
}
if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == group)
{
if (accessor.method_28388(pos, true, StructureFeature.END_CITY).hasChildren())
{
cir.setReturnValue(StructureFeature.END_CITY.getMonsterSpawns());
}
}
}
}
@@ -120,7 +120,7 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
if (itemStack_1.getItem() == Items.EMERALD) if (itemStack_1.getItem() == Items.EMERALD)
{ {
GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null); GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null);
if (bedPos == null || bedPos.getDimension() != dimension) if (bedPos == null || bedPos.getDimension() != world.method_27983()) // get DImension
{ {
sayNo(); sayNo();
((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0); ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
@@ -3,7 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.class_5294; import net.minecraft.class_5294;
import net.minecraft.client.render.WorldRenderer; import net.minecraft.client.render.WorldRenderer;
import net.minecraft.world.dimension.Dimension; //import net.minecraft.world.dimension.Dimension;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@@ -2,6 +2,7 @@ package carpet.patches;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.class_5321;
import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket; import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket;
import net.minecraft.network.packet.s2c.play.EntitySetHeadYawS2CPacket; import net.minecraft.network.packet.s2c.play.EntitySetHeadYawS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
@@ -25,10 +26,10 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
public Runnable fixStartingPosition = () -> {}; public Runnable fixStartingPosition = () -> {};
public boolean isAShadow; public boolean isAShadow;
public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, DimensionType dimension, GameMode gamemode) public static EntityPlayerMPFake createFake(String username, MinecraftServer server, double d0, double d1, double d2, double yaw, double pitch, class_5321<DimensionType> dimensionId, GameMode gamemode)
{ {
//prolly half of that crap is not necessary, but it works //prolly half of that crap is not necessary, but it works
ServerWorld worldIn = server.getWorld(dimension); ServerWorld worldIn = server.getWorld(dimensionId);
ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn); ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn);
GameProfile gameprofile = server.getUserCache().findByName(username); GameProfile gameprofile = server.getUserCache().findByName(username);
if (gameprofile == null) if (gameprofile == null)
@@ -42,26 +43,13 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, false); EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, false);
instance.fixStartingPosition = () -> instance.refreshPositionAndAngles(d0, d1, d2, (float) yaw, (float) pitch); instance.fixStartingPosition = () -> instance.refreshPositionAndAngles(d0, d1, d2, (float) yaw, (float) pitch);
server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), instance); server.getPlayerManager().onPlayerConnect(new NetworkManagerFake(NetworkSide.SERVERBOUND), instance);
if (instance.dimension != dimension) //player was logged in in a different dimension instance.teleport(worldIn, d0, d1, d2, (float)yaw, (float)pitch);
{
ServerWorld old_world = server.getWorld(instance.dimension);
instance.dimension = dimension;
old_world.removePlayer(instance);
instance.removed = false;
//worldIn.spawnEntity(instance);
instance.setWorld(worldIn);
server.getPlayerManager().sendWorldInfo(instance, worldIn);
instance.networkHandler.requestTeleport(d0, d1, d2, (float) yaw, (float) pitch);
instance.interactionManager.setWorld(worldIn);
worldIn.onPlayerChangeDimension(instance);
}
instance.setHealth(20.0F); instance.setHealth(20.0F);
instance.removed = false; instance.removed = false;
instance.networkHandler.requestTeleport(d0, d1, d2, (float) yaw, (float) pitch);
instance.stepHeight = 0.6F; instance.stepHeight = 0.6F;
interactionManagerIn.setGameMode(gamemode); interactionManagerIn.setGameMode(gamemode);
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(instance, (byte) (instance.headYaw * 256 / 360)), instance.dimension); server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(instance, (byte) (instance.headYaw * 256 / 360)), dimensionId);//instance.dimension);
server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), instance.dimension); server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), dimensionId);//instance.dimension);
instance.getServerWorld().getChunkManager().updateCameraPosition(instance); instance.getServerWorld().getChunkManager().updateCameraPosition(instance);
instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes) instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes)
return instance; return instance;
@@ -71,7 +59,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
{ {
player.getServer().getPlayerManager().remove(player); player.getServer().getPlayerManager().remove(player);
player.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login")); player.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login"));
ServerWorld worldIn = server.getWorld(player.dimension); ServerWorld worldIn = player.getServerWorld();//.getWorld(player.dimension);
ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn); ServerPlayerInteractionManager interactionManagerIn = new ServerPlayerInteractionManager(worldIn);
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, true); EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, interactionManagerIn, true);
@@ -85,7 +73,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
playerShadow.dataTracker.set(PLAYER_MODEL_PARTS, player.getDataTracker().get(PLAYER_MODEL_PARTS)); playerShadow.dataTracker.set(PLAYER_MODEL_PARTS, player.getDataTracker().get(PLAYER_MODEL_PARTS));
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.dimension); server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(playerShadow, (byte) (player.headYaw * 256 / 360)), playerShadow.world.method_27983());
server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, playerShadow)); server.getPlayerManager().sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.ADD_PLAYER, playerShadow));
player.getServerWorld().getChunkManager().updateCameraPosition(playerShadow); player.getServerWorld().getChunkManager().updateCameraPosition(playerShadow);
return playerShadow; return playerShadow;
@@ -113,6 +101,7 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
{ {
this.networkHandler.syncWithPlayerPosition(); this.networkHandler.syncWithPlayerPosition();
this.getServerWorld().getChunkManager().updateCameraPosition(this); this.getServerWorld().getChunkManager().updateCameraPosition(this);
//if (netherPortalCooldown==10) onTeleportationDone(); <- causes hard crash but would need to be done to enable portals
} }
super.tick(); super.tick();
this.playerTick(); this.playerTick();
@@ -12,6 +12,7 @@ import carpet.script.value.StringValue;
import carpet.script.value.Value; import carpet.script.value.Value;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.class_5321;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@@ -190,7 +191,7 @@ public class CarpetEventServer
{ {
handler.call(Collections::emptyList, () -> handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource(). CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD)) withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.field_24753))// OVERWORLD))
); );
} }
}, },
@@ -201,7 +202,7 @@ public class CarpetEventServer
{ {
handler.call(Collections::emptyList, () -> handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource(). CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.THE_NETHER)) withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.field_24754))// THE_NETHER))
); );
} }
}, },
@@ -212,7 +213,7 @@ public class CarpetEventServer
{ {
handler.call(Collections::emptyList, () -> handler.call(Collections::emptyList, () ->
CarpetServer.minecraft_server.getCommandSource(). CarpetServer.minecraft_server.getCommandSource().
withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.THE_END)) withWorld(CarpetServer.minecraft_server.getWorld(DimensionType.field_24755))//THE_END))
); );
} }
}, },
@@ -530,13 +531,13 @@ public class CarpetEventServer
PLAYER_CHANGES_DIMENSION("player_changes_dimension", 5, false) PLAYER_CHANGES_DIMENSION("player_changes_dimension", 5, false)
{ {
@Override @Override
public void onDimensionChange(ServerPlayerEntity player, Vec3d from, Vec3d to, DimensionType fromDim, DimensionType dimTo) public void onDimensionChange(ServerPlayerEntity player, Vec3d from, Vec3d to, class_5321<DimensionType> fromDim, class_5321<DimensionType> dimTo)
{ {
// eligibility already checked in mixin // eligibility already checked in mixin
Value fromValue = ListValue.fromTriple(from.x, from.y, from.z); Value fromValue = ListValue.fromTriple(from.x, from.y, from.z);
Value toValue = (to == null)?Value.NULL:ListValue.fromTriple(to.x, to.y, to.z); Value toValue = (to == null)?Value.NULL:ListValue.fromTriple(to.x, to.y, to.z);
Value fromDimStr = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(fromDim))); Value fromDimStr = new StringValue(NBTSerializableValue.nameFromRegistryId(fromDim.method_29177()));
Value toDimStr = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(dimTo))); Value toDimStr = new StringValue(NBTSerializableValue.nameFromRegistryId(dimTo.method_29177()));
handler.call( () -> Arrays.asList( handler.call( () -> Arrays.asList(
((c, t) -> new EntityValue(player)), ((c, t) -> new EntityValue(player)),
@@ -619,7 +620,7 @@ public class CarpetEventServer
public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS) { } public void onBlockBroken(ServerPlayerEntity player, BlockPos pos, BlockState previousBS) { }
public void onBlockPlaced(ServerPlayerEntity player, BlockPos pos, Hand enumhand, ItemStack itemstack) { } public void onBlockPlaced(ServerPlayerEntity player, BlockPos pos, Hand enumhand, ItemStack itemstack) { }
public void onEntityAction(ServerPlayerEntity player, Entity entity, Hand enumhand) { } public void onEntityAction(ServerPlayerEntity player, Entity entity, Hand enumhand) { }
public void onDimensionChange(ServerPlayerEntity player, Vec3d from, Vec3d to, DimensionType fromDim, DimensionType dimTo) {} public void onDimensionChange(ServerPlayerEntity player, Vec3d from, Vec3d to, class_5321<DimensionType> fromDim, class_5321<DimensionType> dimTo) {}
public void onDamage(Entity target, float amount, DamageSource source) { } public void onDamage(Entity target, float amount, DamageSource source) { }
@@ -403,7 +403,7 @@ public class CarpetExpression
private static Value structureToValue(StructureStart structure) private static Value structureToValue(StructureStart<?> structure)
{ {
if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL; if (structure == null || structure == StructureStart.DEFAULT) return Value.NULL;
List<Value> pieces = new ArrayList<>(); List<Value> pieces = new ArrayList<>();
@@ -1158,12 +1158,15 @@ public class CarpetExpression
Map<String, LongSet> references = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.STRUCTURE_REFERENCES).getStructureReferences(); Map<String, LongSet> references = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.STRUCTURE_REFERENCES).getStructureReferences();
if (lv.size() == locator.offset) if (lv.size() == locator.offset)
{ {
//CarpetSettings.LOG.error(references.keySet().stream().collect(Collectors.joining(",")));
List<Value> referenceList = references.entrySet().stream(). List<Value> referenceList = references.entrySet().stream().
filter(e -> e.getValue()!= null && !e.getValue().isEmpty()). filter(e -> e.getValue()!= null && !e.getValue().isEmpty()).
map(e -> new StringValue(FeatureGenerator.structureToFeature.get(e.getKey()).get(0))).collect(Collectors.toList()); map(e -> new StringValue(FeatureGenerator.structureToFeature.get(FeatureGenerator.fix(e.getKey())).get(0))).collect(Collectors.toList());
return (_c, _t ) -> ListValue.wrap(referenceList); return (_c, _t ) -> ListValue.wrap(referenceList);
} }
String simpleStructureName = lv.get(locator.offset).evalValue(c).getString().toLowerCase(Locale.ROOT); String simpleStructureName = lv.get(locator.offset).evalValue(c).getString().toLowerCase(Locale.ROOT);
//CarpetSettings.LOG.error(FeatureGenerator.featureToStructure.keySet().stream().collect(Collectors.joining(",")));
//CarpetSettings.LOG.error(FeatureGenerator.featureToStructure.values().stream().collect(Collectors.joining(",")));
String structureName = FeatureGenerator.featureToStructure.get(simpleStructureName); String structureName = FeatureGenerator.featureToStructure.get(simpleStructureName);
if (structureName == null) return LazyValue.NULL; if (structureName == null) return LazyValue.NULL;
LongSet structureReferences = references.get(structureName); LongSet structureReferences = references.get(structureName);
@@ -1192,7 +1195,7 @@ public class CarpetExpression
String reqString = requested.getString(); String reqString = requested.getString();
String structureName = FeatureGenerator.featureToStructure.get(reqString); String structureName = FeatureGenerator.featureToStructure.get(reqString);
if (structureName == null) throw new InternalExpressionException("Unknown structure: " + reqString); if (structureName == null) throw new InternalExpressionException("Unknown structure: " + reqString);
structure = Feature.STRUCTURES.get(structureName.toLowerCase(Locale.ROOT)); structure = StructureFeature.field_24842.get(structureName.toLowerCase(Locale.ROOT));
if (structure == null) throw new InternalExpressionException("Unsupported structure: " + structureName); if (structure == null) throw new InternalExpressionException("Unsupported structure: " + structureName);
} }
if (lv.size() > locator.offset+1) if (lv.size() > locator.offset+1)
@@ -1202,19 +1205,19 @@ public class CarpetExpression
} }
if (structure != null) if (structure != null)
{ {
StructureStart start = FeatureGenerator.shouldStructureStartAt(world, pos, structure, needSize); StructureStart<?> start = FeatureGenerator.shouldStructureStartAt(world, pos, structure, needSize);
if (start == null) return LazyValue.NULL; if (start == null) return LazyValue.NULL;
if (!needSize) return LazyValue.TRUE; if (!needSize) return LazyValue.TRUE;
Value ret = structureToValue(start); Value ret = structureToValue(start);
return (_c, _t) -> ret; return (_c, _t) -> ret;
} }
Map<Value, Value> ret = new HashMap<>(); Map<Value, Value> ret = new HashMap<>();
for(StructureFeature<?> str : Feature.STRUCTURES.values()) for(StructureFeature<?> str : StructureFeature.field_24842.values())
{ {
StructureStart start = FeatureGenerator.shouldStructureStartAt(world, pos, str, needSize); StructureStart start = FeatureGenerator.shouldStructureStartAt(world, pos, str, needSize);
if (start == null) continue; if (start == null) continue;
Value key = new StringValue(FeatureGenerator.structureToFeature.get(str.getName()).get(0)); Value key = new StringValue(FeatureGenerator.structureToFeature.get(FeatureGenerator.fix(str.getName())).get(0));
ret.put(key, (!needSize)?Value.NULL:structureToValue(start)); ret.put(key, (!needSize)?Value.NULL:structureToValue(start));
} }
Value retMap = MapValue.wrap(ret); Value retMap = MapValue.wrap(ret);
@@ -1227,18 +1230,18 @@ public class CarpetExpression
ServerWorld world = cc.s.getWorld(); ServerWorld world = cc.s.getWorld();
BlockPos pos = locator.block.getPos(); BlockPos pos = locator.block.getPos();
Map<String, StructureStart> structures = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.STRUCTURE_STARTS).getStructureStarts(); Map<String, StructureStart<?>> structures = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.STRUCTURE_STARTS).getStructureStarts();
if (lv.size() == locator.offset) if (lv.size() == locator.offset)
{ {
Map<Value, Value> structureList = new HashMap<>(); Map<Value, Value> structureList = new HashMap<>();
for (Map.Entry<String, StructureStart> entry : structures.entrySet()) for (Map.Entry<String, StructureStart<?>> entry : structures.entrySet())
{ {
StructureStart start = entry.getValue(); StructureStart<?> start = entry.getValue();
if (start == StructureStart.DEFAULT) if (start == StructureStart.DEFAULT)
continue; continue;
BlockBox box = start.getBoundingBox(); BlockBox box = start.getBoundingBox();
structureList.put( structureList.put(
new StringValue(FeatureGenerator.structureToFeature.get(entry.getKey()).get(0)), new StringValue(FeatureGenerator.structureToFeature.get(FeatureGenerator.fix(entry.getKey())).get(0)),
ListValue.of(ListValue.fromTriple(box.minX, box.minY, box.minZ), ListValue.fromTriple(box.maxX, box.maxY, box.maxZ)) ListValue.of(ListValue.fromTriple(box.minX, box.minY, box.minZ), ListValue.fromTriple(box.maxX, box.maxY, box.maxZ))
); );
} }
@@ -1269,7 +1272,7 @@ public class CarpetExpression
// technically a world modification. Even if we could let it slide, we will still park it // technically a world modification. Even if we could let it slide, we will still park it
((CarpetContext) c).s.getMinecraftServer().submitAndJoin(() -> ((CarpetContext) c).s.getMinecraftServer().submitAndJoin(() ->
{ {
Map<String, StructureStart> structures = world.getChunk(pos).getStructureStarts(); Map<String, StructureStart<?>> structures = world.getChunk(pos).getStructureStarts();
if (lv.size() == locator.offset + 1) if (lv.size() == locator.offset + 1)
{ {
Boolean res = FeatureGenerator.gridStructure(structureName, ((CarpetContext) c).s.getWorld(), locator.block.getPos()); Boolean res = FeatureGenerator.gridStructure(structureName, ((CarpetContext) c).s.getWorld(), locator.block.getPos());
@@ -1284,7 +1287,7 @@ public class CarpetExpression
{ {
return; return;
} }
StructureStart start = structures.get(structureId); StructureStart<?> start = structures.get(structureId);
ChunkPos structureChunkPos = new ChunkPos(start.getChunkX(), start.getChunkZ()); ChunkPos structureChunkPos = new ChunkPos(start.getChunkX(), start.getChunkZ());
BlockBox box = start.getBoundingBox(); BlockBox box = start.getBoundingBox();
for (int chx = box.minX / 16; chx <= box.maxX / 16; chx++) for (int chx = box.minX / 16; chx <= box.maxX / 16; chx++)
@@ -2939,7 +2942,7 @@ public class CarpetExpression
{ {
long newTime = NumericValue.asNumber(lv.get(0).evalValue(c)).getLong(); long newTime = NumericValue.asNumber(lv.get(0).evalValue(c)).getLong();
if (newTime < 0) newTime = 0; if (newTime < 0) newTime = 0;
((CarpetContext) c).s.getWorld().setTimeOfDay(newTime); ((CarpetContext) c).s.getWorld().method_29199(newTime);// setTimeOfDay(newTime);
} }
return (cc, tt) -> time; return (cc, tt) -> time;
}); });
@@ -2995,7 +2998,7 @@ public class CarpetExpression
this.expr.addLazyFunction("current_dimension", 0, (c, t, lv) -> { this.expr.addLazyFunction("current_dimension", 0, (c, t, lv) -> {
ServerCommandSource s = ((CarpetContext)c).s; ServerCommandSource s = ((CarpetContext)c).s;
Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(s.getWorld().method_27983()))); // getDImensionType Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(s.getWorld().method_27983().method_29177())); // getDImensionType
return (cc, tt) -> retval; return (cc, tt) -> retval;
}); });
@@ -3026,15 +3029,15 @@ public class CarpetExpression
{ {
case "nether": case "nether":
case "the_nether": case "the_nether":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.THE_NETHER)); innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.field_24754));
break; break;
case "end": case "end":
case "the_end": case "the_end":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.THE_END)); innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.field_24755));
break; break;
case "overworld": case "overworld":
case "over_world": case "over_world":
innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.OVERWORLD)); innerSource = outerSource.withWorld(outerSource.getMinecraftServer().getWorld(DimensionType.field_24753));
break; break;
default: default:
throw new InternalExpressionException("Incorrect dimension string: "+dimString); throw new InternalExpressionException("Incorrect dimension string: "+dimString);
@@ -25,7 +25,7 @@ public class WorldTools
if (region == null) return false; if (region == null) return false;
return region.hasChunk(chpos); return region.hasChunk(chpos);
} }
Path regionPath = new File(((MinecraftServerInterface )world.getServer()).getCMSession().method_27424(world.getDimension().getType()), "region").toPath(); Path regionPath = new File(((MinecraftServerInterface )world.getServer()).getCMSession().method_27424(world.method_27983()), "region").toPath();
Path regionFilePath = regionPath.resolve(currentRegionName); Path regionFilePath = regionPath.resolve(currentRegionName);
File regionFile = regionFilePath.toFile(); File regionFile = regionFilePath.toFile();
if (!regionFile.exists()) if (!regionFile.exists())
@@ -169,7 +169,7 @@ public class BlockValue extends Value
public int hashCode() public int hashCode()
{ {
if (world != null && pos != null ) if (world != null && pos != null )
return GlobalPos.create(world.getDimension().getType(), pos).hashCode(); return GlobalPos.create(world.method_27983() , pos).hashCode(); //getDimension().getType()
return ("b"+getString()).hashCode(); return ("b"+getString()).hashCode();
} }
@@ -249,7 +249,7 @@ public class EntityValue extends Value
put("immune_to_fire", (e, a) -> new NumericValue(e.isFireImmune())); put("immune_to_fire", (e, a) -> new NumericValue(e.isFireImmune()));
put("invulnerable", (e, a) -> new NumericValue(e.isInvulnerable())); put("invulnerable", (e, a) -> new NumericValue(e.isInvulnerable()));
put("dimension", (e, a) -> new StringValue(nameFromRegistryId(Registry.DIMENSION_TYPE.getId(e.dimension)))); put("dimension", (e, a) -> new StringValue(nameFromRegistryId(e.world.method_27983().method_29177()))); // getDimId
put("height", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).height)); put("height", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).height));
put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width)); put("width", (e, a) -> new NumericValue(e.getDimensions(EntityPose.STANDING).width));
put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight())); put("eye_height", (e, a) -> new NumericValue(e.getStandingEyeHeight()));
+1 -1
View File
@@ -175,7 +175,7 @@ public class BlockInfo
Material material = state.getMaterial(); Material material = state.getMaterial();
Block block = state.getBlock(); Block block = state.getBlock();
String metastring = ""; String metastring = "";
for (net.minecraft.state.property.Property<?> iproperty : state.getProperties()) for (net.minecraft.state.property.Property<?> iproperty : state.method_28501())// getProperties())
{ {
metastring += ", "+iproperty.getName() + '='+state.get(iproperty); metastring += ", "+iproperty.getName() + '='+state.get(iproperty);
} }
@@ -56,15 +56,15 @@ public class CarpetProfiler
private static String getSectionString(World world, String section) private static String getSectionString(World world, String section)
{ {
return String.format("%s.%s%s", return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""), world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
section, section, // ^ getDImension getId
world.isClient ? " (Client)" : ""); world.isClient ? " (Client)" : "");
} }
private static String getEntityString(World world, Entity e) private static String getEntityString(World world, Entity e)
{ {
return String.format("%s.%s%s", return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""), world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
Registry.ENTITY_TYPE.getId(e.getType()).toString().replaceFirst("minecraft:", ""), Registry.ENTITY_TYPE.getId(e.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : ""); world.isClient ? " (Client)" : "");
} }
@@ -72,7 +72,7 @@ public class CarpetProfiler
private static String getTEntityString(World world, BlockEntity be) private static String getTEntityString(World world, BlockEntity be)
{ {
return String.format("%s.%s%s", return String.format("%s.%s%s",
world.getDimension().getType().toString().replaceFirst("minecraft:", ""), world.method_27983().method_29177().toString().replaceFirst("minecraft:", ""),
Registry.BLOCK_ENTITY_TYPE.getId(be.getType()).toString().replaceFirst("minecraft:", ""), Registry.BLOCK_ENTITY_TYPE.getId(be.getType()).toString().replaceFirst("minecraft:", ""),
world.isClient ? " (Client)" : ""); world.isClient ? " (Client)" : "");
} }
@@ -5,6 +5,7 @@ import carpet.helpers.TickSpeed;
import carpet.logging.LoggerRegistry; import carpet.logging.LoggerRegistry;
import carpet.logging.logHelpers.PacketCounter; import carpet.logging.logHelpers.PacketCounter;
import carpet.mixins.PlayerListHeaderS2CPacketMixin; import carpet.mixins.PlayerListHeaderS2CPacketMixin;
import net.minecraft.class_5321;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.network.packet.s2c.play.PlayerListHeaderS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerListHeaderS2CPacket;
@@ -58,17 +59,17 @@ public class HUDController
if (LoggerRegistry.__mobcaps) if (LoggerRegistry.__mobcaps)
LoggerRegistry.getLogger("mobcaps").log((option, player) -> { LoggerRegistry.getLogger("mobcaps").log((option, player) -> {
DimensionType dim = player.dimension; class_5321<DimensionType> dim = player.world.method_27983(); //getDimType
switch (option) switch (option)
{ {
case "overworld": case "overworld":
dim = DimensionType.OVERWORLD; dim = DimensionType.field_24753; // OW
break; break;
case "nether": case "nether":
dim = DimensionType.THE_NETHER; dim = DimensionType.field_24754; // nrther
break; break;
case "end": case "end":
dim = DimensionType.THE_END; dim = DimensionType.field_24755; // end
break; break;
} }
return new BaseText[]{SpawnReporter.printMobcapsForDimension(server.getWorld(dim), false).get(0)}; return new BaseText[]{SpawnReporter.printMobcapsForDimension(server.getWorld(dim), false).get(0)};
+8 -7
View File
@@ -9,6 +9,7 @@ import net.minecraft.text.HoverEvent;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.Style; import net.minecraft.text.Style;
import net.minecraft.text.TextColor; import net.minecraft.text.TextColor;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
@@ -251,11 +252,11 @@ public class Messenger
//message source //message source
public static void m(ServerCommandSource source, Object ... fields) public static void m(ServerCommandSource source, Object ... fields)
{ {
source.sendFeedback(Messenger.c(fields),source.getMinecraftServer().getWorld(DimensionType.OVERWORLD) != null); source.sendFeedback(Messenger.c(fields),source.getMinecraftServer().getWorld(DimensionType.field_24753) != null); //OW
} }
public static void m(PlayerEntity player, Object ... fields) public static void m(PlayerEntity player, Object ... fields)
{ {
player.sendSystemMessage(Messenger.c(fields)); player.sendSystemMessage(Messenger.c(fields), Util.field_25140); //NULL UUID
} }
/* /*
@@ -299,7 +300,7 @@ public class Messenger
public static void send(PlayerEntity player, Collection<BaseText> lines) public static void send(PlayerEntity player, Collection<BaseText> lines)
{ {
lines.forEach(player::sendSystemMessage); lines.forEach(message -> player.sendSystemMessage(message, Util.field_25140));
} }
public static void send(ServerCommandSource source, Collection<BaseText> lines) public static void send(ServerCommandSource source, Collection<BaseText> lines)
{ {
@@ -311,21 +312,21 @@ public class Messenger
{ {
if (server == null) if (server == null)
LOG.error("Message not delivered: "+message); LOG.error("Message not delivered: "+message);
server.sendSystemMessage(new LiteralText(message)); server.sendSystemMessage(new LiteralText(message), Util.field_25140);
BaseText txt = c("gi "+message); BaseText txt = c("gi "+message);
for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList()) for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList())
{ {
entityplayer.sendSystemMessage(txt); entityplayer.sendSystemMessage(txt, Util.field_25140);
} }
} }
public static void print_server_message(MinecraftServer server, BaseText message) public static void print_server_message(MinecraftServer server, BaseText message)
{ {
if (server == null) if (server == null)
LOG.error("Message not delivered: "+message.getString()); LOG.error("Message not delivered: "+message.getString());
server.sendSystemMessage(message); server.sendSystemMessage(message, Util.field_25140);
for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList()) for (PlayerEntity entityplayer : server.getPlayerManager().getPlayerList())
{ {
entityplayer.sendSystemMessage(message); entityplayer.sendSystemMessage(message, Util.field_25140);
} }
} }
} }
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.SpawnRestriction; import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.SpawnReason; import net.minecraft.entity.SpawnReason;
@@ -85,6 +86,8 @@ public class PerimeterDiagnostics
} }
} }
PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el); PerimeterDiagnostics diagnostic = new PerimeterDiagnostics(worldserver,ctype,el);
EntityType type = EntityType.ZOMBIE;
if (el != null) type = el.getType();
for (int x = -128; x <= 128; ++x) for (int x = -128; x <= 128; ++x)
{ {
for (int z = -128; z <= 128; ++z) for (int z = -128; z <= 128; ++z)
@@ -128,7 +131,7 @@ public class PerimeterDiagnostics
{ {
Block block = iblockstate_down.getBlock(); Block block = iblockstate_down.getBlock();
boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER; boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
if( flag && SpawnHelper.isClearForSpawn(worldserver, pos, iblockstate, iblockstate.getFluidState()) && SpawnHelper.isClearForSpawn(worldserver, pos.up(), iblockstate_up, iblockstate_up.getFluidState())) if( flag && SpawnHelper.isClearForSpawn(worldserver, pos, iblockstate, iblockstate.getFluidState(), type) && SpawnHelper.isClearForSpawn(worldserver, pos.up(), iblockstate_up, iblockstate_up.getFluidState(), type))
{ {
result.ground ++; result.ground ++;
if (add_ground && diagnostic.check_entity_spawn(pos)) if (add_ground && diagnostic.check_entity_spawn(pos))
+21 -19
View File
@@ -5,6 +5,7 @@ import carpet.mixins.WeightedPickerEntryMixin;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import net.minecraft.class_5321;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
@@ -28,6 +29,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@@ -37,19 +39,19 @@ public class SpawnReporter
public static boolean mock_spawns = false; public static boolean mock_spawns = false;
public static Long track_spawns = 0L; public static Long track_spawns = 0L;
public static final HashMap<DimensionType, Integer> chunkCounts = new HashMap<>(); public static final HashMap<class_5321<DimensionType>, Integer> chunkCounts = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Object2LongMap<EntityType>> spawn_stats = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Object2LongMap<EntityType>> spawn_stats = new HashMap<>();
public static double mobcap_exponent = 0.0D; public static double mobcap_exponent = 0.0D;
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_attempts = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_attempts = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> overall_spawn_ticks = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> overall_spawn_ticks = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_full = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_full = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_fail = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_fail = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_succ = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_succ = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_ticks_spawns = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_ticks_spawns = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, Long> spawn_cap_count = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, Long> spawn_cap_count = new HashMap<>();
public static final HashMap<Pair<DimensionType, SpawnGroup>, EvictingQueue<Pair<EntityType, BlockPos>>> spawned_mobs = new HashMap<>(); public static final HashMap<Pair<class_5321<DimensionType>, SpawnGroup>, EvictingQueue<Pair<EntityType, BlockPos>>> spawned_mobs = new HashMap<>();
public static final HashMap<SpawnGroup, Integer> spawn_tries = new HashMap<>(); public static final HashMap<SpawnGroup, Integer> spawn_tries = new HashMap<>();
public static BlockPos lower_spawning_limit = null; public static BlockPos lower_spawning_limit = null;
public static BlockPos upper_spawning_limit = null; public static BlockPos upper_spawning_limit = null;
@@ -61,7 +63,7 @@ public class SpawnReporter
reset_spawn_stats(true); reset_spawn_stats(true);
} }
public static void registerSpawn(DimensionType dim, MobEntity mob, SpawnGroup cat, BlockPos pos) public static void registerSpawn(MobEntity mob, SpawnGroup cat, BlockPos pos)
{ {
if (lower_spawning_limit != null) if (lower_spawning_limit != null)
{ {
@@ -73,7 +75,7 @@ public class SpawnReporter
return; return;
} }
} }
Pair<DimensionType, SpawnGroup> key = Pair.of(mob.dimension, cat); Pair<class_5321<DimensionType>, SpawnGroup> key = Pair.of(mob.world.method_27983(), cat);
long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L); long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L);
spawn_stats.get(key).put(mob.getType(), count + 1); spawn_stats.get(key).put(mob.getType(), count + 1);
spawned_mobs.get(key).put(Pair.of(mob.getType(), pos)); spawned_mobs.get(key).put(Pair.of(mob.getType(), pos));
@@ -83,7 +85,7 @@ public class SpawnReporter
public static List<BaseText> printMobcapsForDimension(ServerWorld world, boolean multiline) public static List<BaseText> printMobcapsForDimension(ServerWorld world, boolean multiline)
{ {
DimensionType dim = world.getDimension().getType(); class_5321<DimensionType> dim = world.method_27983();
String name = dim.toString(); String name = dim.toString();
List<BaseText> lst = new ArrayList<>(); List<BaseText> lst = new ArrayList<>();
if (multiline) if (multiline)
@@ -147,7 +149,7 @@ public class SpawnReporter
String type_code = creature_type.getName(); String type_code = creature_type.getName();
lst.add(Messenger.s(String.format("Recent %s spawns:",type_code))); lst.add(Messenger.s(String.format("Recent %s spawns:",type_code)));
for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.getDimension().getType(),creature_type)).keySet()) for (Pair<EntityType, BlockPos> pair : spawned_mobs.get(Pair.of(world.method_27983(), creature_type)).keySet()) // getDImTYpe
{ {
lst.add( Messenger.c( lst.add( Messenger.c(
"w - ", "w - ",
@@ -303,9 +305,9 @@ public class SpawnReporter
{ {
spawn_tries.put(enumcreaturetype, 1); spawn_tries.put(enumcreaturetype, 1);
} }
for (DimensionType dim : DimensionType.getAll()) for (class_5321<DimensionType> dim : Arrays.asList(DimensionType.field_24753, DimensionType.field_24754, DimensionType.field_24755))
{ {
Pair<DimensionType, SpawnGroup> key = Pair.of(dim, enumcreaturetype); Pair<class_5321<DimensionType>, SpawnGroup> key = Pair.of(dim, enumcreaturetype);
overall_spawn_ticks.put(key, 0L); overall_spawn_ticks.put(key, 0L);
spawn_attempts.put(key, 0L); spawn_attempts.put(key, 0L);
spawn_ticks_full.put(key, 0L); spawn_ticks_full.put(key, 0L);
@@ -343,15 +345,15 @@ public class SpawnReporter
{ {
//String type_code = String.format("%s", enumcreaturetype); //String type_code = String.format("%s", enumcreaturetype);
boolean there_are_mobs_to_list = false; boolean there_are_mobs_to_list = false;
for (DimensionType dim: DimensionType.getAll()) //String world_code: new String[] {"", " (N)", " (E)"}) for (class_5321<DimensionType> dim: Arrays.asList(DimensionType.field_24753, DimensionType.field_24754, DimensionType.field_24755)) //String world_code: new String[] {"", " (N)", " (E)"})
{ {
Pair<DimensionType, SpawnGroup> code = Pair.of(dim, enumcreaturetype); Pair<class_5321<DimensionType>, SpawnGroup> code = Pair.of(dim, enumcreaturetype);
if (spawn_ticks_spawns.get(code) > 0L) if (spawn_ticks_spawns.get(code) > 0L)
{ {
there_are_mobs_to_list = true; there_are_mobs_to_list = true;
double hours = overall_spawn_ticks.get(code)/72000.0; double hours = overall_spawn_ticks.get(code)/72000.0;
report.add(Messenger.s(String.format(" > %s (%.1f min), %.1f m/t, {%.1f%%F / %.1f%%- / %.1f%%+}; %.2f s/att", report.add(Messenger.s(String.format(" > %s (%.1f min), %.1f m/t, {%.1f%%F / %.1f%%- / %.1f%%+}; %.2f s/att",
code.getRight()+((code.getLeft()==DimensionType.OVERWORLD)?"":( (code.getLeft()==DimensionType.THE_NETHER)?"(N)":"(E)" )), code.getRight()+((code.getLeft()==DimensionType.field_24753)?"":( (code.getLeft()==DimensionType.field_24754)?"(N)":"(E)" )), // OW, nether
60*hours, 60*hours,
(1.0D*spawn_cap_count.get(code))/ spawn_attempts.get(code), (1.0D*spawn_cap_count.get(code))/ spawn_attempts.get(code),
(100.0D*spawn_ticks_full.get(code))/ spawn_attempts.get(code), (100.0D*spawn_ticks_full.get(code))/ spawn_attempts.get(code),
+2 -2
View File
@@ -64,6 +64,7 @@
"CoralFeatureMixin", "CoralFeatureMixin",
"StructureFeatureMixin", "StructureFeatureMixin",
"World_scarpetPlopMixin", "World_scarpetPlopMixin",
"Biome_scarpetMixin",
"ServerPlayNetworkHandler_scarpetEventsMixin", "ServerPlayNetworkHandler_scarpetEventsMixin",
"ServerPlayerInteractionManager_scarpetEventsMixin", "ServerPlayerInteractionManager_scarpetEventsMixin",
@@ -78,7 +79,7 @@
"DesertPyramidFeatureMixin", "DesertPyramidFeatureMixin",
"HuskEntityMixin", "HuskEntityMixin",
"OverworldChunkGeneratorMixin", "SurfaceChunkGenerator_husksSpawnMixin",
"ServerChunkManagerMixin", "ServerChunkManagerMixin",
"SpawnHelperMixin", "SpawnHelperMixin",
@@ -113,7 +114,6 @@
"ThrownEntityMixin", "ThrownEntityMixin",
"EntityNavigation_pathfindingMixin", "EntityNavigation_pathfindingMixin",
"FloatingIslandsChunkGeneratorMixin",
"EndCityFeatureMixin", "EndCityFeatureMixin",
"InfestedBlockMixin", "InfestedBlockMixin",