This commit is contained in:
gnembon committed 2020-04-08 01:16:47 -03:00
1 parent 76080f1a59
commit c1deda1b64
13 files changed
+28 -29

No files matched your search

@@ -5,7 +5,6 @@ import carpet.fakes.StructureFeatureInterface;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import net.minecraft.block.Blocks;
import net.minecraft.class_5140;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
@@ -21,6 +20,7 @@ import net.minecraft.world.gen.decorator.BeehiveTreeDecorator;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
import java.util.Arrays;
import java.util.Collections;
@@ -43,7 +43,7 @@ public class FeatureGenerator
CarpetSettings.skipGenerationChecks=true;
try
{
return feature.generate(w, w.method_27056(), w.getChunkManager().getChunkGenerator(), w.random, p);
return feature.generate(w, w.getStructureAccessor(), w.getChunkManager().getChunkGenerator(), w.random, p);
}
finally
{
@@ -204,7 +204,7 @@ public class FeatureGenerator
new SimpleBlockStateProvider(Blocks.OAK_LOG.getDefaultState()),
new SimpleBlockStateProvider(Blocks.OAK_LEAVES.getDefaultState()),
new BlobFoliagePlacer(2, 0, 0, 0, 3),
new class_5140(4, 2, 0))
new StraightTrunkPlacer(4, 2, 0))
).noVines().treeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F))).build()
));
put("oak_large", simplePlop(Feature.FANCY_TREE.configure(DefaultBiomeFeatures.FANCY_TREE_CONFIG)));
@@ -213,7 +213,7 @@ public class FeatureGenerator
new SimpleBlockStateProvider(Blocks.OAK_LOG.getDefaultState()),
new SimpleBlockStateProvider(Blocks.OAK_LEAVES.getDefaultState()),
new BlobFoliagePlacer(0, 0, 0, 0, 0),
new class_5140(0, 0, 0))
new StraightTrunkPlacer(0, 0, 0))
).treeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F))).build()
)));
put("birch", simpleTree(DefaultBiomeFeatures.BIRCH_TREE_CONFIG));
@@ -42,7 +42,7 @@ public abstract class CommandManagerMixin
CarpetSettings.impendingFillSkipUpdates = false;
}
// warning expected
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "execute", at = @At(
value = "INVOKE",
target = "Lorg/apache/logging/log4j/Logger;isDebugEnabled()Z"
@@ -2,12 +2,12 @@ package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.Blocks;
import net.minecraft.class_5138;
import net.minecraft.entity.EntityCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
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.FlatChunkGenerator;
import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig;
@@ -25,7 +25,7 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator<FlatChunkGe
}
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(class_5138 arg, EntityCategory category, BlockPos pos)
public List<Biome.SpawnEntry> getEntitySpawnList(StructureAccessor arg, EntityCategory category, BlockPos pos)
{
if (CarpetSettings.flatWorldStructureSpawning)
{
@@ -1,12 +1,12 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_5138;
import net.minecraft.entity.EntityCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
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.FloatingIslandsChunkGenerator;
import net.minecraft.world.gen.chunk.FloatingIslandsChunkGeneratorConfig;
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
@@ -24,7 +24,7 @@ public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGen
}
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(class_5138 arg, EntityCategory category, BlockPos pos)
public List<Biome.SpawnEntry> getEntitySpawnList(StructureAccessor arg, EntityCategory category, BlockPos pos)
{
if (CarpetSettings.shulkerSpawningInEndCities && EntityCategory.MONSTER == category)
{
@@ -17,6 +17,6 @@ public class HuskEntityMixin
private static boolean isSkylightOrTempleVisible(IWorld iWorld, BlockPos blockPos_1)
{
return iWorld.isSkyVisible(blockPos_1) ||
(CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, ((ServerWorld)iWorld).method_27056(), blockPos_1));
(CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, ((ServerWorld)iWorld).getStructureAccessor(), blockPos_1));
}
}
@@ -1,12 +1,12 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.class_5138;
import net.minecraft.entity.EntityCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
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.OverworldChunkGenerator;
import net.minecraft.world.gen.chunk.OverworldChunkGeneratorConfig;
import net.minecraft.world.gen.chunk.SurfaceChunkGenerator;
@@ -27,9 +27,9 @@ public abstract class OverworldChunkGeneratorMixin extends SurfaceChunkGenerator
}
@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/class_5138;Lnet/minecraft/util/math/BlockPos;)Z"),
target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/util/math/BlockPos;)Z"),
cancellable = true)
private void onGetEntitySpawnList(class_5138 arg, EntityCategory entityCategory, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
private void onGetEntitySpawnList(StructureAccessor arg, EntityCategory entityCategory, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> cir)
{
if (CarpetSettings.huskSpawningInTemples)
{
@@ -20,7 +20,7 @@ public abstract class ServerPlayNetworkHandler_antiCheatDisabledMixin
@Shadow private int vehicleFloatingTicks;
@Shadow protected abstract boolean isServerOwner();
@Shadow protected abstract boolean isHost();
@Inject(method = "tick", at = @At("HEAD"))
private void restrictFloatingBits(CallbackInfo ci)
@@ -35,11 +35,11 @@ public abstract class ServerPlayNetworkHandler_antiCheatDisabledMixin
@Redirect(method = "onVehicleMove", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;isServerOwner()Z"
target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;isHost()Z"
))
private boolean isServerTrusting(ServerPlayNetworkHandler serverPlayNetworkHandler)
{
return isServerOwner() || CarpetSettings.antiCheatDisabled;
return isHost() || CarpetSettings.antiCheatDisabled;
}
@Redirect(method = "onPlayerMove", at = @At(
@@ -14,18 +14,17 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ServerWorld.class)
public abstract class ServerWorld_fakePlayersMixin
{
@Shadow
boolean ticking;
@Shadow /*@Nonnull*/ public abstract MinecraftServer getServer();
@Shadow private boolean inEntityTick;
@Redirect( method = "removePlayer", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;removeEntity(Lnet/minecraft/entity/Entity;)V"
))
private void crashRemovePlayer(ServerWorld serverWorld, Entity entity_1, ServerPlayerEntity serverPlayerEntity_1)
{
if ( !(ticking && serverPlayerEntity_1 instanceof EntityPlayerMPFake) )
if ( !(inEntityTick && serverPlayerEntity_1 instanceof EntityPlayerMPFake) )
serverWorld.removeEntity(entity_1);
else
getServer().send(new ServerTask(getServer().getTicks(), () ->
@@ -68,7 +68,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
BlockBox box = structurestart.getBoundingBox();
if (!wireOnly)
{
structurestart.generateStructure(world, world.method_27056(), generator, rand,
structurestart.generateStructure(world, world.getStructureAccessor(), generator, rand,
new BlockBox(
pos.getX() - this.getRadius() * 16,
pos.getZ() - this.getRadius() * 16,
@@ -305,7 +305,7 @@ public class EntityValue extends Value
ServerPlayerEntity spe = (ServerPlayerEntity) e;
for (int i=4; i>=0; i--)
{
if (spe.allowsPermissionLevel(i))
if (spe.hasPermissionLevel(i))
return new NumericValue(i);
}
@@ -323,7 +323,7 @@ public class EntityValue extends Value
if (server.isDedicated()) return new StringValue("multiplayer");
boolean runningLan = server.isRemote();
if (!runningLan) return new StringValue("singleplayer");
boolean isowner = server.isOwner(p.getGameProfile());
boolean isowner = server.isHost(p.getGameProfile());
if (isowner) return new StringValue("lan_host");
return new StringValue("lan player");
// realms?
@@ -155,10 +155,10 @@ public class PerimeterDiagnostics
private boolean check_entity_spawn(BlockPos pos)
{
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos).contains(sle))
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle))
{
sle = null;
for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos))
for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos))
{
if (el.getType() == sle.type)
{
@@ -166,7 +166,7 @@ public class PerimeterDiagnostics
break;
}
}
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos).contains(sle))
if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.getStructureAccessor(), ctype, pos).contains(sle))
{
return false;
}
@@ -401,7 +401,7 @@ public class SpawnReporter
for (EntityCategory enumcreaturetype : EntityCategory.values())
{
String type_code = String.format("%s", enumcreaturetype).substring(0, 3);
List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.method_27056(), enumcreaturetype, pos);
List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.getStructureAccessor(), enumcreaturetype, pos);
if (lst != null && !lst.isEmpty())
{
for (Biome.SpawnEntry spawnEntry : lst)