From 76080f1a5994fbe689386cc43c5135807345d385 Mon Sep 17 00:00:00 2001 From: gnembon Date: Thu, 2 Apr 2020 23:38:19 -0300 Subject: [PATCH] 20w14a --- gradle.properties | 6 +++--- .../java/carpet/fakes/DummyEnchantments.java | 2 +- .../java/carpet/helpers/FeatureGenerator.java | 14 ++++++++------ .../mixins/FlatChunkGeneratorMixin.java | 19 ++++++++++--------- .../FloatingIslandsChunkGeneratorMixin.java | 9 +++++---- .../java/carpet/mixins/HuskEntityMixin.java | 3 ++- .../carpet/mixins/IntegratedServerMixin.java | 2 +- .../mixins/MinecraftDedicatedServerMixin.java | 2 +- .../mixins/MinecraftServer_coreMixin.java | 2 +- .../mixins/OverworldChunkGeneratorMixin.java | 8 ++++---- .../PistonBlockEntity_movableTEMixin.java | 2 +- .../java/carpet/mixins/SaplingBlockMixin.java | 2 +- .../carpet/mixins/StructureFeatureMixin.java | 2 +- .../carpet/script/CarpetScriptServer.java | 6 ++---- .../java/carpet/script/bundled/Module.java | 6 ++---- .../java/carpet/script/utils/WorldTools.java | 2 +- .../java/carpet/settings/SettingsManager.java | 2 +- .../carpet/utils/PerimeterDiagnostics.java | 6 +++--- src/main/java/carpet/utils/SpawnReporter.java | 2 +- 19 files changed, 49 insertions(+), 48 deletions(-) diff --git a/gradle.properties b/gradle.properties index 02014a82..dbfefba2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=20w13b - yarn_mappings=20w13b+build.11 - loader_version=0.7.8+build.189 + minecraft_version=20w14a + yarn_mappings=20w14a+build.2 + loader_version=0.7.9+build.190 # Mod Properties mod_version = 1.3.17+v200401 diff --git a/src/main/java/carpet/fakes/DummyEnchantments.java b/src/main/java/carpet/fakes/DummyEnchantments.java index 4f1d0dbc..985d8429 100644 --- a/src/main/java/carpet/fakes/DummyEnchantments.java +++ b/src/main/java/carpet/fakes/DummyEnchantments.java @@ -10,7 +10,7 @@ public abstract class DummyEnchantments { protected Dummies() { - super(Rarity.COMMON, EnchantmentTarget.ALL, new EquipmentSlot[]{EquipmentSlot.MAINHAND}); + super(Rarity.COMMON, EnchantmentTarget.BREAKABLE, new EquipmentSlot[]{EquipmentSlot.MAINHAND}); } } diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index cfce478b..9c592e9f 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -5,6 +5,7 @@ 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; @@ -42,7 +43,7 @@ public class FeatureGenerator CarpetSettings.skipGenerationChecks=true; try { - return feature.generate(w, w.getChunkManager().getChunkGenerator(), w.random, p); + return feature.generate(w, w.method_27056(), w.getChunkManager().getChunkGenerator(), w.random, p); } finally { @@ -202,16 +203,17 @@ public class FeatureGenerator (new BranchedTreeFeatureConfig.Builder( new SimpleBlockStateProvider(Blocks.OAK_LOG.getDefaultState()), new SimpleBlockStateProvider(Blocks.OAK_LEAVES.getDefaultState()), - new BlobFoliagePlacer(2, 0)) - ).baseHeight(4).heightRandA(2).foliageHeight(3).noVines() - .treeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F))).build() + new BlobFoliagePlacer(2, 0, 0, 0, 3), + new class_5140(4, 2, 0)) + ).noVines().treeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F))).build() )); put("oak_large", simplePlop(Feature.FANCY_TREE.configure(DefaultBiomeFeatures.FANCY_TREE_CONFIG))); put("oak_large_beehive", simplePlop(Feature.FANCY_TREE.configure( (new BranchedTreeFeatureConfig.Builder( new SimpleBlockStateProvider(Blocks.OAK_LOG.getDefaultState()), new SimpleBlockStateProvider(Blocks.OAK_LEAVES.getDefaultState()), - new BlobFoliagePlacer(0, 0)) + new BlobFoliagePlacer(0, 0, 0, 0, 0), + new class_5140(0, 0, 0)) ).treeDecorators(ImmutableList.of(new BeehiveTreeDecorator(1.0F))).build() ))); put("birch", simpleTree(DefaultBiomeFeatures.BIRCH_TREE_CONFIG)); @@ -224,7 +226,7 @@ public class FeatureGenerator put("pine", simpleTree(DefaultBiomeFeatures.PINE_TREE_CONFIG)); put("pine_large", simplePlop(Feature.MEGA_SPRUCE_TREE.configure(DefaultBiomeFeatures.MEGA_PINE_TREE_CONFIG))); put("dark_oak", simplePlop(Feature.DARK_OAK_TREE.configure(DefaultBiomeFeatures.DARK_OAK_TREE_CONFIG))); - put("acacia", simplePlop(Feature.ACACIA_TREE.configure(DefaultBiomeFeatures.ACACIA_TREE_CONFIG))); + put("acacia", simplePlop(Feature.NORMAL_TREE.configure(DefaultBiomeFeatures.ACACIA_TREE_CONFIG))); put("oak_swamp", simpleTree(DefaultBiomeFeatures.SWAMP_TREE_CONFIG)); put("well", simplePlop(Feature.DESERT_WELL)); put("grass", simplePatch(DefaultBiomeFeatures.GRASS_CONFIG)); diff --git a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java index 672c2a51..9718ec33 100644 --- a/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/FlatChunkGeneratorMixin.java @@ -2,6 +2,7 @@ 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; @@ -24,11 +25,11 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator getEntitySpawnList(EntityCategory category, BlockPos pos) + public List getEntitySpawnList(class_5138 arg, EntityCategory category, BlockPos pos) { if (CarpetSettings.flatWorldStructureSpawning) { - if (Feature.SWAMP_HUT.method_14029(this.world, pos)) + if (Feature.SWAMP_HUT.method_14029(this.world, arg, pos)) { if (category == EntityCategory.MONSTER) { @@ -42,37 +43,37 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator getEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1) + public List getEntitySpawnList(class_5138 arg, EntityCategory category, BlockPos pos) { - if (CarpetSettings.shulkerSpawningInEndCities && EntityCategory.MONSTER == entityCategory_1) + if (CarpetSettings.shulkerSpawningInEndCities && EntityCategory.MONSTER == category) { - if (Feature.END_CITY.isInsideStructure(this.world, blockPos_1)) + if (Feature.END_CITY.isInsideStructure(this.world, arg, pos)) { return Feature.END_CITY.getMonsterSpawns(); } } - return this.world.getBiome(blockPos_1).getEntitySpawnList(entityCategory_1); + return this.world.getBiome(pos).getEntitySpawnList(category); } } diff --git a/src/main/java/carpet/mixins/HuskEntityMixin.java b/src/main/java/carpet/mixins/HuskEntityMixin.java index 1d82fc0b..cbbd2be7 100644 --- a/src/main/java/carpet/mixins/HuskEntityMixin.java +++ b/src/main/java/carpet/mixins/HuskEntityMixin.java @@ -2,6 +2,7 @@ package carpet.mixins; import carpet.CarpetSettings; import net.minecraft.entity.mob.HuskEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.gen.feature.Feature; @@ -16,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, blockPos_1)); + (CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, ((ServerWorld)iWorld).method_27056(), blockPos_1)); } } diff --git a/src/main/java/carpet/mixins/IntegratedServerMixin.java b/src/main/java/carpet/mixins/IntegratedServerMixin.java index bbec23ac..ec073732 100644 --- a/src/main/java/carpet/mixins/IntegratedServerMixin.java +++ b/src/main/java/carpet/mixins/IntegratedServerMixin.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class IntegratedServerMixin { @Inject(method = "loadWorld", at = @At("HEAD")) - private void onSetupServerIntegrated(String name, String serverName, long seed, LevelGeneratorOptions arg, CallbackInfo ci) { + private void onSetupServerIntegrated(String string, long l, LevelGeneratorOptions levelGeneratorOptions, CallbackInfo ci) { CarpetServer.onServerLoaded((IntegratedServer) (Object) this); } } diff --git a/src/main/java/carpet/mixins/MinecraftDedicatedServerMixin.java b/src/main/java/carpet/mixins/MinecraftDedicatedServerMixin.java index 6b51315b..5d404421 100644 --- a/src/main/java/carpet/mixins/MinecraftDedicatedServerMixin.java +++ b/src/main/java/carpet/mixins/MinecraftDedicatedServerMixin.java @@ -14,7 +14,7 @@ public class MinecraftDedicatedServerMixin // this.tickWorlds(booleanSupplier_1); @Inject(method = "setupServer", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/dedicated/MinecraftDedicatedServer;loadWorld(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/level/LevelGeneratorOptions;)V", + target = "Lnet/minecraft/server/dedicated/MinecraftDedicatedServer;loadWorld(Ljava/lang/String;JLnet/minecraft/world/level/LevelGeneratorOptions;)V", shift = At.Shift.BEFORE )) private void onSetupServer(CallbackInfoReturnable cir) { diff --git a/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java b/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java index a9232a33..2850392c 100644 --- a/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java +++ b/src/main/java/carpet/mixins/MinecraftServer_coreMixin.java @@ -30,7 +30,7 @@ public abstract class MinecraftServer_coreMixin // Dedicated server only @Inject(method = "loadWorld", at = @At("HEAD")) - private void serverLoaded(String name, String serverName, long seed, LevelGeneratorOptions arg, CallbackInfo ci) + private void serverLoaded(String string, long l, LevelGeneratorOptions levelGeneratorOptions, CallbackInfo ci) { CarpetServer.onServerLoaded((MinecraftServer) (Object) this); } diff --git a/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java b/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java index e0d2f022..6923e0c6 100644 --- a/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java +++ b/src/main/java/carpet/mixins/OverworldChunkGeneratorMixin.java @@ -1,6 +1,7 @@ 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; @@ -26,14 +27,13 @@ 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/util/math/BlockPos;)Z"), + target = "Lnet/minecraft/world/gen/feature/StructureFeature;isApproximatelyInsideStructure(Lnet/minecraft/world/IWorld;Lnet/minecraft/class_5138;Lnet/minecraft/util/math/BlockPos;)Z"), cancellable = true) - private void onGetEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1, - CallbackInfoReturnable> cir) + private void onGetEntitySpawnList(class_5138 arg, EntityCategory entityCategory, BlockPos blockPos, CallbackInfoReturnable> cir) { if (CarpetSettings.huskSpawningInTemples) { - if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, blockPos_1)) + if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, arg, blockPos)) { cir.setReturnValue(Feature.DESERT_PYRAMID.getMonsterSpawns()); } diff --git a/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java b/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java index edd7660d..ef16df54 100644 --- a/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java +++ b/src/main/java/carpet/mixins/PistonBlockEntity_movableTEMixin.java @@ -109,7 +109,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple if (this.source) blockState_2 = Blocks.AIR.getDefaultState(); else - blockState_2 = Block.getRenderingState(this.pushedBlock, this.world, this.pos); + blockState_2 = Block.postProcessState(this.pushedBlock, this.world, this.pos); ((WorldInterface) (this.world)).setBlockStateWithBlockEntity(this.pos, blockState_2, this.carriedBlockEntity, 3); this.world.breakBlock(this.pos, false, null); } diff --git a/src/main/java/carpet/mixins/SaplingBlockMixin.java b/src/main/java/carpet/mixins/SaplingBlockMixin.java index d5e38e7a..8bf420f2 100644 --- a/src/main/java/carpet/mixins/SaplingBlockMixin.java +++ b/src/main/java/carpet/mixins/SaplingBlockMixin.java @@ -19,7 +19,7 @@ import java.util.Random; public abstract class SaplingBlockMixin { @Inject(method = "generate", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, - target = "Lnet/minecraft/block/sapling/SaplingGenerator;generate(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Ljava/util/Random;)Z"), + target = "Lnet/minecraft/block/sapling/SaplingGenerator;generate(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Ljava/util/Random;)Z"), cancellable = true) private void onGenerate(ServerWorld serverWorld_1, BlockPos blockPos_1, BlockState blockState_1, Random random_1, CallbackInfo ci) { diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index e54c17a3..5e1585b9 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -68,7 +68,7 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface BlockBox box = structurestart.getBoundingBox(); if (!wireOnly) { - structurestart.generateStructure(world, generator, rand, + structurestart.generateStructure(world, world.method_27056(), generator, rand, new BlockBox( pos.getX() - this.getRadius() * 16, pos.getZ() - this.getRadius() * 16, diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index aa5b0983..428464f2 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -75,8 +75,7 @@ public class CarpetScriptServer public Module getModule(String name, boolean allowLibraries) { - File folder = CarpetServer.minecraft_server.getLevelStorage().resolveFile( - CarpetServer.minecraft_server.getLevelName(), "scripts"); + File folder = CarpetServer.minecraft_server.method_27050().resolve("scripts").toFile(); File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) for (File script : listOfFiles) @@ -110,8 +109,7 @@ public class CarpetScriptServer if (!mi.isLibrary()) moduleNames.add(mi.getName()); } } - File folder = CarpetServer.minecraft_server.getLevelStorage().resolveFile( - CarpetServer.minecraft_server.getLevelName(), "scripts"); + File folder = CarpetServer.minecraft_server.method_27050().resolve("scripts").toFile(); File[] listOfFiles = folder.listFiles(); if (listOfFiles == null) return moduleNames; diff --git a/src/main/java/carpet/script/bundled/Module.java b/src/main/java/carpet/script/bundled/Module.java index 1cc804f1..a5543129 100644 --- a/src/main/java/carpet/script/bundled/Module.java +++ b/src/main/java/carpet/script/bundled/Module.java @@ -18,16 +18,14 @@ public abstract class Module public Tag getData(String file) { - File dataFile = CarpetServer.minecraft_server.getLevelStorage().resolveFile( - CarpetServer.minecraft_server.getLevelName(), "scripts/"+getName()+".data"+(file==null?"":"."+file)+".nbt"); + File dataFile = CarpetServer.minecraft_server.method_27050().resolve("scripts/"+getName()+".data"+(file==null?"":"."+file)+".nbt").toFile(); if (!Files.exists(dataFile.toPath()) || !(dataFile.isFile())) return null; return read(dataFile); } public void saveData(String file, Tag globalState) { - File dataFile =CarpetServer.minecraft_server.getLevelStorage().resolveFile( - CarpetServer.minecraft_server.getLevelName(), "scripts/"+getName()+".data"+(file==null?"":"."+file)+".nbt"); + File dataFile =CarpetServer.minecraft_server.method_27050().resolve("scripts/"+getName()+".data"+(file==null?"":"."+file)+".nbt").toFile(); if (!Files.exists(dataFile.toPath().getParent())) { try diff --git a/src/main/java/carpet/script/utils/WorldTools.java b/src/main/java/carpet/script/utils/WorldTools.java index d33120c5..784bb839 100644 --- a/src/main/java/carpet/script/utils/WorldTools.java +++ b/src/main/java/carpet/script/utils/WorldTools.java @@ -37,7 +37,7 @@ public class WorldTools if (!deepcheck) return true; // not using cache in this case. try { - RegionFile region = new RegionFile(regionFile, regionPath.toFile()); + RegionFile region = new RegionFile(regionFile, regionPath.toFile(), true); if (regionCache != null) regionCache.put(currentRegionName, region); return region.hasChunk(chpos); } diff --git a/src/main/java/carpet/settings/SettingsManager.java b/src/main/java/carpet/settings/SettingsManager.java index 675df7b8..68ecca64 100644 --- a/src/main/java/carpet/settings/SettingsManager.java +++ b/src/main/java/carpet/settings/SettingsManager.java @@ -136,7 +136,7 @@ public class SettingsManager private File getFile() { - return server.getLevelStorage().resolveFile(server.getLevelName(), identifier+".conf"); + return server.method_27050().resolve(identifier+".conf").toFile(); } public void disableBooleanCommands() diff --git a/src/main/java/carpet/utils/PerimeterDiagnostics.java b/src/main/java/carpet/utils/PerimeterDiagnostics.java index b818b31d..d928ced0 100644 --- a/src/main/java/carpet/utils/PerimeterDiagnostics.java +++ b/src/main/java/carpet/utils/PerimeterDiagnostics.java @@ -155,10 +155,10 @@ public class PerimeterDiagnostics private boolean check_entity_spawn(BlockPos pos) { - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos).contains(sle)) { sle = null; - for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(ctype, pos)) + for (Biome.SpawnEntry sle: worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos)) { if (el.getType() == sle.type) { @@ -166,7 +166,7 @@ public class PerimeterDiagnostics break; } } - if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(ctype, pos).contains(sle)) + if (sle == null || !worldServer.getChunkManager().getChunkGenerator().getEntitySpawnList(worldServer.method_27056(), ctype, pos).contains(sle)) { return false; } diff --git a/src/main/java/carpet/utils/SpawnReporter.java b/src/main/java/carpet/utils/SpawnReporter.java index b83e0a4c..af0ebd04 100644 --- a/src/main/java/carpet/utils/SpawnReporter.java +++ b/src/main/java/carpet/utils/SpawnReporter.java @@ -401,7 +401,7 @@ public class SpawnReporter for (EntityCategory enumcreaturetype : EntityCategory.values()) { String type_code = String.format("%s", enumcreaturetype).substring(0, 3); - List lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(enumcreaturetype, pos); + List lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.method_27056(), enumcreaturetype, pos); if (lst != null && !lst.isEmpty()) { for (Biome.SpawnEntry spawnEntry : lst)