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

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