@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
Reference in New Issue
Block a user