mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 03:48:01 +01:00
even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even more patches
This commit is contained in:
parent
de5dbadea0
commit
4e12e11a9b
81
patches/server/Add-Raw-Byte-Entity-Serialization.patch
Normal file
81
patches/server/Add-Raw-Byte-Entity-Serialization.patch
Normal file
@ -0,0 +1,81 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sun, 24 Oct 2021 16:20:31 -0400
|
||||
Subject: [PATCH] Add Raw Byte Entity Serialization
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Entity serialization api
|
||||
+ public boolean serializeEntity(CompoundTag compound) {
|
||||
+ List<Entity> pass = new java.util.ArrayList<>(this.getPassengers());
|
||||
+ this.passengers = ImmutableList.of();
|
||||
+ boolean result = save(compound);
|
||||
+ this.passengers = ImmutableList.copyOf(pass);
|
||||
+ return result;
|
||||
+ }
|
||||
+ // Paper end
|
||||
public boolean save(CompoundTag nbt) {
|
||||
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
return set;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean spawnAt(Location location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ Preconditions.checkNotNull(location, "location cannot be null");
|
||||
+ Preconditions.checkNotNull(reason, "reason cannot be null");
|
||||
+ entity.level = ((CraftWorld) location.getWorld()).getHandle();
|
||||
+ entity.setPos(location.getX(), location.getY(), location.getZ());
|
||||
+ entity.setRot(location.getYaw(), location.getPitch());
|
||||
+ return !entity.valid && entity.level.addEntity(entity, reason);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of((CompoundTag) converted.getValue()));
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public byte[] serializeEntity(org.bukkit.entity.Entity entity) {
|
||||
+ Preconditions.checkNotNull(entity, "null cannot be serialized");
|
||||
+ Preconditions.checkArgument(entity instanceof org.bukkit.craftbukkit.entity.CraftEntity, "only CraftEntities can be serialized");
|
||||
+
|
||||
+ CompoundTag compound = new CompoundTag();
|
||||
+ ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().serializeEntity(compound);
|
||||
+ return serializeNbtToBytes(compound);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Entity deserializeEntity(byte[] data, org.bukkit.World world, boolean preserveUUID) {
|
||||
+ Preconditions.checkNotNull(data, "null cannot be deserialized");
|
||||
+ Preconditions.checkArgument(data.length > 0, "cannot deserialize nothing");
|
||||
+
|
||||
+ CompoundTag compound = deserializeNbtFromBytes(data);
|
||||
+ int dataVersion = compound.getInt("DataVersion");
|
||||
+ Dynamic<Tag> converted = DataFixers.getDataFixer().update(References.ENTITY_TREE, new Dynamic<>(NbtOps.INSTANCE, compound), dataVersion, getDataVersion());
|
||||
+ compound = (CompoundTag) converted.getValue();
|
||||
+ if (!preserveUUID) compound.remove("UUID"); // Generate a new UUID so we don't have to worry about deserializing the same entity twice
|
||||
+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle())
|
||||
+ .orElseThrow(() -> new IllegalArgumentException("An ID was not found for the data. Did you downgrade?")).getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
private byte[] serializeNbtToBytes(CompoundTag compound) {
|
||||
compound.putInt("DataVersion", getDataVersion());
|
||||
java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
|
@ -16,7 +16,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start - guard against serializing mismatching coordinates
|
||||
+ // TODO Note: This needs to be re-checked each update
|
||||
+ public static ChunkPos getChunkCoordinate(CompoundTag chunkData) {
|
||||
+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
|
||||
+ final int dataVersion = ChunkStorage.getVersion(chunkData);
|
||||
+ if (dataVersion < 2842) { // Level tag is removed after this version
|
||||
+ final CompoundTag levelData = chunkData.getCompound("Level");
|
||||
+ return new ChunkPos(levelData.getInt("xPos"), levelData.getInt("zPos"));
|
||||
+ } else {
|
||||
+ return new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
// Paper start
|
||||
|
@ -189,7 +189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ protected boolean hasDelayedRecomputation; protected final boolean needsPathRecalculation() { return this.hasDelayedRecomputation; } // Paper - public accessor
|
||||
protected long timeLastRecompute;
|
||||
protected NodeEvaluator nodeEvaluator;
|
||||
private BlockPos targetPos;
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
public final PathFinder pathFinder;
|
||||
private boolean isStuck;
|
||||
@ -312,7 +312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!this.currentSection.remove(this.entity)) {
|
||||
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (moving to {})", this.entity, SectionPos.of(this.currentSectionKey), i);
|
||||
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||
entitysection.add(this.entity); // CraftBukkit - decompile error
|
||||
entitysection.add(this.entity);
|
||||
this.currentSection = entitysection;
|
||||
this.currentSectionKey = i;
|
||||
+ // Paper start
|
@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
||||
long key = net.minecraft.server.MCUtil.getCoordinateKey(this.pos);
|
||||
this.playersInMobSpawnRange = this.chunkMap.playerMobSpawnMap.getObjectsInRange(key);
|
||||
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
|
||||
this.setTicketLevel(level);
|
||||
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
|
||||
this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ LevelChunk chunk = this.getFullChunkUnchecked();
|
||||
+ if (chunk != null) {
|
||||
@ -23,16 +23,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end - optimise checkDespawn
|
||||
}
|
||||
// Paper end - optimise isOutsideOfRange
|
||||
long lastAutoSaveTime; // Paper - incremental autosave
|
||||
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick
|
||||
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap;
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper
|
||||
// Paper start - distance maps
|
||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ public static final int GENERAL_AREA_MAP_SQUARE_RADIUS = 40;
|
||||
+ public static final double GENERAL_AREA_MAP_ACCEPTABLE_SEARCH_RANGE = 16.0 * (GENERAL_AREA_MAP_SQUARE_RADIUS - 1);
|
||||
@ -42,30 +42,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
void addPlayerToDistanceMaps(ServerPlayer player) {
|
||||
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
this.playerChunkManager.addPlayer(player); // Paper - replace chunk loader
|
||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ this.playerGeneralAreaMap.add(player, chunkX, chunkZ, GENERAL_AREA_MAP_SQUARE_RADIUS);
|
||||
+ // Paper end - optimise checkDespawn
|
||||
}
|
||||
|
||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerChunkTickRangeMap.remove(player);
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
this.playerChunkManager.removePlayer(player); // Paper - replace chunk loader
|
||||
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ this.playerGeneralAreaMap.remove(player);
|
||||
+ // Paper end - optimise checkDespawn
|
||||
}
|
||||
|
||||
void updateMaps(ServerPlayer player) {
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
this.playerChunkManager.updatePlayer(player); // Paper - replace chunk loader
|
||||
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ this.playerGeneralAreaMap.update(player, chunkX, chunkZ, GENERAL_AREA_MAP_SQUARE_RADIUS);
|
||||
+ // Paper end - optimise checkDespawn
|
||||
@ -73,9 +67,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Paper end
|
||||
// Paper start
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
});
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
this.regionManagers.add(this.dataRegionManager);
|
||||
// Paper end
|
||||
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ this.playerGeneralAreaMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
|
||||
+ (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
|
||||
@ -95,32 +89,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end - optimise checkDespawn
|
||||
}
|
||||
|
||||
// Paper start - Chunk Prioritization
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
} else {
|
||||
if (holder != null) {
|
||||
holder.setTicketLevel(level);
|
||||
- holder.updateRanges(); // Paper - optimise isOutsideOfRange
|
||||
+ // Paper - move to correct place
|
||||
}
|
||||
|
||||
if (holder != null) {
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
holder = (ChunkHolder) this.pendingUnloads.remove(pos);
|
||||
if (holder != null) {
|
||||
holder.setTicketLevel(level);
|
||||
+ holder.updateRanges(); // Paper - optimise isOutsideOfRange // Paper - move to correct place
|
||||
} else {
|
||||
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
|
||||
// Paper start
|
||||
protected ChunkGenerator generator() {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
return this.getServer().getPlayerList().getPlayer(uuid);
|
||||
}
|
||||
// Paper end - rewrite ticklistserver
|
||||
// Paper end
|
||||
+ // Paper start - optimise checkDespawn
|
||||
+ public final List<ServerPlayer> playersAffectingSpawning = new java.util.ArrayList<>();
|
||||
+ // Paper end - optimise checkDespawn
|
||||
@ -233,7 +210,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end - optimise checkDespawn
|
||||
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.distanceToSqr((Entity) this); // CraftBukkit - decompile error
|
||||
double d0 = entityhuman.distanceToSqr((Entity) this);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
@ -306,7 +283,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end - optimise checkDespawn
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Anti-Xray - Pass executor
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -334,7 +311,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
@ -426,5 +403,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end - optimise checkDespawn
|
||||
|
||||
public LevelChunk(ServerLevel worldserver, ProtoChunk protoChunk, @Nullable Consumer<LevelChunk> consumer) {
|
||||
this(worldserver, protoChunk.getPos(), protoChunk.getBiomes(), protoChunk.getUpgradeData(), protoChunk.getBlockTicks(), protoChunk.getLiquidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), consumer);
|
||||
public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor chunk_c) {
|
||||
this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), chunk_c, protoChunk.getBlendingData());
|
@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
protected boolean canStillUse(ServerLevel world, E entity, long time) {
|
||||
- return this.behaviors.stream().filter((behavior) -> {
|
||||
- return behavior.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).anyMatch((behavior) -> {
|
||||
- return behavior.canStillUse(world, entity, time);
|
||||
- return this.behaviors.stream().filter((task) -> {
|
||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).anyMatch((task) -> {
|
||||
- return task.canStillUse(world, entity, time);
|
||||
- });
|
||||
+ // Paper start - remove streams
|
||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
||||
@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
protected void tick(ServerLevel world, E entity, long time) {
|
||||
- this.behaviors.stream().filter((behavior) -> {
|
||||
- return behavior.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).forEach((behavior) -> {
|
||||
- behavior.tickOrStop(world, entity, time);
|
||||
- this.behaviors.stream().filter((task) -> {
|
||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).forEach((task) -> {
|
||||
- task.tickOrStop(world, entity, time);
|
||||
- });
|
||||
+ // Paper start - remove streams
|
||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
||||
@ -62,10 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
protected void stop(ServerLevel world, E entity, long time) {
|
||||
- this.behaviors.stream().filter((behavior) -> {
|
||||
- return behavior.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).forEach((behavior) -> {
|
||||
- behavior.doStop(world, entity, time);
|
||||
- this.behaviors.stream().filter((task) -> {
|
||||
- return task.getStatus() == Behavior.Status.RUNNING;
|
||||
- }).forEach((task) -> {
|
||||
- task.doStop(world, entity, time);
|
||||
- });
|
||||
+ // Paper start - remove streams
|
||||
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
|
||||
@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
RUN_ONE {
|
||||
@Override
|
||||
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) {
|
||||
- tasks.filter((behavior) -> {
|
||||
- return behavior.getStatus() == Behavior.Status.STOPPED;
|
||||
- }).filter((behavior) -> {
|
||||
- return behavior.tryStart(world, entity, time);
|
||||
- tasks.filter((task) -> {
|
||||
- return task.getStatus() == Behavior.Status.STOPPED;
|
||||
- }).filter((task) -> {
|
||||
- return task.tryStart(world, entity, time);
|
||||
- }).findFirst();
|
||||
+ // Paper start - remove streams
|
||||
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
||||
@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
TRY_ALL {
|
||||
@Override
|
||||
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) {
|
||||
- tasks.filter((behavior) -> {
|
||||
- return behavior.getStatus() == Behavior.Status.STOPPED;
|
||||
- }).forEach((behavior) -> {
|
||||
- behavior.tryStart(world, entity, time);
|
||||
- tasks.filter((task) -> {
|
||||
- return task.getStatus() == Behavior.Status.STOPPED;
|
||||
- }).forEach((task) -> {
|
||||
- task.tryStart(world, entity, time);
|
||||
- });
|
||||
+ // Paper start - remove streams
|
||||
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) {
|
||||
@ -127,62 +127,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SetLookAndInteract.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SetLookAndInteract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/SetLookAndInteract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SetLookAndInteract.java
|
||||
@@ -0,0 +0,0 @@ public class SetLookAndInteract extends Behavior<LivingEntity> {
|
||||
|
||||
@Override
|
||||
public boolean checkExtraStartConditions(ServerLevel world, LivingEntity entity) {
|
||||
- return this.selfFilter.test(entity) && this.getVisibleEntities(entity).stream().anyMatch(this::isMatchingTarget);
|
||||
+ // Paper start - remove streams
|
||||
+ if (!this.selfFilter.test(entity)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ List<LivingEntity> visibleEntities = this.getVisibleEntities(entity);
|
||||
+ for (int i = 0; i < visibleEntities.size(); i++) {
|
||||
+ LivingEntity livingEntity = visibleEntities.get(i);
|
||||
+ if (this.isMatchingTarget(livingEntity)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ // Paper end - remove streams
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ServerLevel world, LivingEntity entity, long time) {
|
||||
super.start(world, entity, time);
|
||||
Brain<?> brain = entity.getBrain();
|
||||
- brain.getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES).ifPresent((list) -> {
|
||||
- list.stream().filter((livingEntity2) -> {
|
||||
- return livingEntity2.distanceToSqr(entity) <= (double)this.interactionRangeSqr;
|
||||
- }).filter(this::isMatchingTarget).findFirst().ifPresent((livingEntity) -> {
|
||||
- brain.setMemory(MemoryModuleType.INTERACTION_TARGET, livingEntity);
|
||||
- brain.setMemory(MemoryModuleType.LOOK_TARGET, new EntityTracker(livingEntity, true));
|
||||
- });
|
||||
- });
|
||||
+ // Paper start - remove streams
|
||||
+ List<LivingEntity> list = brain.getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES).orElse(null);
|
||||
+ if (list != null) {
|
||||
+ double maxRangeSquared = (double)this.interactionRangeSqr;
|
||||
+ for (int i = 0; i < list.size(); i++) {
|
||||
+ LivingEntity livingEntity2 = list.get(i);
|
||||
+ if (livingEntity2.distanceToSqr(entity) <= maxRangeSquared) {
|
||||
+ if (this.isMatchingTarget(livingEntity2)) {
|
||||
+ brain.setMemory(MemoryModuleType.INTERACTION_TARGET, livingEntity2);
|
||||
+ brain.setMemory(MemoryModuleType.LOOK_TARGET, new EntityTracker(livingEntity2, true));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - remove streams
|
||||
}
|
||||
|
||||
private boolean isMatchingTarget(LivingEntity entity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
@ -225,33 +169,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, Optional.ofNullable(nearest));
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
@@ -0,0 +0,0 @@ public class NearestLivingEntitySensor extends Sensor<LivingEntity> {
|
||||
List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, aABB, (livingEntity2) -> {
|
||||
return livingEntity2 != entity && livingEntity2.isAlive();
|
||||
});
|
||||
- list.sort(Comparator.comparingDouble(entity::distanceToSqr));
|
||||
+ // Paper start - remove streams
|
||||
+ list.sort((e1, e2) -> Double.compare(entity.distanceToSqr(e1), entity.distanceToSqr(e2)));
|
||||
Brain<?> brain = entity.getBrain();
|
||||
brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
|
||||
// Paper start - remove streams in favour of lists
|
||||
- List<LivingEntity> visibleMobs = new java.util.ArrayList<>(list);
|
||||
- visibleMobs.removeIf(otherEntityLiving -> !Sensor.isEntityTargetable(entity, otherEntityLiving));
|
||||
+ List<LivingEntity> visibleMobs = new java.util.ArrayList<>();
|
||||
+ for (int i = 0, len = list.size(); i < len; i++) {
|
||||
+ LivingEntity nearby = list.get(i);
|
||||
+ if (Sensor.isEntityTargetable(entity, nearby)) {
|
||||
+ visibleMobs.add(nearby);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - remove streams
|
||||
brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, visibleMobs);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
|
||||
@ -260,9 +177,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
protected void doTick(ServerLevel world, LivingEntity entity) {
|
||||
- // Paper start - remove streams in favour of lists
|
||||
- List<Player> players = new java.util.ArrayList<>(world.players());
|
||||
- players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator
|
||||
- players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D));
|
||||
- players.sort(Comparator.comparingDouble(entity::distanceTo));
|
||||
+ // Paper start - remove streams
|
||||
+ List<Player> players = (List)world.getNearbyPlayers(entity, entity.getX(), entity.getY(), entity.getZ(), 16.0D, EntitySelector.NO_SPECTATORS);
|
||||
+ players.sort((e1, e2) -> Double.compare(entity.distanceToSqr(e1), entity.distanceToSqr(e2)));
|
||||
@ -296,32 +213,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, nearest);
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, nearestTargetable);
|
||||
- // Paper end
|
||||
+
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, firstTargetable);
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, Optional.ofNullable(firstAttackable));
|
||||
+ // Paper end - remove streams
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
@@ -0,0 +0,0 @@ public class VillagerBabiesSensor extends Sensor<LivingEntity> {
|
||||
}
|
||||
|
||||
private List<LivingEntity> getNearestVillagerBabies(LivingEntity entities) {
|
||||
- return this.getVisibleEntities(entities).stream().filter(this::isVillagerBaby).collect(Collectors.toList());
|
||||
+ // Paper start - remove streams
|
||||
+ List<LivingEntity> list = new java.util.ArrayList<>();
|
||||
+ List<LivingEntity> visibleEntities = this.getVisibleEntities(entities);
|
||||
+ for (int i = 0; i < visibleEntities.size(); i++) {
|
||||
+ LivingEntity livingEntity = visibleEntities.get(i);
|
||||
+ if (this.isVillagerBaby(livingEntity)) {
|
||||
+ list.add(livingEntity);
|
||||
+ }
|
||||
+ }
|
||||
+ return list;
|
||||
+ // Paper end - remove streams
|
||||
}
|
||||
|
||||
private boolean isVillagerBaby(LivingEntity entity) {
|
File diff suppressed because it is too large
Load Diff
@ -1,197 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sat, 19 Jun 2021 10:54:52 -0700
|
||||
Subject: [PATCH] Fix Codec log spam
|
||||
|
||||
Mojang did NOT add dataconverters for world gen configurations
|
||||
that they CHANGED. So, the codec fails to parse old data.
|
||||
|
||||
This fixes two instances:
|
||||
- IntProvider is new and Mojang did not account for old data.
|
||||
Thankfully, only ColumnPlace needed to be special cased.
|
||||
- TreeConfiguration had changes. Thankfully, they were
|
||||
only renames for one value and thankfully defaults could
|
||||
be provided for two new values (WITHOUT changing behavior).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -0,0 +0,0 @@ public final class MCUtil {
|
||||
public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) {
|
||||
return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status);
|
||||
}
|
||||
+
|
||||
+ public static <A> com.mojang.serialization.MapCodec<A> fieldWithFallbacks(com.mojang.serialization.Codec<A> codec, String name, String ...fallback) {
|
||||
+ return com.mojang.serialization.MapCodec.of(
|
||||
+ new com.mojang.serialization.codecs.FieldEncoder<>(name, codec),
|
||||
+ new FieldFallbackDecoder<>(name, java.util.Arrays.asList(fallback), codec),
|
||||
+ () -> "FieldFallback[" + name + ": " + codec.toString() + "]"
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ // This is likely a common occurrence, sadly
|
||||
+ public static final class FieldFallbackDecoder<A> extends com.mojang.serialization.MapDecoder.Implementation<A> {
|
||||
+ protected final String name;
|
||||
+ protected final List<String> fallback;
|
||||
+ private final com.mojang.serialization.Decoder<A> elementCodec;
|
||||
+
|
||||
+ public FieldFallbackDecoder(final String name, final List<String> fallback, final com.mojang.serialization.Decoder<A> elementCodec) {
|
||||
+ this.name = name;
|
||||
+ this.fallback = fallback;
|
||||
+ this.elementCodec = elementCodec;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> com.mojang.serialization.DataResult<A> decode(final com.mojang.serialization.DynamicOps<T> ops, final com.mojang.serialization.MapLike<T> input) {
|
||||
+ T value = input.get(name);
|
||||
+ if (value == null) {
|
||||
+ for (String fall : fallback) {
|
||||
+ value = input.get(fall);
|
||||
+ if (value != null) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (value == null) {
|
||||
+ return com.mojang.serialization.DataResult.error("No key " + name + " in " + input);
|
||||
+ }
|
||||
+ }
|
||||
+ return elementCodec.parse(ops, value);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> java.util.stream.Stream<T> keys(final com.mojang.serialization.DynamicOps<T> ops) {
|
||||
+ return java.util.stream.Stream.of(ops.createString(name));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(final Object o) {
|
||||
+ if (this == o) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (o == null || getClass() != o.getClass()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ final FieldFallbackDecoder<?> that = (FieldFallbackDecoder<?>)o;
|
||||
+ return java.util.Objects.equals(name, that.name) && java.util.Objects.equals(elementCodec, that.elementCodec)
|
||||
+ && java.util.Objects.equals(fallback, that.fallback);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return java.util.Objects.hash(name, fallback, elementCodec);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "FieldDecoder[" + name + ": " + elementCodec + ']';
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/valueproviders/IntProvider.java b/src/main/java/net/minecraft/util/valueproviders/IntProvider.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/util/valueproviders/IntProvider.java
|
||||
+++ b/src/main/java/net/minecraft/util/valueproviders/IntProvider.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.core.Registry;
|
||||
|
||||
public abstract class IntProvider {
|
||||
private static final Codec<Either<Integer, IntProvider>> CONSTANT_OR_DISPATCH_CODEC = Codec.either(Codec.INT, Registry.INT_PROVIDER_TYPES.dispatch(IntProvider::getType, IntProviderType::codec));
|
||||
- public static final Codec<IntProvider> CODEC = CONSTANT_OR_DISPATCH_CODEC.xmap((either) -> {
|
||||
+ public static final Codec<IntProvider> CODEC_REAL = CONSTANT_OR_DISPATCH_CODEC.xmap((either) -> { // Paper - used by CODEC below
|
||||
return either.map(ConstantInt::of, (intProvider) -> {
|
||||
return intProvider;
|
||||
});
|
||||
}, (intProvider) -> {
|
||||
return intProvider.getType() == IntProviderType.CONSTANT ? Either.left(((ConstantInt)intProvider).getValue()) : Either.right(intProvider);
|
||||
});
|
||||
+ // Paper start
|
||||
+ public static final Codec<IntProvider> CODEC = new Codec<>() {
|
||||
+ @Override
|
||||
+ public <T> DataResult<com.mojang.datafixers.util.Pair<IntProvider, T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input) {
|
||||
+ /*
|
||||
+ UniformInt:
|
||||
+ count -> { (old format)
|
||||
+ base, spread
|
||||
+ } -> {UniformInt} { (new format & type)
|
||||
+ base, base + spread
|
||||
+ } */
|
||||
+
|
||||
+
|
||||
+ if (ops.get(input, "base").result().isPresent() && ops.get(input, "spread").result().isPresent()) {
|
||||
+ // detected old format
|
||||
+ int base = ops.getNumberValue(ops.get(input, "base").result().get()).result().get().intValue();
|
||||
+ int spread = ops.getNumberValue(ops.get(input, "spread").result().get()).result().get().intValue();
|
||||
+ return DataResult.success(new com.mojang.datafixers.util.Pair<>(UniformInt.of(base, base + spread), input));
|
||||
+ }
|
||||
+
|
||||
+ // not old format, forward to real codec
|
||||
+ return CODEC_REAL.decode(ops, input);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public <T> DataResult<T> encode(IntProvider input, com.mojang.serialization.DynamicOps<T> ops, T prefix) {
|
||||
+ // forward to real codec
|
||||
+ return CODEC_REAL.encode(input, ops, prefix);
|
||||
+ }
|
||||
+ };
|
||||
+ // Paper end
|
||||
public static final Codec<IntProvider> NON_NEGATIVE_CODEC = codec(0, Integer.MAX_VALUE);
|
||||
public static final Codec<IntProvider> POSITIVE_CODEC = codec(1, Integer.MAX_VALUE);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/blockplacers/ColumnPlacer.java b/src/main/java/net/minecraft/world/level/levelgen/feature/blockplacers/ColumnPlacer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/blockplacers/ColumnPlacer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/blockplacers/ColumnPlacer.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class ColumnPlacer extends BlockPlacer {
|
||||
+ // Paper start
|
||||
public static final Codec<ColumnPlacer> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
- return instance.group(IntProvider.NON_NEGATIVE_CODEC.fieldOf("size").forGetter((columnPlacer) -> {
|
||||
- return columnPlacer.size;
|
||||
- })).apply(instance, ColumnPlacer::new);
|
||||
+ return instance.group(
|
||||
+ IntProvider.NON_NEGATIVE_CODEC.optionalFieldOf("size").forGetter((columnPlacer) -> {
|
||||
+ return java.util.Optional.of(columnPlacer.size);
|
||||
+ }),
|
||||
+ Codec.INT.optionalFieldOf("min_size").forGetter((columnPlacer) -> {
|
||||
+ return java.util.Optional.empty();
|
||||
+ }),
|
||||
+ Codec.INT.optionalFieldOf("extra_size").forGetter((columnPlacer) -> {
|
||||
+ return java.util.Optional.empty();
|
||||
+ })
|
||||
+ ).apply(instance, ColumnPlacer::new);
|
||||
});
|
||||
+ public ColumnPlacer(java.util.Optional<IntProvider> size, java.util.Optional<Integer> minSize, java.util.Optional<Integer> extraSize) {
|
||||
+ if (size.isPresent()) {
|
||||
+ this.size = size.get();
|
||||
+ } else {
|
||||
+ this.size = net.minecraft.util.valueproviders.BiasedToBottomInt.of(minSize.get().intValue(), minSize.get().intValue() + extraSize.get().intValue());
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
private final IntProvider size;
|
||||
|
||||
public ColumnPlacer(IntProvider size) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java b/src/main/java/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/configurations/TreeConfiguration.java
|
||||
@@ -0,0 +0,0 @@ public class TreeConfiguration implements FeatureConfiguration {
|
||||
return treeConfiguration.trunkProvider;
|
||||
}), TrunkPlacer.CODEC.fieldOf("trunk_placer").forGetter((treeConfiguration) -> {
|
||||
return treeConfiguration.trunkPlacer;
|
||||
- }), BlockStateProvider.CODEC.fieldOf("foliage_provider").forGetter((treeConfiguration) -> {
|
||||
+ }), net.minecraft.server.MCUtil.fieldWithFallbacks(BlockStateProvider.CODEC, "foliage_provider", "leaves_provider").forGetter((treeConfiguration) -> { // Paper - provide fallback for rename
|
||||
return treeConfiguration.foliageProvider;
|
||||
- }), BlockStateProvider.CODEC.fieldOf("sapling_provider").forGetter((treeConfiguration) -> {
|
||||
+ }), BlockStateProvider.CODEC.optionalFieldOf("sapling_provider", new SimpleStateProvider(Blocks.OAK_SAPLING.defaultBlockState())).forGetter((treeConfiguration) -> { // Paper - provide default - it looks like for now this is OK because it's just used to check canSurvive. Same check happens in 1.16.5 for the default we provide - so it should retain behavior...
|
||||
return treeConfiguration.saplingProvider;
|
||||
}), FoliagePlacer.CODEC.fieldOf("foliage_placer").forGetter((treeConfiguration) -> {
|
||||
return treeConfiguration.foliagePlacer;
|
||||
- }), BlockStateProvider.CODEC.fieldOf("dirt_provider").forGetter((treeConfiguration) -> {
|
||||
+ }), BlockStateProvider.CODEC.optionalFieldOf("dirt_provider", new SimpleStateProvider(Blocks.DIRT.defaultBlockState())).forGetter((treeConfiguration) -> { // Paper - provide defaults, old data DOES NOT have this key (thankfully ALL OLD DATA used DIRT)
|
||||
return treeConfiguration.dirtProvider;
|
||||
}), FeatureSize.CODEC.fieldOf("minimum_size").forGetter((treeConfiguration) -> {
|
||||
return treeConfiguration.minimumSize;
|
2
todo.txt
2
todo.txt
@ -29,3 +29,5 @@ check ChunkHolder#updateFutures async catcher
|
||||
|
||||
|
||||
leaf: check mid tick chunk task diff in ServerChunkCache
|
||||
optimize nearby player lookups - look at patch and updateranges diff in chunkmap (why is it in this patch)
|
||||
GENERAL_AREA_MAP_ACCEPTABLE_SEARCH_RANGE_SQUARED is unused?
|
||||
|
Loading…
Reference in New Issue
Block a user