This commit is contained in:
gnembon committed 2020-04-02 23:38:19 -03:00
1 parent a4626df004
commit 76080f1a59
19 files changed
+49 -48

No files matched your search

@@ -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});
}
}
@@ -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));
@@ -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<FlatChunkGe
}
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory category, BlockPos pos)
public List<Biome.SpawnEntry> 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<FlatChunkGe
}
else if (category == EntityCategory.MONSTER)
{
if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(this.world, pos))
if (Feature.PILLAGER_OUTPOST.isApproximatelyInsideStructure(this.world, arg, pos))
{
return Feature.PILLAGER_OUTPOST.getMonsterSpawns();
}
if (CarpetSettings.huskSpawningInTemples)
{
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, pos))
if (Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(this.world, arg, pos))
{
return Feature.DESERT_PYRAMID.getMonsterSpawns();
}
}
if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(this.world, pos))
if (Feature.OCEAN_MONUMENT.isApproximatelyInsideStructure(this.world, arg, pos))
{
return Feature.OCEAN_MONUMENT.getMonsterSpawns();
}
if (Feature.NETHER_BRIDGE.isInsideStructure(this.world, pos))
if (Feature.NETHER_BRIDGE.isInsideStructure(this.world, arg, pos))
{
return Feature.NETHER_BRIDGE.getMonsterSpawns();
}
if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(this.world, pos) && this.world.getBlockState(pos.down(1)).getBlock() == Blocks.NETHER_BRICKS)
if (Feature.NETHER_BRIDGE.isApproximatelyInsideStructure(this.world, arg, pos) && this.world.getBlockState(pos.down(1)).getBlock() == Blocks.NETHER_BRICKS)
{
return Feature.NETHER_BRIDGE.getMonsterSpawns();
}
if (CarpetSettings.shulkerSpawningInEndCities)
{
if (Feature.END_CITY.isInsideStructure(this.world, pos))
if (Feature.END_CITY.isInsideStructure(this.world, arg, pos))
{
return Feature.END_CITY.getMonsterSpawns();
}
@@ -80,6 +81,6 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator<FlatChunkGe
}
}
return super.getEntitySpawnList(category, pos);
return super.getEntitySpawnList(arg, category, pos);
}
}
@@ -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;
@@ -23,15 +24,15 @@ public abstract class FloatingIslandsChunkGeneratorMixin extends SurfaceChunkGen
}
@Override
public List<Biome.SpawnEntry> getEntitySpawnList(EntityCategory entityCategory_1, BlockPos blockPos_1)
public List<Biome.SpawnEntry> 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);
}
}
@@ -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));
}
}
@@ -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);
}
}
@@ -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<Boolean> cir) {
@@ -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);
}
@@ -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<List<Biome.SpawnEntry>> cir)
private void onGetEntitySpawnList(class_5138 arg, EntityCategory entityCategory, BlockPos blockPos, CallbackInfoReturnable<List<Biome.SpawnEntry>> 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());
}
@@ -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);
}
@@ -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)
{
@@ -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,
@@ -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;
@@ -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
@@ -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);
}
@@ -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()
@@ -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;
}
@@ -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(enumcreaturetype, pos);
List<Biome.SpawnEntry> lst = ((ChunkGenerator)worldIn.getChunkManager().getChunkGenerator()).getEntitySpawnList(worldIn.method_27056(), enumcreaturetype, pos);
if (lst != null && !lst.isEmpty())
{
for (Biome.SpawnEntry spawnEntry : lst)