Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -1,69 +1,7 @@
--- a/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java
+++ b/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java
@@ -76,7 +76,7 @@
protected final IBlockData defaultBlock;
protected final IBlockData defaultFluid;
private final long seed;
- protected final Supplier<GeneratorSettingBase> settings;
+ public final Supplier<GeneratorSettingBase> settings; // PAIL protected -> public
private final int height;
private final NoiseSampler sampler;
private final BaseStoneSource baseStoneSource;
@@ -257,6 +257,19 @@
@@ -1,3 +1,4 @@
+// keep
package net.minecraft.world.level.levelgen;
@Override
public void buildBase(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkAccess ichunkaccess) {
+ // CraftBukkit start - spilt surface and bedrock generation code
+ Random random = buildSurface(regionlimitedworldaccess, ichunkaccess);
+ buildBedrock(ichunkaccess, random);
+ }
+
+ @Override
+ public void buildBedrock(IChunkAccess iChunkAccess, Random random) {
+ a(iChunkAccess, random); // PAIL rename setBedrock
+ }
+
+ @Override
+ public SeededRandom buildSurface(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkAccess ichunkaccess) {
+ // CraftBukkit end
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
int i = chunkcoordintpair.x;
int j = chunkcoordintpair.z;
@@ -281,7 +294,10 @@
}
}
- this.a(ichunkaccess, seededrandom);
+ // CraftBukkit start - spilt surface and bedrock generation code
+ // this.a(ichunkaccess, seededrandom);
+ return seededrandom;
+ // CraftBukkit end
}
private void a(IChunkAccess ichunkaccess, Random random) {
@@ -403,16 +419,23 @@
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int i1 = 0; i1 < this.cellCountX; ++i1) {
+ // CraftBukkit start - decompile error
+ int i1Final = i1;
list.forEach((noiseinterpolator1) -> {
- noiseinterpolator1.a(i1);
+ noiseinterpolator1.a(i1Final);
+ // CraftBukkit end
});
for (int j1 = 0; j1 < this.cellCountZ; ++j1) {
ChunkSection chunksection = ichunkaccess.b(ichunkaccess.getSectionsCount() - 1);
for (int k1 = j - 1; k1 >= 0; --k1) {
+ // CraftBukkit start - decompile error
+ int kiFinal = k1;
+ int j1Final = j1;
list.forEach((noiseinterpolator1) -> {
- noiseinterpolator1.a(k1, j1);
+ noiseinterpolator1.a(kiFinal, j1Final);
+ // CraftBukkit end
});
for (int l1 = this.cellHeight - 1; l1 >= 0; --l1) {
import com.google.common.collect.ImmutableList;

View File

@@ -13,42 +13,57 @@
- public static final Codec<GeneratorSettings> CODEC = RecordCodecBuilder.create((instance) -> {
+ public static final Codec<GeneratorSettings> CODEC = RecordCodecBuilder.<GeneratorSettings>create((instance) -> { // CraftBukkit - decompile error
return instance.group(Codec.LONG.fieldOf("seed").stable().forGetter(GeneratorSettings::getSeed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(GeneratorSettings::shouldGenerateMapFeatures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(GeneratorSettings::c), RegistryMaterials.b(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), WorldDimension.CODEC).xmap(WorldDimension::a, Function.identity()).fieldOf("dimensions").forGetter(GeneratorSettings::d), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((generatorsettings) -> {
return instance.group(Codec.LONG.fieldOf("seed").stable().forGetter(GeneratorSettings::seed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(GeneratorSettings::generateFeatures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(GeneratorSettings::generateBonusChest), RegistryMaterials.dataPackCodec(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), WorldDimension.CODEC).xmap(WorldDimension::sortMap, Function.identity()).fieldOf("dimensions").forGetter(GeneratorSettings::dimensions), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((generatorsettings) -> {
return generatorsettings.legacyCustomOptions;
})).apply(instance, instance.stable(GeneratorSettings::new));
@@ -121,7 +126,7 @@
public static RegistryMaterials<WorldDimension> a(RegistryMaterials<WorldDimension> registrymaterials, Supplier<DimensionManager> supplier, ChunkGenerator chunkgenerator) {
@@ -130,7 +135,7 @@
public static RegistryMaterials<WorldDimension> withOverworld(RegistryMaterials<WorldDimension> registrymaterials, Supplier<DimensionManager> supplier, ChunkGenerator chunkgenerator) {
RegistryMaterials<WorldDimension> registrymaterials1 = new RegistryMaterials<>(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.experimental());
- registrymaterials1.a(WorldDimension.OVERWORLD, (Object) (new WorldDimension(supplier, chunkgenerator)), Lifecycle.stable());
+ registrymaterials1.a(WorldDimension.OVERWORLD, (new WorldDimension(supplier, chunkgenerator)), Lifecycle.stable()); // CraftBukkit - decompile error
Iterator iterator = registrymaterials.d().iterator();
- registrymaterials1.register(WorldDimension.OVERWORLD, (Object) (new WorldDimension(supplier, chunkgenerator)), Lifecycle.stable());
+ registrymaterials1.register(WorldDimension.OVERWORLD, (new WorldDimension(supplier, chunkgenerator)), Lifecycle.stable()); // CraftBukkit - decompile error
Iterator iterator = registrymaterials.entrySet().iterator();
while (iterator.hasNext()) {
@@ -129,7 +134,7 @@
@@ -138,7 +143,7 @@
ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
if (resourcekey != WorldDimension.OVERWORLD) {
- registrymaterials1.a(resourcekey, (Object) ((WorldDimension) entry.getValue()), registrymaterials.d((Object) ((WorldDimension) entry.getValue())));
+ registrymaterials1.a(resourcekey, ((WorldDimension) entry.getValue()), registrymaterials.d(((WorldDimension) entry.getValue()))); // CraftBukkit - decompile error
- registrymaterials1.register(resourcekey, (Object) ((WorldDimension) entry.getValue()), registrymaterials.lifecycle((WorldDimension) entry.getValue()));
+ registrymaterials1.register(resourcekey, ((WorldDimension) entry.getValue()), registrymaterials.lifecycle((WorldDimension) entry.getValue())); // CraftBukkit - decompile error
}
}
@@ -242,7 +247,7 @@
@@ -159,17 +164,19 @@
}
}
- public ImmutableSet<ResourceKey<World>> levels() {
+ // CraftBukkit start
+ public ImmutableSet<ResourceKey<DimensionManager>> levels() {
return (ImmutableSet) this.dimensions().entrySet().stream().map(Entry::getKey).map(GeneratorSettings::levelStemToLevel).collect(ImmutableSet.toImmutableSet());
}
- public static ResourceKey<World> levelStemToLevel(ResourceKey<WorldDimension> resourcekey) {
- return ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
+ public static ResourceKey<DimensionManager> levelStemToLevel(ResourceKey<WorldDimension> resourcekey) {
+ return ResourceKey.create(IRegistry.DIMENSION_TYPE_REGISTRY, resourcekey.location());
}
- public static ResourceKey<WorldDimension> levelToLevelStem(ResourceKey<World> resourcekey) {
+ public static ResourceKey<WorldDimension> levelToLevelStem(ResourceKey<DimensionManager> resourcekey) {
return ResourceKey.create(IRegistry.LEVEL_STEM_REGISTRY, resourcekey.location());
}
+ // CraftBukkit end
public boolean isDebug() {
return this.overworld() instanceof ChunkProviderDebug;
@@ -246,7 +253,7 @@
switch (b0) {
case 0:
JsonObject jsonobject = !s.isEmpty() ? ChatDeserializer.a(s) : new JsonObject();
JsonObject jsonobject = !s.isEmpty() ? ChatDeserializer.parse(s) : new JsonObject();
- Dynamic<JsonElement> dynamic = new Dynamic(JsonOps.INSTANCE, jsonobject);
+ Dynamic<JsonElement> dynamic = new Dynamic(RegistryReadOps.a(JsonOps.INSTANCE, IResourceManager.Empty.INSTANCE, (IRegistryCustom.Dimension) iregistrycustom), jsonobject); // CraftBukkit - SPIGOT-6237
+ Dynamic<JsonElement> dynamic = new Dynamic(RegistryReadOps.createAndLoad(JsonOps.INSTANCE, IResourceManager.Empty.INSTANCE, (IRegistryCustom.Dimension) iregistrycustom), jsonobject); // CraftBukkit - SPIGOT-6237
DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(dynamic);
Logger logger = GeneratorSettings.LOGGER;
@@ -278,7 +283,7 @@
Entry<ResourceKey<WorldDimension>, WorldDimension> entry = (Entry) iterator.next();
ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
- registrymaterials.a(resourcekey, (Object) (new WorldDimension(((WorldDimension) entry.getValue()).a(), ((WorldDimension) entry.getValue()).c().withSeed(j))), this.dimensions.d((Object) ((WorldDimension) entry.getValue())));
+ registrymaterials.a(resourcekey, (Object) (new WorldDimension(((WorldDimension) entry.getValue()).a(), ((WorldDimension) entry.getValue()).c().withSeed(j))), this.dimensions.d(((WorldDimension) entry.getValue()))); // CraftBukkit - decompile error
}
} else {
registrymaterials = this.dimensions;

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java
+++ b/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java
@@ -119,7 +119,7 @@
@@ -116,7 +116,7 @@
entitymonsterpatrolling.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
entitymonsterpatrolling.prepare(worldserver, worldserver.getDamageScaler(blockposition), EnumMobSpawn.PATROL, (GroupDataEntity) null, (NBTTagCompound) null);
- worldserver.addAllEntities(entitymonsterpatrolling);
+ worldserver.addAllEntities(entitymonsterpatrolling, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PATROL); // CraftBukkit
entitymonsterpatrolling.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
entitymonsterpatrolling.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(blockposition), EnumMobSpawn.PATROL, (GroupDataEntity) null, (NBTTagCompound) null);
- worldserver.addFreshEntityWithPassengers(entitymonsterpatrolling);
+ worldserver.addFreshEntityWithPassengers(entitymonsterpatrolling, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PATROL); // CraftBukkit
return true;
} else {
return false;

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
+++ b/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
@@ -77,7 +77,7 @@
@@ -75,7 +75,7 @@
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
- worldserver.addAllEntities(entityphantom);
+ worldserver.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
entityphantom.moveTo(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.finalizeSpawn(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
- worldserver.addFreshEntityWithPassengers(entityphantom);
+ worldserver.addFreshEntityWithPassengers(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
}
i += k;

View File

@@ -1,23 +0,0 @@
--- a/net/minecraft/world/level/levelgen/NoiseSampler.java
+++ b/net/minecraft/world/level/levelgen/NoiseSampler.java
@@ -13,7 +13,7 @@
public class NoiseSampler {
private static final int OLD_CELL_COUNT_Y = 32;
- private static final float[] BIOME_WEIGHTS = (float[]) SystemUtils.a((Object) (new float[25]), (afloat) -> {
+ private static final float[] BIOME_WEIGHTS = (float[]) SystemUtils.a((new float[25]), (afloat) -> { // CraftBukkit - decompile error
for (int i = -2; i <= 2; ++i) {
for (int j = -2; j <= 2; ++j) {
float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F);
@@ -97,6 +97,11 @@
f6 = f4;
f7 = f5;
}
+ // CraftBukkit start - fix MC-54738
+ if (f6 < -1.8F) {
+ f6 = -1.8F;
+ }
+ // CraftBukkit end
float f8 = f4 > f3 ? 0.5F : 1.0F;
float f9 = f8 * NoiseSampler.BIOME_WEIGHTS[k1 + 2 + (l1 + 2) * 5] / (f6 + 2.0F);

View File

@@ -4,26 +4,27 @@
+// mc-dev import
package net.minecraft.world.level.levelgen;
import com.google.common.collect.ImmutableMap;
@@ -22,14 +23,15 @@
import com.google.common.annotations.VisibleForTesting;
@@ -31,7 +32,8 @@
return structuresettings.structureConfig;
})).apply(instance, StructureSettings::new);
});
- public static final ImmutableMap<StructureGenerator<?>, StructureSettingsFeature> DEFAULTS = ImmutableMap.builder().put(StructureGenerator.VILLAGE, new StructureSettingsFeature(32, 8, 10387312)).put(StructureGenerator.DESERT_PYRAMID, new StructureSettingsFeature(32, 8, 14357617)).put(StructureGenerator.IGLOO, new StructureSettingsFeature(32, 8, 14357618)).put(StructureGenerator.JUNGLE_TEMPLE, new StructureSettingsFeature(32, 8, 14357619)).put(StructureGenerator.SWAMP_HUT, new StructureSettingsFeature(32, 8, 14357620)).put(StructureGenerator.PILLAGER_OUTPOST, new StructureSettingsFeature(32, 8, 165745296)).put(StructureGenerator.STRONGHOLD, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.OCEAN_MONUMENT, new StructureSettingsFeature(32, 5, 10387313)).put(StructureGenerator.END_CITY, new StructureSettingsFeature(20, 11, 10387313)).put(StructureGenerator.WOODLAND_MANSION, new StructureSettingsFeature(80, 20, 10387319)).put(StructureGenerator.BURIED_TREASURE, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.MINESHAFT, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.RUINED_PORTAL, new StructureSettingsFeature(40, 15, 34222645)).put(StructureGenerator.SHIPWRECK, new StructureSettingsFeature(24, 4, 165745295)).put(StructureGenerator.OCEAN_RUIN, new StructureSettingsFeature(20, 8, 14357621)).put(StructureGenerator.BASTION_REMNANT, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_BRIDGE, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_FOSSIL, new StructureSettingsFeature(2, 1, 14357921)).build();
- public static final ImmutableMap<StructureGenerator<?>, StructureSettingsFeature> DEFAULTS = ImmutableMap.builder().put(StructureGenerator.VILLAGE, new StructureSettingsFeature(34, 8, 10387312)).put(StructureGenerator.DESERT_PYRAMID, new StructureSettingsFeature(32, 8, 14357617)).put(StructureGenerator.IGLOO, new StructureSettingsFeature(32, 8, 14357618)).put(StructureGenerator.JUNGLE_TEMPLE, new StructureSettingsFeature(32, 8, 14357619)).put(StructureGenerator.SWAMP_HUT, new StructureSettingsFeature(32, 8, 14357620)).put(StructureGenerator.PILLAGER_OUTPOST, new StructureSettingsFeature(32, 8, 165745296)).put(StructureGenerator.STRONGHOLD, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.OCEAN_MONUMENT, new StructureSettingsFeature(32, 5, 10387313)).put(StructureGenerator.END_CITY, new StructureSettingsFeature(20, 11, 10387313)).put(StructureGenerator.WOODLAND_MANSION, new StructureSettingsFeature(80, 20, 10387319)).put(StructureGenerator.BURIED_TREASURE, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.MINESHAFT, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.RUINED_PORTAL, new StructureSettingsFeature(40, 15, 34222645)).put(StructureGenerator.SHIPWRECK, new StructureSettingsFeature(24, 4, 165745295)).put(StructureGenerator.OCEAN_RUIN, new StructureSettingsFeature(20, 8, 14357621)).put(StructureGenerator.BASTION_REMNANT, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_BRIDGE, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_FOSSIL, new StructureSettingsFeature(2, 1, 14357921)).build();
+ // CraftBukkit - decompile error
+ public static final ImmutableMap<StructureGenerator<?>, StructureSettingsFeature> DEFAULTS = ImmutableMap.<StructureGenerator<?>, StructureSettingsFeature>builder().put(StructureGenerator.VILLAGE, new StructureSettingsFeature(32, 8, 10387312)).put(StructureGenerator.DESERT_PYRAMID, new StructureSettingsFeature(32, 8, 14357617)).put(StructureGenerator.IGLOO, new StructureSettingsFeature(32, 8, 14357618)).put(StructureGenerator.JUNGLE_TEMPLE, new StructureSettingsFeature(32, 8, 14357619)).put(StructureGenerator.SWAMP_HUT, new StructureSettingsFeature(32, 8, 14357620)).put(StructureGenerator.PILLAGER_OUTPOST, new StructureSettingsFeature(32, 8, 165745296)).put(StructureGenerator.STRONGHOLD, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.OCEAN_MONUMENT, new StructureSettingsFeature(32, 5, 10387313)).put(StructureGenerator.END_CITY, new StructureSettingsFeature(20, 11, 10387313)).put(StructureGenerator.WOODLAND_MANSION, new StructureSettingsFeature(80, 20, 10387319)).put(StructureGenerator.BURIED_TREASURE, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.MINESHAFT, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.RUINED_PORTAL, new StructureSettingsFeature(40, 15, 34222645)).put(StructureGenerator.SHIPWRECK, new StructureSettingsFeature(24, 4, 165745295)).put(StructureGenerator.OCEAN_RUIN, new StructureSettingsFeature(20, 8, 14357621)).put(StructureGenerator.BASTION_REMNANT, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_BRIDGE, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_FOSSIL, new StructureSettingsFeature(2, 1, 14357921)).build();
+ public static final ImmutableMap<StructureGenerator<?>, StructureSettingsFeature> DEFAULTS = ImmutableMap.<StructureGenerator<?>, StructureSettingsFeature>builder().put(StructureGenerator.VILLAGE, new StructureSettingsFeature(34, 8, 10387312)).put(StructureGenerator.DESERT_PYRAMID, new StructureSettingsFeature(32, 8, 14357617)).put(StructureGenerator.IGLOO, new StructureSettingsFeature(32, 8, 14357618)).put(StructureGenerator.JUNGLE_TEMPLE, new StructureSettingsFeature(32, 8, 14357619)).put(StructureGenerator.SWAMP_HUT, new StructureSettingsFeature(32, 8, 14357620)).put(StructureGenerator.PILLAGER_OUTPOST, new StructureSettingsFeature(32, 8, 165745296)).put(StructureGenerator.STRONGHOLD, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.OCEAN_MONUMENT, new StructureSettingsFeature(32, 5, 10387313)).put(StructureGenerator.END_CITY, new StructureSettingsFeature(20, 11, 10387313)).put(StructureGenerator.WOODLAND_MANSION, new StructureSettingsFeature(80, 20, 10387319)).put(StructureGenerator.BURIED_TREASURE, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.MINESHAFT, new StructureSettingsFeature(1, 0, 0)).put(StructureGenerator.RUINED_PORTAL, new StructureSettingsFeature(40, 15, 34222645)).put(StructureGenerator.SHIPWRECK, new StructureSettingsFeature(24, 4, 165745295)).put(StructureGenerator.OCEAN_RUIN, new StructureSettingsFeature(20, 8, 14357621)).put(StructureGenerator.BASTION_REMNANT, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_BRIDGE, new StructureSettingsFeature(27, 4, 30084232)).put(StructureGenerator.NETHER_FOSSIL, new StructureSettingsFeature(2, 1, 14357921)).build();
public static final StructureSettingsStronghold DEFAULT_STRONGHOLD;
private final Map<StructureGenerator<?>, StructureSettingsFeature> structureConfig;
@Nullable
private final StructureSettingsStronghold stronghold;
public StructureSettings(Optional<StructureSettingsStronghold> optional, Map<StructureGenerator<?>, StructureSettingsFeature> map) {
- this.stronghold = (StructureSettingsStronghold) optional.orElse((Object) null);
+ this.stronghold = (StructureSettingsStronghold) optional.orElse(null); // CraftBukkit - decompile error
this.structureConfig = map;
private final ImmutableMap<StructureGenerator<?>, ImmutableMultimap<StructureFeature<?, ?>, ResourceKey<BiomeBase>>> configuredStructures;
@@ -54,7 +56,7 @@
}
@@ -53,6 +55,15 @@
public StructureSettings(Optional<StructureSettingsStronghold> optional, Map<StructureGenerator<?>, StructureSettingsFeature> map) {
- this(map, (StructureSettingsStronghold) optional.orElse((Object) null));
+ this(map, (StructureSettingsStronghold) optional.orElse(null)); // CraftBukkit - decompile error
}
public StructureSettings(boolean flag) {
@@ -81,6 +83,15 @@
}
static {
@@ -39,7 +40,7 @@
Iterator iterator = IRegistry.STRUCTURE_FEATURE.iterator();
StructureGenerator structuregenerator;
@@ -67,5 +78,7 @@
@@ -95,5 +106,7 @@
} while (StructureSettings.DEFAULTS.containsKey(structuregenerator));
throw new IllegalStateException("Structure feature without default settings: " + IRegistry.STRUCTURE_FEATURE.getKey(structuregenerator));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/PersistentStructureLegacy.java
+++ b/net/minecraft/world/level/levelgen/structure/PersistentStructureLegacy.java
@@ -20,9 +20,13 @@
@@ -20,6 +20,10 @@
import net.minecraft.world.level.levelgen.feature.StructureGenerator;
import net.minecraft.world.level.storage.WorldPersistentData;
@@ -10,27 +10,14 @@
+
public class PersistentStructureLegacy {
- private static final Map<String, String> CURRENT_TO_LEGACY_MAP = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ private static final Map<String, String> CURRENT_TO_LEGACY_MAP = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
hashmap.put("Village", "Village");
hashmap.put("Mineshaft", "Mineshaft");
hashmap.put("Mansion", "Mansion");
@@ -35,7 +39,7 @@
hashmap.put("Fortress", "Fortress");
hashmap.put("EndCity", "EndCity");
});
- private static final Map<String, String> LEGACY_TO_CURRENT_MAP = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ private static final Map<String, String> LEGACY_TO_CURRENT_MAP = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
hashmap.put("Iglu", "Igloo");
hashmap.put("TeDP", "Desert_Pyramid");
hashmap.put("TeJP", "Jungle_Pyramid");
private static final Map<String, String> CURRENT_TO_LEGACY_MAP = (Map) SystemUtils.make(Maps.newHashMap(), (hashmap) -> {
@@ -234,16 +238,16 @@
}
}
- public static PersistentStructureLegacy a(ResourceKey<World> resourcekey, @Nullable WorldPersistentData worldpersistentdata) {
- public static PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<World> resourcekey, @Nullable WorldPersistentData worldpersistentdata) {
- if (resourcekey == World.OVERWORLD) {
+ public static PersistentStructureLegacy a(ResourceKey<DimensionManager> resourcekey, @Nullable WorldPersistentData worldpersistentdata) { // CraftBukkit
+ public static PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<DimensionManager> resourcekey, @Nullable WorldPersistentData worldpersistentdata) { // CraftBukkit
+ if (resourcekey == DimensionManager.OVERWORLD_LOCATION) { // CraftBukkit
return new PersistentStructureLegacy(worldpersistentdata, ImmutableList.of("Monument", "Stronghold", "Village", "Mineshaft", "Temple", "Mansion"), ImmutableList.of("Village", "Mineshaft", "Mansion", "Igloo", "Desert_Pyramid", "Jungle_Pyramid", "Swamp_Hut", "Stronghold", "Monument"));
} else {

View File

@@ -1,20 +1,20 @@
--- a/net/minecraft/world/level/levelgen/structure/WorldGenWitchHut.java
+++ b/net/minecraft/world/level/levelgen/structure/WorldGenWitchHut.java
@@ -101,7 +101,7 @@
entitywitch.setPersistent();
entitywitch.setPositionRotation((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitywitch.prepare(generatoraccessseed, generatoraccessseed.getDamageScaler(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- generatoraccessseed.addAllEntities(entitywitch);
+ generatoraccessseed.addAllEntities(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
@@ -97,7 +97,7 @@
entitywitch.setPersistenceRequired();
entitywitch.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- generatoraccessseed.addFreshEntityWithPassengers(entitywitch);
+ generatoraccessseed.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}
@@ -121,7 +121,7 @@
entitycat.setPersistent();
entitycat.setPositionRotation((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitycat.prepare(worldaccess, worldaccess.getDamageScaler(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- worldaccess.addAllEntities(entitycat);
+ worldaccess.addAllEntities(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
@@ -116,7 +116,7 @@
entitycat.setPersistenceRequired();
entitycat.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- worldaccess.addFreshEntityWithPassengers(entitycat);
+ worldaccess.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}

View File

@@ -1,42 +1,22 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
@@ -64,8 +64,8 @@
public static final String ENTITY_TAG_NBT = "nbt";
public static final String SIZE_TAG = "size";
static final int CHUNK_SIZE = 16;
- private final List<DefinedStructure.a> palettes = Lists.newArrayList();
- private final List<DefinedStructure.EntityInfo> entityInfoList = Lists.newArrayList();
+ public final List<DefinedStructure.a> palettes = Lists.newArrayList(); // PAIL private->public
+ public final List<DefinedStructure.EntityInfo> entityInfoList = Lists.newArrayList(); // PAIL private->public
private BaseBlockPosition size;
private String author;
@@ -147,7 +147,7 @@
@@ -142,7 +142,7 @@
}
private static List<DefinedStructure.BlockInfo> a(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) {
private static List<DefinedStructure.BlockInfo> buildInfoList(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) {
- Comparator<DefinedStructure.BlockInfo> comparator = Comparator.comparingInt((definedstructure_blockinfo) -> {
+ Comparator<DefinedStructure.BlockInfo> comparator = Comparator.<DefinedStructure.BlockInfo>comparingInt((definedstructure_blockinfo) -> { // CraftBukkit - decompile error
return definedstructure_blockinfo.pos.getY();
}).thenComparingInt((definedstructure_blockinfo) -> {
return definedstructure_blockinfo.pos.getX();
@@ -167,7 +167,7 @@
@@ -463,11 +463,13 @@
}
private void a(World world, BlockPosition blockposition, BlockPosition blockposition1) {
- List<Entity> list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (entity) -> {
+ List<Entity> list = world.a(Entity.class, new AxisAlignedBB(blockposition, blockposition1), (java.util.function.Predicate) (entity) -> { // CraftBukkit - decompile error
return !(entity instanceof EntityHuman);
});
@@ -471,11 +471,13 @@
}
private static Optional<Entity> a(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
- try {
+ // CraftBukkit start
+ // try {
return EntityTypes.a(nbttagcompound, (World) worldaccess.getLevel());
return EntityTypes.create(nbttagcompound, (World) worldaccess.getLevel());
- } catch (Exception exception) {
- return Optional.empty();
- }
@@ -46,10 +26,10 @@
+ // CraftBukkit end
}
public BaseBlockPosition a(EnumBlockRotation enumblockrotation) {
@@ -868,7 +870,7 @@
public IBlockData a(int i) {
IBlockData iblockdata = (IBlockData) this.ids.fromId(i);
public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) {
@@ -860,7 +862,7 @@
public IBlockData stateFor(int i) {
IBlockData iblockdata = (IBlockData) this.ids.byId(i);
- return iblockdata == null ? DefinedStructure.b.DEFAULT_BLOCK_STATE : iblockdata;
+ return iblockdata == null ? DEFAULT_BLOCK_STATE : iblockdata; // CraftBukkit - decompile error

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureInfo.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureInfo.java
@@ -24,7 +24,7 @@
@@ -22,7 +22,7 @@
private boolean keepLiquids;
@Nullable
private Random random;
@Nullable
- private int palette;
+ public int palette = -1; // CraftBukkit - Set initial value so we know if the palette has been set forcefully
private final List<DefinedStructureProcessor> processors;
private boolean knownShape;
private boolean finalizeEntities;
@@ -151,6 +151,13 @@
@@ -149,6 +149,13 @@
if (i == 0) {
throw new IllegalStateException("No palettes");
@@ -21,5 +21,5 @@
+ return list.get(this.palette);
+ // CraftBukkit end
} else {
return (DefinedStructure.a) list.get(this.b(blockposition).nextInt(i));
return (DefinedStructure.a) list.get(this.getRandom(blockposition).nextInt(i));
}

View File

@@ -1,47 +0,0 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureManager.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureManager.java
@@ -34,7 +34,7 @@
private static final String STRUCTURE_DIRECTORY_NAME = "structures";
private static final String STRUCTURE_FILE_EXTENSION = ".nbt";
private static final String STRUCTURE_TEXT_FILE_EXTENSION = ".snbt";
- private final Map<MinecraftKey, Optional<DefinedStructure>> structureRepository = Maps.newConcurrentMap();
+ public final Map<MinecraftKey, Optional<DefinedStructure>> structureRepository = Maps.newConcurrentMap(); // PAIL private->public
private final DataFixer fixerUpper;
private IResourceManager resourceManager;
private final Path generatedDir;
@@ -71,7 +71,7 @@
this.structureRepository.clear();
}
- private Optional<DefinedStructure> e(MinecraftKey minecraftkey) {
+ public Optional<DefinedStructure> e(MinecraftKey minecraftkey) { // PAIL private->public
MinecraftKey minecraftkey1 = new MinecraftKey(minecraftkey.getNamespace(), "structures/" + minecraftkey.getKey() + ".nbt");
try {
@@ -106,7 +106,7 @@
}
}
- private Optional<DefinedStructure> f(MinecraftKey minecraftkey) {
+ public Optional<DefinedStructure> f(MinecraftKey minecraftkey) { // PAIL private->public
if (!this.generatedDir.toFile().isDirectory()) {
return Optional.empty();
} else {
@@ -140,7 +140,7 @@
}
}
- private DefinedStructure a(InputStream inputstream) throws IOException {
+ public DefinedStructure a(InputStream inputstream) throws IOException { //PAIL rename loadFromStream; private -> public
NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a(inputstream);
return this.a(nbttagcompound);
@@ -214,7 +214,7 @@
}
}
- private Path b(MinecraftKey minecraftkey, String s) {
+ public Path b(MinecraftKey minecraftkey, String s) { //PAIL private->public
if (minecraftkey.getKey().contains("//")) {
throw new ResourceKeyInvalidException("Invalid resource path: " + minecraftkey);
} else {