This commit is contained in:
gnembon committed 2020-05-13 16:58:12 -03:00
1 parent 903fe1e31a
commit dfd88b7142
23 files changed
+85 -99

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=20w19a minecraft_version=20w20a
yarn_mappings=20w19a+build.15 yarn_mappings=20w20a+build.1
loader_version=0.8.2+build.194 loader_version=0.8.2+build.194
# Mod Properties # Mod Properties
@@ -236,7 +236,7 @@ public class PlayerCommand
); );
DimensionType dim = tryGetArg( DimensionType dim = tryGetArg(
() -> DimensionArgumentType.getDimensionArgument(context, "dimension"), () -> DimensionArgumentType.getDimensionArgument(context, "dimension"),
() -> source.getWorld().dimension.getType() () -> source.getWorld().method_27983() // dimension.getType()
); );
GameMode mode = GameMode.CREATIVE; GameMode mode = GameMode.CREATIVE;
try try
@@ -9,5 +9,5 @@ public interface StructureFeatureInterface
{ {
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<? extends ChunkGeneratorConfig> generator, boolean wireOnly); boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly);
} }
@@ -18,8 +18,9 @@ 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.VanillaLayeredBiomeSource; import net.minecraft.world.biome.source.FixedBiomeSource;
import net.minecraft.world.biome.source.VanillaLayeredBiomeSourceConfig; //import net.minecraft.world.biome.source.VanillaLayeredBiomeSource;
//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;
@@ -106,7 +107,7 @@ public class FeatureGenerator
//if (1+2==3) //if (1+2==3)
// throw new RuntimeException("rebuild me"); // throw new RuntimeException("rebuild me");
return (w, p) -> { return (w, p) -> {
ChunkGenerator chunkgen = new OverworldChunkGenerator(w, w.getChunkManager().getChunkGenerator().getBiomeSource(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings()) ChunkGenerator chunkgen = new OverworldChunkGenerator(w.getChunkManager().getChunkGenerator().getBiomeSource(), w.getSeed(), new OverworldChunkGeneratorConfig()) // BiomeSourceType.VANILLA_LAYERED.applyConfig((BiomeSourceType.VANILLA_LAYERED.getConfig())), ChunkGeneratorType.SURFACE.createSettings())
{ {
@Override @Override
public <C extends FeatureConfig> C getStructureConfig(Biome biome_1, StructureFeature<C> structureFeature_1) public <C extends FeatureConfig> C getStructureConfig(Biome biome_1, StructureFeature<C> structureFeature_1)
@@ -117,7 +118,8 @@ public class FeatureGenerator
@Override @Override
public BiomeSource getBiomeSource() public BiomeSource getBiomeSource()
{ {
return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties().getSeed())) return new FixedBiomeSource(biome);
/*return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties().getSeed()))
{ {
@Override @Override
public Biome getBiomeForNoiseGen(int i, int j, int k) public Biome getBiomeForNoiseGen(int i, int j, int k)
@@ -130,7 +132,7 @@ public class FeatureGenerator
{ {
return Sets.newHashSet(biome); return Sets.newHashSet(biome);
} }
}; };*/
} }
}; };
@@ -156,18 +158,19 @@ public class FeatureGenerator
public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<?> structure, boolean computeBox) public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<?> structure, boolean computeBox)
{ {
ChunkGenerator<?> generator = world.getChunkManager().getChunkGenerator(); long seed = world.getSeed();
ChunkGenerator generator = world.getChunkManager().getChunkGenerator();
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, chunkRandom, chunkPos.x, chunkPos.z, biome)) // should start at if (structure.method_27217(biomeAccess, generator, seed, chunkRandom, chunkPos.x, chunkPos.z, biome)) // 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, generator.getSeed()); StructureStart structureStart3 = structure.getStructureStartFactory().create(structure, 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);
if (!structureStart3.hasChildren()) return null; if (!structureStart3.hasChildren()) return null;
return structureStart3; return structureStart3;
@@ -9,6 +9,7 @@ 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.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;
@@ -17,19 +18,19 @@ import org.spongepowered.asm.mixin.Mixin;
import java.util.List; import java.util.List;
@Mixin(FlatChunkGenerator.class) @Mixin(FlatChunkGenerator.class)
public abstract class FlatChunkGeneratorMixin extends ChunkGenerator<FlatChunkGeneratorConfig> public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
{ {
public FlatChunkGeneratorMixin(IWorld iWorld, BiomeSource biome, FlatChunkGeneratorConfig chunkGeneratorConfig) public FlatChunkGeneratorMixin(BiomeSource biomeSource, ChunkGeneratorConfig chunkGeneratorConfig)
{ {
super(iWorld, biome, chunkGeneratorConfig); super(biomeSource, chunkGeneratorConfig);
} }
@Override @Override
public List<Biome.SpawnEntry> getEntitySpawnList(StructureAccessor arg, SpawnGroup category, BlockPos pos) public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos blockPos)
{ {
if (CarpetSettings.flatWorldStructureSpawning) if (CarpetSettings.flatWorldStructureSpawning)
{ {
if (Feature.SWAMP_HUT.method_14029(this.world, arg, pos)) if (Feature.SWAMP_HUT.isApproximatelyInsideStructure(structureAccessor, blockPos))
{ {
if (category == SpawnGroup.MONSTER) if (category == SpawnGroup.MONSTER)
{ {
@@ -43,37 +44,32 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator<FlatChunkGe
} }
else if (category == SpawnGroup.MONSTER) else if (category == SpawnGroup.MONSTER)
{ {
if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(this.world, arg, pos)) if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(structureAccessor, blockPos))
{ {
return Feature.PILLAGER_OUTPOST.getMonsterSpawns(); return Feature.PILLAGER_OUTPOST.getMonsterSpawns();
} }
if (CarpetSettings.huskSpawningInTemples) if (CarpetSettings.huskSpawningInTemples)
{ {
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, arg, pos)) if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(structureAccessor, blockPos))
{ {
return Feature.DESERT_PYRAMID.getMonsterSpawns(); return Feature.DESERT_PYRAMID.getMonsterSpawns();
} }
} }
if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(this.world, arg, pos)) if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(structureAccessor, blockPos))
{ {
return Feature.OCEAN_MONUMENT.getMonsterSpawns(); return Feature.OCEAN_MONUMENT.getMonsterSpawns();
} }
if (Feature.NETHER_BRIDGE.isInsideStructure(this.world, arg, pos)) if (Feature.NETHER_BRIDGE.isInsideStructure(structureAccessor, blockPos))
{
return Feature.NETHER_BRIDGE.getMonsterSpawns();
}
if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(this.world, arg, pos) && this.world.getBlockState(pos.down(1)).getBlock() == Blocks.NETHER_BRICKS)
{ {
return Feature.NETHER_BRIDGE.getMonsterSpawns(); return Feature.NETHER_BRIDGE.getMonsterSpawns();
} }
if (CarpetSettings.shulkerSpawningInEndCities) if (CarpetSettings.shulkerSpawningInEndCities)
{ {
if (Feature.END_CITY.isInsideStructure(this.world, arg, pos)) if (Feature.END_CITY.isInsideStructure(structureAccessor, blockPos))
{ {
return Feature.END_CITY.getMonsterSpawns(); return Feature.END_CITY.getMonsterSpawns();
} }
@@ -81,6 +77,6 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator<FlatChunkGe
} }
} }
return super.getEntitySpawnList(arg, category, pos); return super.getEntitySpawnList(biome, structureAccessor, category, blockPos);
} }
} }
@@ -1,14 +1,13 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
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.IWorld;
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.FloatingIslandsChunkGeneratorConfig;
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;
@@ -16,23 +15,23 @@ import org.spongepowered.asm.mixin.Mixin;
import java.util.List; import java.util.List;
@Mixin(FloatingIslandsChunkGenerator.class) @Mixin(FloatingIslandsChunkGenerator.class)
public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGenerator<FloatingIslandsChunkGeneratorConfig> public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGenerator<class_5284> //FloatingIslandsChunkGeneratorConfig
{ {
public FloatingIslandsChunkGeneratorMixin(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, FloatingIslandsChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1) public FloatingIslandsChunkGeneratorMixin(BiomeSource biomeSource, long l, class_5284 arg, int i, int j, int k, boolean bl)
{ {
super(iWorld_1, biomeSource_1, int_1, int_2, int_3, chunkGeneratorConfig_1, boolean_1); super(biomeSource, l, arg, i, j, k, bl);
} }
@Override @Override
public List<Biome.SpawnEntry> getEntitySpawnList(StructureAccessor arg, SpawnGroup category, BlockPos pos) public List<Biome.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup category, BlockPos pos)
{ {
if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == category) if (CarpetSettings.shulkerSpawningInEndCities && SpawnGroup.MONSTER == category)
{ {
if (Feature.END_CITY.isInsideStructure(this.world, arg, pos)) if (Feature.END_CITY.isInsideStructure(structureAccessor, pos))
{ {
return Feature.END_CITY.getMonsterSpawns(); return Feature.END_CITY.getMonsterSpawns();
} }
} }
return this.world.getBiome(pos).getEntitySpawnList(category); return super.getEntitySpawnList(biome, structureAccessor, category, pos);
} }
} }
@@ -17,6 +17,6 @@ public class HuskEntityMixin
private static boolean isSkylightOrTempleVisible(IWorld iWorld, BlockPos blockPos_1) private static boolean isSkylightOrTempleVisible(IWorld iWorld, BlockPos blockPos_1)
{ {
return iWorld.isSkyVisible(blockPos_1) || return iWorld.isSkyVisible(blockPos_1) ||
(CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, ((ServerWorld)iWorld).getStructureAccessor(), blockPos_1)); (CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(((ServerWorld)iWorld).getStructureAccessor(), blockPos_1));
} }
} }
@@ -2,11 +2,9 @@ package carpet.mixins;
import carpet.CarpetServer; import carpet.CarpetServer;
import net.minecraft.server.integrated.IntegratedServer; import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.world.level.LevelGeneratorOptions;
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(IntegratedServer.class) @Mixin(IntegratedServer.class)
@@ -2,10 +2,8 @@ package carpet.mixins;
import carpet.CarpetServer; import carpet.CarpetServer;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import com.google.gson.JsonElement;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.WorldGenerationProgressListener; import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.world.level.LevelGeneratorOptions;
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;
@@ -21,19 +21,19 @@ 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(IWorld iWorld_1, BiomeSource biomeSource_1, int int_1, int int_2, int int_3, OverworldChunkGeneratorConfig chunkGeneratorConfig_1, boolean boolean_1) public OverworldChunkGeneratorMixin(BiomeSource biomeSource, long seed, OverworldChunkGeneratorConfig arg, int i, int j, int k, boolean bl)
{ {
super(iWorld_1, biomeSource_1, int_1, int_2, int_3, chunkGeneratorConfig_1, boolean_1); super(biomeSource, seed, arg, i, j, k, bl);
} }
@Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE, @Inject(method = "getEntitySpawnList", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.BEFORE,
target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"), target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"),
cancellable = true) cancellable = true)
private void onGetEntitySpawnList(StructureAccessor arg, SpawnGroup entityCategory, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir) private void onGetEntitySpawnList(Biome biome, StructureAccessor structureAccessor, SpawnGroup spawnGroup, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{ {
if (CarpetSettings.huskSpawningInTemples) if (CarpetSettings.huskSpawningInTemples)
{ {
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, arg, blockPos)) if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(structureAccessor, blockPos))
{ {
cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns()); cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns());
} }
@@ -47,7 +47,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.dimension.getType(); 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,8 +77,8 @@ public abstract class ServerChunkManagerMixin implements ServerChunkManagerInter
{ {
for (SpawnGroup cat: SpawnGroup.values()) for (SpawnGroup cat: SpawnGroup.values())
{ {
DimensionType dim = world.dimension.getType(); DimensionType dim = world.method_27983(); // getDimensionType;
Pair key = Pair.of(world.dimension.getType(), 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))
{ {
@@ -2,11 +2,8 @@ package carpet.mixins;
import carpet.helpers.TickSpeed; import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler; import carpet.utils.CarpetProfiler;
import net.minecraft.class_5217;
import net.minecraft.server.world.ServerChunkManager; import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.level.LevelGeneratorType;
import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -95,12 +92,13 @@ public abstract class ServerChunkManager_tickMixin
@Redirect(method = "tickChunks", at = @At( @Redirect(method = "tickChunks", at = @At(
value = "INVOKE", value = "INVOKE",
//target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" //target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" //target = "Lnet/minecraft/class_5217;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
target = "Lnet/minecraft/server/world/ServerWorld;method_27982()Z" // idDebug
)) ))
private LevelGeneratorType skipChunkTicking(class_5217 levelProperties) private boolean skipChunkTicking(ServerWorld serverWorld)
{ {
if (!TickSpeed.process_entities) return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES; if (!TickSpeed.process_entities) return true;
return levelProperties.getGeneratorType(); return serverWorld.method_27982(); //isDebug
} }
} }
@@ -15,7 +15,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
{ {
@Inject(method = "onPlayerInteractBlock", at = @At( @Inject(method = "onPlayerInteractBlock", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;",
shift = At.Shift.BEFORE shift = At.Shift.BEFORE
)) ))
private void beforeBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) private void beforeBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci)
@@ -26,7 +26,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
@Inject(method = "onPlayerInteractBlock", at = @At( @Inject(method = "onPlayerInteractBlock", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;", target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;",
shift = At.Shift.AFTER shift = At.Shift.AFTER
)) ))
private void afterBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) private void afterBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci)
@@ -37,7 +37,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
@Inject(method = "onPlayerInteractItem", at = @At( @Inject(method = "onPlayerInteractItem", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;",
shift = At.Shift.BEFORE shift = At.Shift.BEFORE
)) ))
private void beforeItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci) private void beforeItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci)
@@ -48,7 +48,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
@Inject(method = "onPlayerInteractItem", at = @At( @Inject(method = "onPlayerInteractItem", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;", target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactItem(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;",
shift = At.Shift.AFTER shift = At.Shift.AFTER
)) ))
private void afterItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci) private void afterItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci)
@@ -115,7 +115,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
@Inject(method = "onPlayerInteractBlock", at = @At( @Inject(method = "onPlayerInteractBlock", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;" target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;interactBlock(Lnet/minecraft/server/network/ServerPlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;"
)) ))
private void onBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci) private void onBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci)
{ {
@@ -42,8 +42,8 @@ public class ServerPlayerInteractionManager_scarpetEventsMixin
value = "RETURN", value = "RETURN",
ordinal = 2 ordinal = 2
)) ))
private void onBlockActivated(PlayerEntity playerArg, World world, ItemStack stack, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable<ActionResult> cir) private void onBlockActivated(ServerPlayerEntity serverPlayerEntity, World world, ItemStack stack, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir)
{ {
PLAYER_INTERACTS_WITH_BLOCK.onBlockHit(player, hand, blockHitResult); PLAYER_INTERACTS_WITH_BLOCK.onBlockHit(player, hand, hitResult);
} }
} }
@@ -2,20 +2,14 @@ package carpet.mixins;
import carpet.helpers.TickSpeed; import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler; import carpet.utils.CarpetProfiler;
import net.minecraft.class_5217;
import net.minecraft.class_5269; import net.minecraft.class_5269;
import net.minecraft.entity.raid.RaidManager; import net.minecraft.entity.raid.RaidManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.profiler.Profiler; import net.minecraft.util.profiler.Profiler;
import net.minecraft.village.ZombieSiegeManager;
import net.minecraft.world.WanderingTraderManager; import net.minecraft.world.WanderingTraderManager;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.border.WorldBorder; import net.minecraft.world.border.WorldBorder;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.level.LevelGeneratorType;
import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@@ -33,9 +27,9 @@ 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();
protected ServerWorld_tickMixin(LevelProperties levelProperties, DimensionType dimensionType, BiFunction<World, Dimension, ChunkManager> chunkManagerProvider, Supplier<Profiler> supplier, boolean isClient) protected ServerWorld_tickMixin(class_5269 arg, DimensionType dimensionType, Supplier<Profiler> supplier, boolean bl, boolean bl2, long l)
{ {
super(levelProperties, dimensionType, chunkManagerProvider, supplier, isClient); super(arg, dimensionType, supplier, bl, bl2, l);
} }
private CarpetProfiler.ProfilerToken currentSection; private CarpetProfiler.ProfilerToken currentSection;
@@ -135,9 +129,9 @@ public abstract class ServerWorld_tickMixin extends World
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/dimension/Dimension;hasSkyLight()Z" target = "Lnet/minecraft/world/dimension/DimensionType;hasSkyLight()Z"
)) ))
private boolean tickWorldBorder(Dimension dimension) private boolean tickWorldBorder(DimensionType dimension)
{ {
return TickSpeed.process_entities && dimension.hasSkyLight(); return TickSpeed.process_entities && dimension.hasSkyLight();
} }
@@ -153,13 +147,13 @@ public abstract class ServerWorld_tickMixin extends World
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/class_5269;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" target = "Lnet/minecraft/server/world/ServerWorld;method_27982()Z" // isDebug
//target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;" //target = "Lnet/minecraft/world/level/LevelProperties;getGeneratorType()Lnet/minecraft/world/level/LevelGeneratorType;"
)) ))
private LevelGeneratorType tickPendingBlocks(class_5269 levelProperties) private boolean tickPendingBlocks(ServerWorld serverWorld)
{ {
if (TickSpeed.process_entities) return levelProperties.getGeneratorType(); if (TickSpeed.process_entities) return true;
return LevelGeneratorType.DEBUG_ALL_BLOCK_STATES; return serverWorld.method_27982(); // isDebug()
} }
@Redirect(method = "tick", at = @At( @Redirect(method = "tick", at = @At(
@@ -162,7 +162,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.dimension.getType(), 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 +280,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.dimension.getType(); 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
@@ -45,7 +45,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
} }
@Override @Override
public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator<? extends ChunkGeneratorConfig> generator, boolean wireOnly) public boolean plopAnywhere(ServerWorld world, BlockPos pos, ChunkGenerator generator, boolean wireOnly)
{ {
if (world.isClient()) if (world.isClient())
return false; return false;
@@ -108,7 +108,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return true; return true;
} }
private StructureStart forceStructureStart(IWorld worldIn, ChunkGenerator <? extends ChunkGeneratorConfig > generator, Random rand, long packedChunkPos) private StructureStart forceStructureStart(ServerWorld worldIn, ChunkGenerator generator, Random rand, long packedChunkPos)
{ {
ChunkPos chunkpos = new ChunkPos(packedChunkPos); ChunkPos chunkpos = new ChunkPos(packedChunkPos);
StructureStart structurestart; StructureStart structurestart;
@@ -125,8 +125,8 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
} }
} }
Biome biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 ); Biome 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,generator.getSeed()); StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed());
structurestart1.init(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1); structurestart1.init(generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT; structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
if (structurestart.hasChildren()) if (structurestart.hasChildren())
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
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;
@@ -12,12 +13,12 @@ public class WorldRenderer_fogOffMixin
{ {
@Redirect(method = "render", require = 0, expect = 0, at = @At( @Redirect(method = "render", require = 0, expect = 0, at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/dimension/Dimension;isFogThick(II)Z" target = "Lnet/minecraft/class_5294;method_28110(II)Z" //method_28110 isFogThick
)) ))
private boolean isReallyThick(Dimension dimension, int x, int z) private boolean isReallyThick(class_5294 class_5294, int x, int z)
{ {
if (CarpetSettings.fogOff) return false; if (CarpetSettings.fogOff) return false;
return dimension.isFogThick(x, z); return class_5294.method_28110(x, z); //isFogThick
} }
} }
@@ -6,24 +6,21 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.class_5217;
import net.minecraft.class_5269; import net.minecraft.class_5269;
import net.minecraft.server.world.ChunkHolder; import net.minecraft.server.world.ChunkHolder;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler; import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.EmptyChunk;
import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.level.LevelGeneratorType;
import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@Mixin(World.class) @Mixin(World.class)
public abstract class World_movableTEMixin implements WorldInterface public abstract class World_movableTEMixin implements WorldInterface, IWorld
{ {
@Shadow @Shadow
@Final @Final
@@ -38,8 +35,8 @@ public abstract class World_movableTEMixin implements WorldInterface
@Shadow @Shadow
public abstract BlockState getBlockState(BlockPos blockPos_1); public abstract BlockState getBlockState(BlockPos blockPos_1);
@Shadow //@Shadow
public abstract ChunkManager getChunkManager(); //public abstract ChunkManager getChunkManager();
@Shadow @Shadow
public abstract void checkBlockRerender(BlockPos blockPos_1, BlockState s1, BlockState s2); public abstract void checkBlockRerender(BlockPos blockPos_1, BlockState s1, BlockState s2);
@@ -59,6 +56,8 @@ public abstract class World_movableTEMixin implements WorldInterface
@Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state, int flags); @Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state, int flags);
@Shadow public abstract boolean method_27982(); //isDebug()
/** /**
* @author 2No2Name * @author 2No2Name
*/ */
@@ -71,7 +70,7 @@ public abstract class World_movableTEMixin implements WorldInterface
{ {
return false; return false;
} }
else if (!this.isClient && this.properties.getGeneratorType() == LevelGeneratorType.DEBUG_ALL_BLOCK_STATES) else if (!this.isClient && method_27982())
{ {
return false; return false;
} }
@@ -2921,7 +2921,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().dimension.getType()))); Value retval = new StringValue(NBTSerializableValue.nameFromRegistryId(Registry.DIMENSION_TYPE.getId(s.getWorld().method_27983()))); // getDImensionType
return (cc, tt) -> retval; return (cc, tt) -> retval;
}); });
@@ -155,10 +155,10 @@ public class PerimeterDiagnostics
private boolean check_entity_spawn(BlockPos pos) private boolean check_entity_spawn(BlockPos pos)
{ {
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle)) if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle))
{ {
sle = null; sle = null;
for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos)) for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos))
{ {
if (el.getType() == sle.type) if (el.getType() == sle.type)
{ {
@@ -166,7 +166,7 @@ public class PerimeterDiagnostics
break; break;
} }
} }
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle)) if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getBiome(pos), worldServer.getStructureAccessor(), ctype, pos).contains(sle))
{ {
return false; return false;
} }
@@ -410,7 +410,7 @@ public class SpawnReporter
for (SpawnGroup enumcreaturetype : SpawnGroup.values()) for (SpawnGroup enumcreaturetype : SpawnGroup.values())
{ {
String type_code = String.format("%s", enumcreaturetype).substring(0, 3); String type_code = String.format("%s", enumcreaturetype).substring(0, 3);
List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.getStructureAccessor(), enumcreaturetype, pos); List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.getBiome(pos), worldIn.getStructureAccessor(), enumcreaturetype, pos);
if (lst != null && !lst.isEmpty()) if (lst != null && !lst.isEmpty())
{ {
for (Biome.SpawnEntry spawnEntry : lst) for (Biome.SpawnEntry spawnEntry : lst)