Move diffs around to compile without later ones applied

This commit is contained in:
Nassim Jahnke 2024-01-23 18:01:39 +01:00
parent e66037960b
commit c57d1aa245
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
772 changed files with 546 additions and 499 deletions

View file

@ -2088,7 +2088,7 @@ index 0000000000000000000000000000000000000000..a743703502cea333bd4231b6557de50e
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
new file mode 100644
index 0000000000000000000000000000000000000000..b3329c6fcd6758a781a51f5ba8f5052ac1c77b49
index 0000000000000000000000000000000000000000..653cbd10c7280f3aeeaaff712d083dde461da092
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
@@ -0,0 +1,71 @@
@ -2114,7 +2114,7 @@ index 0000000000000000000000000000000000000000..b3329c6fcd6758a781a51f5ba8f5052a
+ this.enumClass = clazz;
+ }
+
+ public boolean addUnchecked(final E element) {
+ public boolean add(final E element) {
+ final int ordinal = element.ordinal();
+ final long key = 1L << ordinal;
+
@ -2124,7 +2124,7 @@ index 0000000000000000000000000000000000000000..b3329c6fcd6758a781a51f5ba8f5052a
+ return (prev & key) == 0;
+ }
+
+ public boolean removeUnchecked(final E element) {
+ public boolean remove(final E element) {
+ final int ordinal = element.ordinal();
+ final long key = 1L << ordinal;
+
@ -2142,7 +2142,7 @@ index 0000000000000000000000000000000000000000..b3329c6fcd6758a781a51f5ba8f5052a
+ return Long.bitCount(this.backingSet);
+ }
+
+ public void addAllUnchecked(final Collection<E> enums) {
+ public void addAll(final Collection<E> enums) {
+ for (final E element : enums) {
+ if (element == null) {
+ throw new NullPointerException("Null element");
@ -2159,7 +2159,7 @@ index 0000000000000000000000000000000000000000..b3329c6fcd6758a781a51f5ba8f5052a
+ return (other.backingSet & this.backingSet) != 0;
+ }
+
+ public boolean hasElement(final E element) {
+ public boolean contains(final E element) {
+ return (this.backingSet & (1L << element.ordinal())) != 0;
+ }
+}
@ -6345,7 +6345,7 @@ index 1641bdf8725df778ba91bf5cd22c1ebbb3745058..facfdbb87e89f4db33ce13233c2ba436
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba 100644
index f083356fe490ecebdc1486784f4833d778b816f4..c721642337652ba4cf984ba3c263655b717d3b03 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -168,6 +168,62 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -6411,7 +6411,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -221,7 +277,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -221,8 +277,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
this.setServerViewDistance(viewDistance);
@ -6420,18 +6420,30 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
+ this.regionManagers.add(this.dataRegionManager);
+ this.nearbyPlayers = new io.papermc.paper.util.player.NearbyPlayers(this.level);
+ // Paper end
+ }
+
}
+ // Paper start
+ // always use accessor, so folia can override
+ public final io.papermc.paper.util.player.NearbyPlayers getNearbyPlayers() {
+ return this.nearbyPlayers;
}
+ }
+ // Paper end
+
protected ChunkGenerator generator() {
return this.generator;
@@ -322,6 +390,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@@ -246,6 +314,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) {
+ return -1;
+ }
+
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
@@ -322,6 +394,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -6447,7 +6459,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkHolder centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) {
if (margin == 0) {
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(0);
@@ -418,9 +495,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -418,9 +499,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
stringbuilder.append("Updating:").append(System.lineSeparator());
@ -6459,7 +6471,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading");
@@ -462,8 +539,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -462,8 +543,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
@ -6474,7 +6486,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
this.updatingChunkMap.put(pos, holder);
this.modified = true;
}
@@ -485,7 +568,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -485,7 +572,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
@ -6483,7 +6495,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -514,7 +597,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -514,7 +601,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
this.flushWorker();
} else {
@ -6492,7 +6504,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
}
}
@@ -533,7 +616,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -533,7 +620,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -6501,7 +6513,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
}
private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -544,6 +627,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -544,6 +631,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
if (playerchunk != null) {
@ -6509,7 +6521,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -561,7 +645,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -561,7 +649,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
@ -6518,7 +6530,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -579,7 +663,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -579,7 +667,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else {
@ -6531,7 +6543,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -595,7 +683,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -595,7 +687,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
@ -6542,7 +6554,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
}
};
@@ -1038,7 +1128,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1038,7 +1132,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -6551,7 +6563,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
}
public DistanceManager getDistanceManager() {
@@ -1046,19 +1136,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1046,19 +1140,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {
@ -6576,7 +6588,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLastAvailable());
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -1183,6 +1273,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1183,6 +1277,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
player.setChunkTrackingView(ChunkTrackingView.EMPTY);
this.updateChunkTracking(player);
@ -6584,7 +6596,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
} else {
SectionPos sectionposition = player.getLastSectionPos();
@@ -1191,6 +1282,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1191,6 +1286,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.distanceManager.removePlayer(sectionposition, player);
}
@ -6592,7 +6604,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY);
}
@@ -1242,6 +1334,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1242,6 +1338,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.updateChunkTracking(player);
}
@ -6600,7 +6612,7 @@ index f083356fe490ecebdc1486784f4833d778b816f4..a4d1136fcd75ecdf2cbd7af591d4acb4
}
private void updateChunkTracking(ServerPlayer player) {
@@ -1494,7 +1587,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1494,7 +1591,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private class ChunkDistanceManager extends DistanceManager {
protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
@ -7355,7 +7367,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..db61b6b0158a9bcc0e1d735e34fe3671
public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b194cb1a99c 100644
index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..d89431b476b032f3ff86097bb91b86016d4e3371 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -93,6 +93,7 @@ import org.bukkit.craftbukkit.CraftServer;
@ -7366,7 +7378,21 @@ index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b19
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftSpawnCategory;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -295,18 +296,52 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -279,6 +280,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}
+ // Paper start
+ public net.minecraft.world.phys.BlockHitResult.Type clipDirect(Vec3 start, Vec3 end, net.minecraft.world.phys.shapes.CollisionContext context) {
+ // To be patched over
+ return this.clip(new ClipContext(start, end, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, context)).getType();
+ }
+ // Paper end
+
public boolean isInWorldBounds(BlockPos pos) {
return !this.isOutsideBuildHeight(pos) && Level.isInWorldBoundsHorizontal(pos);
}
@@ -295,18 +303,52 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return y < -20000000 || y >= 20000000;
}
@ -7383,15 +7409,14 @@ index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b19
}
+ // Paper start - if loaded
@Nullable
@Override
- public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ @Nullable
+ @Override
+ public final ChunkAccess getChunkIfLoadedImmediately(int x, int z) {
+ return ((ServerLevel)this).chunkSource.getChunkAtIfLoadedImmediately(x, z);
+ }
+
+ @Override
+ @Nullable
@Nullable
+ public final BlockState getBlockStateIfLoaded(BlockPos pos) {
+ // CraftBukkit start - tree generation
+ if (this.captureTreeGeneration) {
@ -7417,13 +7442,14 @@ index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b19
+ return chunk == null ? null : chunk.getFluidState(blockposition);
+ }
+
+ @Override
@Override
- public ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ public final ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { // Paper - final for inline
+ // Paper end
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
if (ichunkaccess == null && create) {
@@ -317,7 +352,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -317,7 +359,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
@ -7432,7 +7458,7 @@ index 00ddf94c5bade8c0c486337ce920f59d63cb64e2..32afa096f148ebb546963bae7c9c9b19
return this.setBlock(pos, state, flags, 512);
}
@@ -555,7 +590,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -555,7 +597,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (this.isOutsideBuildHeight(pos)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@ -7566,8 +7592,25 @@ index 532a0cae6db0d830e720a72e9021aa7a8ed0f106..e5e562f75e7d4b6a750f192842940c5e
this.upgradeData = upgradeData;
this.levelHeightAccessor = heightLimitView;
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
index ca0991b07def35b4697ba6d5569bf9a080e48a1c..2ee1658532cb00d7bcd1d11e03f19d21ca7f2a9e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
@@ -25,6 +25,12 @@ public class EmptyLevelChunk extends LevelChunk {
public BlockState getBlockState(BlockPos pos) {
return Blocks.VOID_AIR.defaultBlockState();
}
+ // Paper start
+ @Override
+ public BlockState getBlockState(final int x, final int y, final int z) {
+ return Blocks.VOID_AIR.defaultBlockState();
+ }
+ // Paper end
@Nullable
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 57805b84054e44a3d7c95cf269316a42205bb99c..e9670e43a146288ad0e5a33dfc02b90fc1eee95b 100644
index 57805b84054e44a3d7c95cf269316a42205bb99c..409007f6e6940e5ea92e3cbaa74e55cdee50325b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -114,6 +114,109 @@ public class LevelChunk extends ChunkAccess {
@ -7680,7 +7723,33 @@ index 57805b84054e44a3d7c95cf269316a42205bb99c..e9670e43a146288ad0e5a33dfc02b90f
public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor entityLoader) {
this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), entityLoader, protoChunk.getBlendingData());
Iterator iterator = protoChunk.getBlockEntities().values().iterator();
@@ -224,6 +327,18 @@ public class LevelChunk extends ChunkAccess {
@@ -181,8 +284,25 @@ public class LevelChunk extends ChunkAccess {
}
}
+ // Paper start - Perf: Reduce instructions and provide final method
+ public BlockState getBlockState(final int x, final int y, final int z) {
+ return this.getBlockStateFinal(x, y, z);
+ }
+ public BlockState getBlockStateFinal(final int x, final int y, final int z) {
+ // Copied and modified from below
+ final int sectionIndex = this.getSectionIndex(y);
+ if (sectionIndex < 0 || sectionIndex >= this.sections.length
+ || this.sections[sectionIndex].nonEmptyBlockCount == 0) {
+ return Blocks.AIR.defaultBlockState();
+ }
+ return this.sections[sectionIndex].states.get((y & 15) << 8 | (z & 15) << 4 | x & 15);
+ }
@Override
public BlockState getBlockState(BlockPos pos) {
+ if (true) {
+ return this.getBlockStateFinal(pos.getX(), pos.getY(), pos.getZ());
+ }
+ // Paper end - Perf: Reduce instructions and provide final method
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
@@ -224,6 +344,18 @@ public class LevelChunk extends ChunkAccess {
}
}
@ -7699,7 +7768,7 @@ index 57805b84054e44a3d7c95cf269316a42205bb99c..e9670e43a146288ad0e5a33dfc02b90f
@Override
public FluidState getFluidState(BlockPos pos) {
return this.getFluidState(pos.getX(), pos.getY(), pos.getZ());
@@ -537,7 +652,25 @@ public class LevelChunk extends ChunkAccess {
@@ -537,7 +669,25 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start
public void loadCallback() {
@ -7725,7 +7794,7 @@ index 57805b84054e44a3d7c95cf269316a42205bb99c..e9670e43a146288ad0e5a33dfc02b90f
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
@@ -578,6 +711,22 @@ public class LevelChunk extends ChunkAccess {
@@ -578,6 +728,22 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk();
@ -7748,6 +7817,19 @@ index 57805b84054e44a3d7c95cf269316a42205bb99c..e9670e43a146288ad0e5a33dfc02b90f
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index d59392c322936ce89b759ac9787c8f4f0b228af6..2d6daf76a56574c9727b404feb4f86347f04cbae 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -19,7 +19,7 @@ public class LevelChunkSection {
public static final int SECTION_HEIGHT = 16;
public static final int SECTION_SIZE = 4096;
public static final int BIOME_CONTAINER_BITS = 2;
- private short nonEmptyBlockCount;
+ short nonEmptyBlockCount; // Paper - package private
private short tickingBlockCount;
private short tickingFluidCount;
public final PalettedContainer<BlockState> states;
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index 51a0ddcee9a9cb1040fda643a6442d2e2e15b8a0..38ec21faaa16df5485a81a581506700a5ab0a440 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@ -8275,6 +8357,20 @@ index 96c4f7aed548a181f6b1487e58dcf157bae52daa..837e3d6ee71566b5a6f37a4943829133
@Override
public void clear() {
// Create new array to reset memory usage to initial capacity
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0c7c97f27853843ec714e47f5b570f9d09bbba14..ff422d4d4f2b764370f0ee2af13034853c1d3fe1 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -34,6 +34,9 @@ public class ActivationRange
public enum ActivationType
{
+ WATER, // Paper
+ FLYING_MONSTER, // Paper
+ VILLAGER, // Paper
MONSTER,
ANIMAL,
RAIDER,
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index df29015e3d5ca49297fe87090fd6446962e59adb..e6e070db9a6ee78e65dbff6f18cb5c8784202b9f 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -974,7 +974,7 @@ index 813fd87df0dfed8fe46389db8333d1d9f409fbe4..dfb37ddb89c2f43d9f9a34a6b2d38616
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba..17af50aa1ab310a5f0f221e2cd4e9e902c28a092 100644
index c721642337652ba4cf984ba3c263655b717d3b03..23e830d4cbe94a91c34ebb426311c8f861280b16 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
@ -988,7 +988,7 @@ index a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba..17af50aa1ab310a5f0f221e2cd4e9e90
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -897,6 +899,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -901,6 +903,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = ChunkLevel.generationStatus(chunkHolder.getTicketLevel());
return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> {
@ -996,7 +996,7 @@ index a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba..17af50aa1ab310a5f0f221e2cd4e9e90
ChunkPos chunkcoordintpair = chunkHolder.getPos();
ProtoChunk protochunk = (ProtoChunk) ichunkaccess;
LevelChunk chunk;
@@ -921,6 +924,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -925,6 +928,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
return chunk;
@ -1004,7 +1004,7 @@ index a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba..17af50aa1ab310a5f0f221e2cd4e9e90
});
}, (runnable) -> {
ProcessorHandle mailbox = this.mainThreadMailbox;
@@ -1472,6 +1476,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1476,6 +1480,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
@ -1012,7 +1012,7 @@ index a4d1136fcd75ecdf2cbd7af591d4acb4dfd248ba..17af50aa1ab310a5f0f221e2cd4e9e90
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1496,14 +1501,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1500,14 +1505,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
@ -1472,7 +1472,7 @@ index b71b702471599fc8f1de42919ade8ee6a4e6247c..2e47008a8ff1bb56b752d4eb880173b9
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 32afa096f148ebb546963bae7c9c9b194cb1a99c..6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5 100644
index d89431b476b032f3ff86097bb91b86016d4e3371..aa22d4024cdd0ecb1c0442ecdeae00822597362e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -91,7 +91,6 @@ import org.bukkit.Bukkit;
@ -1501,7 +1501,7 @@ index 32afa096f148ebb546963bae7c9c9b194cb1a99c..6dbc4c74b4d6b8e6c4763366e70ca929
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
}
@@ -718,15 +717,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -725,15 +724,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
@ -1557,10 +1557,10 @@ index c02fa35cefc9194d1838abbe4f2dc2b226a41e41..b300d12e9e00519028b53aca9c3fb01f
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index e9670e43a146288ad0e5a33dfc02b90fc1eee95b..93a73367e004979a015704d94a5669d154a2f71b 100644
index 409007f6e6940e5ea92e3cbaa74e55cdee50325b..c2179ea2a16ae0fac0b59d81a57abf13f563843f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -681,6 +681,7 @@ public class LevelChunk extends ChunkAccess {
@@ -698,6 +698,7 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
if (this.needsDecoration) {
@ -1568,7 +1568,7 @@ index e9670e43a146288ad0e5a33dfc02b90fc1eee95b..93a73367e004979a015704d94a5669d1
this.needsDecoration = false;
java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed());
@@ -700,6 +701,7 @@ public class LevelChunk extends ChunkAccess {
@@ -717,6 +718,7 @@ public class LevelChunk extends ChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
@ -2048,7 +2048,7 @@ index 72c1b7f1468c47ad7053a7ff6b3248324b2bf604..677335c3888adc25fbf3c5ec4d5a6c5e
* This helper class represents the different NBT Tags.
* <p>
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e416547577fd3cc5d 100644
index ff422d4d4f2b764370f0ee2af13034853c1d3fe1..a5da6c1cae0afbde684be250e2fc3c0c32a1265b 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -27,7 +27,7 @@ import net.minecraft.world.entity.projectile.ThrownTrident;
@ -2060,7 +2060,7 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e41654757
public class ActivationRange
{
@@ -71,8 +71,8 @@ public class ActivationRange
@@ -74,8 +74,8 @@ public class ActivationRange
/**
* These entities are excluded from Activation range checks.
*
@ -2071,7 +2071,7 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e41654757
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
@@ -107,7 +107,7 @@ public class ActivationRange
@@ -110,7 +110,7 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
@ -2080,7 +2080,7 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e41654757
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -134,7 +134,7 @@ public class ActivationRange
@@ -137,7 +137,7 @@ public class ActivationRange
world.getEntities().get(ActivationRange.maxBB, ActivationRange::activateEntity);
}
@ -2089,7 +2089,7 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e41654757
}
/**
@@ -229,10 +229,8 @@ public class ActivationRange
@@ -232,10 +232,8 @@ public class ActivationRange
*/
public static boolean checkIfActive(Entity entity)
{
@ -2100,7 +2100,7 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..e01ef22189ce80429eb0054e41654757
return true;
}
@@ -256,7 +254,6 @@ public class ActivationRange
@@ -259,7 +257,6 @@ public class ActivationRange
{
isActive = false;
}

View file

@ -4493,7 +4493,7 @@ index facfdbb87e89f4db33ce13233c2ba4366d35c15b..807a6bb1026dac2c4cd0a50afe06fd62
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
public int oldTicketLevel;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 17af50aa1ab310a5f0f221e2cd4e9e902c28a092..5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29 100644
index 23e830d4cbe94a91c34ebb426311c8f861280b16..ed095afdf8be843b9a608130040739c0b21dbe0a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -125,7 +125,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -5037,7 +5037,7 @@ index d5b1fd0ff3f64675f90dd9f7f328a106e0992d51..846ae3fd184a1d63b743aa25e0456045
return (ChunkStatus) BuiltInRegistries.CHUNK_STATUS.get(ResourceLocation.tryParse(id));
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
index ca0991b07def35b4697ba6d5569bf9a080e48a1c..f49cc61840c6588fca301b4c5c3aaeede03a323e 100644
index 2ee1658532cb00d7bcd1d11e03f19d21ca7f2a9e..ac754827172a4de600d0a57a7d11853481a2dbf2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/EmptyLevelChunk.java
@@ -21,6 +21,40 @@ public class EmptyLevelChunk extends LevelChunk {
@ -5135,7 +5135,7 @@ index 6bb508105641b5729572736c5c3f9bd6711e309a..60e760b42dd6471a229dfd45490dcf8c
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 93a73367e004979a015704d94a5669d154a2f71b..17725dba7cbcdce00cd23c3956eaf1642d9c424f 100644
index c2179ea2a16ae0fac0b59d81a57abf13f563843f..3e51fb9fe05d5b974ae41ccc0acbb516a07c114b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -219,6 +219,12 @@ public class LevelChunk extends ChunkAccess {
@ -5160,7 +5160,7 @@ index 93a73367e004979a015704d94a5669d154a2f71b..17725dba7cbcdce00cd23c3956eaf164
this.setLightCorrect(protoChunk.isLightCorrect());
this.unsaved = true;
this.needsDecoration = true; // CraftBukkit
@@ -409,7 +415,7 @@ public class LevelChunk extends ChunkAccess {
@@ -426,7 +432,7 @@ public class LevelChunk extends ChunkAccess {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.push("updateSkyLightSources");

View file

@ -17522,7 +17522,7 @@ index 807a6bb1026dac2c4cd0a50afe06fd62ce23558b..2b998bdbe49bf8211b755e0eb7c1bf13
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7bbc9820ce 100644
index ed095afdf8be843b9a608130040739c0b21dbe0a..2a52f5fc867f35b9d94b813d5cdd92249c60ee8b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -119,10 +119,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -17654,7 +17654,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
@@ -326,23 +298,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -330,23 +302,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
boolean isChunkTracked(ServerPlayer player, int chunkX, int chunkZ) {
@ -17684,7 +17684,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
protected ThreadedLevelLightEngine getLightEngine() {
@@ -351,20 +315,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -355,20 +319,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable
protected ChunkHolder getUpdatingChunkIfPresent(long pos) {
@ -17714,7 +17714,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
public String getChunkDebugData(ChunkPos chunkPos) {
@@ -394,92 +360,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -398,92 +364,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start
public final int getEffectiveViewDistance() {
@ -17809,7 +17809,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
public ReportedException debugFuturesAndCreateReportedException(IllegalStateException exception, String details) {
@@ -509,263 +395,72 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -513,263 +399,72 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareEntityTickingChunk(ChunkHolder chunk) {
@ -18093,7 +18093,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
return nbt.contains("Status", 8);
}
@@ -801,54 +496,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -805,54 +500,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> scheduleChunkGeneration(ChunkHolder holder, ChunkStatus requiredStatus) {
@ -18149,7 +18149,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
protected void releaseLightTicket(ChunkPos pos) {
@@ -859,7 +507,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -863,7 +511,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}));
}
@ -18158,7 +18158,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
ChunkStatus chunkstatus1;
if (distance == 0) {
@@ -871,7 +519,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -875,7 +523,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunkstatus1;
}
@ -18167,7 +18167,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
if (!nbt.isEmpty()) {
// CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
world.addWorldGenChunkEntities(EntityType.loadEntitiesRecursive(nbt, world).filter((entity) -> {
@@ -886,111 +534,27 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -890,111 +538,27 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
needsRemoval = true;
}
return !needsRemoval;
@ -18284,7 +18284,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
public int getTickingGenerated() {
@@ -998,130 +562,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1002,130 +566,52 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
private boolean saveChunkIfNeeded(ChunkHolder chunkHolder) {
@ -18432,7 +18432,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
@Nullable
@@ -1144,30 +630,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1148,30 +634,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
void dumpChunks(Writer writer) throws IOException {
@ -18464,7 +18464,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
private static String printFuture(CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> future) {
@@ -1186,6 +649,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1190,6 +653,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -18500,7 +18500,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) {
return this.read(chunkPos).thenApplyAsync((optional) -> {
return optional.map((nbttagcompound) -> this.upgradeChunkTag(nbttagcompound, chunkPos)); // CraftBukkit
@@ -1275,8 +767,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1279,8 +771,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player);
}
@ -18510,7 +18510,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
this.addPlayerToDistanceMaps(player); // Paper - distance maps
} else {
SectionPos sectionposition = player.getLastSectionPos();
@@ -1287,7 +778,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1291,7 +782,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
this.removePlayerFromDistanceMaps(player); // Paper - distance maps
@ -18519,7 +18519,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
}
@@ -1335,73 +826,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1339,73 +830,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerMap.unIgnorePlayer(player);
}
@ -18603,7 +18603,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
public void addEntity(Entity entity) {
@@ -1465,13 +913,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1469,13 +917,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick() {
@ -18618,7 +18618,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
@@ -1580,16 +1022,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1584,16 +1026,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void waitForLightBeforeSending(ChunkPos centerPos, int radius) {
@ -18636,7 +18636,7 @@ index 5ae30cd3af88c4f4179a4dc0c94906cfbfb7ff29..5a653dffecd3877c84ac8197e1ef4b7b
}
private class ChunkDistanceManager extends DistanceManager {
@@ -1600,7 +1033,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1604,7 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Override
protected boolean isChunkToRemove(long pos) {
@ -21076,10 +21076,10 @@ index b6a3c75b84d9f768afee33aa0f226207b307c1c0..2ec2b1d9d987c7f31c685aec3d3c87f4
<T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5..796c7ecedbf7a82697598918d484d80635fb16a8 100644
index aa22d4024cdd0ecb1c0442ecdeae00822597362e..d3a7de8d3fd92d36d3df257cae5686fc7f61d3c3 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -456,6 +456,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -463,6 +463,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
@ -21091,7 +21091,7 @@ index 6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5..796c7ecedbf7a82697598918d484d806
}
if ((i & 1) != 0) {
@@ -816,7 +821,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -823,7 +828,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.capturedTileEntities.get(blockposition);
}
// CraftBukkit end
@ -21100,7 +21100,7 @@ index 6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5..796c7ecedbf7a82697598918d484d806
}
public void setBlockEntity(BlockEntity blockEntity) {
@@ -907,26 +912,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -914,26 +919,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
@ -21128,7 +21128,7 @@ index 6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5..796c7ecedbf7a82697598918d484d806
return list;
}
@@ -944,34 +930,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -951,34 +937,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
this.getProfiler().incrementCounter("getEntities");
@ -21179,7 +21179,7 @@ index 6dbc4c74b4d6b8e6c4763366e70ca9292b4a25d5..796c7ecedbf7a82697598918d484d806
}
@Nullable
@@ -1243,4 +1218,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1250,4 +1225,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
private ExplosionInteraction() {}
}
@ -21333,7 +21333,7 @@ index 846ae3fd184a1d63b743aa25e045604576697c96..a907b79fd8291a0e92db138f37239d17
public int getIndex() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403df20aae96 100644
index 3e51fb9fe05d5b974ae41ccc0acbb516a07c114b..a664126bbcd29026e9d6770e362aa04c2c0b3fc8 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -83,6 +83,7 @@ public class LevelChunk extends ChunkAccess {
@ -21344,7 +21344,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
public LevelChunk(Level world, ChunkPos pos) {
this(world, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, (LevelChunkSection[]) null, (LevelChunk.PostLoadProcessor) null, (BlendingData) null);
@@ -656,9 +657,26 @@ public class LevelChunk extends ChunkAccess {
@@ -673,9 +674,26 @@ public class LevelChunk extends ChunkAccess {
}
@ -21374,7 +21374,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
int chunkX = this.chunkPos.x;
int chunkZ = this.chunkPos.z;
net.minecraft.server.level.ServerChunkCache chunkProvider = this.level.getChunkSource();
@@ -673,10 +691,55 @@ public class LevelChunk extends ChunkAccess {
@@ -690,10 +708,55 @@ public class LevelChunk extends ChunkAccess {
}
}
this.setNeighbourLoaded(0, 0, this);
@ -21432,7 +21432,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
@@ -685,6 +748,7 @@ public class LevelChunk extends ChunkAccess {
@@ -702,6 +765,7 @@ public class LevelChunk extends ChunkAccess {
*/
org.bukkit.Chunk bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
@ -21440,7 +21440,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
if (this.needsDecoration) {
try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
@@ -713,9 +777,11 @@ public class LevelChunk extends ChunkAccess {
@@ -730,9 +794,11 @@ public class LevelChunk extends ChunkAccess {
}
public void unloadCallback() {
@ -21453,7 +21453,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk();
@@ -737,9 +803,26 @@ public class LevelChunk extends ChunkAccess {
@@ -754,9 +820,26 @@ public class LevelChunk extends ChunkAccess {
// Paper end
}
@ -21481,7 +21481,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
}
// CraftBukkit end
@@ -808,7 +891,9 @@ public class LevelChunk extends ChunkAccess {
@@ -825,7 +908,9 @@ public class LevelChunk extends ChunkAccess {
return this.blockEntities;
}
@ -21491,7 +21491,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
ChunkPos chunkcoordintpair = this.getPos();
for (int i = 0; i < this.postProcessing.length; ++i) {
@@ -829,6 +914,7 @@ public class LevelChunk extends ChunkAccess {
@@ -846,6 +931,7 @@ public class LevelChunk extends ChunkAccess {
BlockState iblockdata1 = Block.updateFromNeighbourShapes(iblockdata, this.level, blockposition);
this.level.setBlock(blockposition, iblockdata1, 20);
@ -21499,7 +21499,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
}
}
@@ -846,6 +932,10 @@ public class LevelChunk extends ChunkAccess {
@@ -863,6 +949,10 @@ public class LevelChunk extends ChunkAccess {
this.pendingBlockEntities.clear();
this.upgradeData.upgrade(this);
@ -21510,7 +21510,7 @@ index 17725dba7cbcdce00cd23c3956eaf1642d9c424f..6fb729809dffc1c0ab6957a127f8403d
}
@Nullable
@@ -895,7 +985,7 @@ public class LevelChunk extends ChunkAccess {
@@ -912,7 +1002,7 @@ public class LevelChunk extends ChunkAccess {
}
public FullChunkStatus getFullStatus() {
@ -22959,10 +22959,10 @@ index 440660dfa70d57e94ae4eef1dce783aee5034f7e..187eda2dd40785eb09528c86718d6b4f
+ // Paper end
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index e01ef22189ce80429eb0054e416547577fd3cc5d..47e7fd7baf3ec6ed3ec9b5e6d73ed8611c2b1ce1 100644
index a5da6c1cae0afbde684be250e2fc3c0c32a1265b..a5ab3e1d52ff68730a4b9069e6d25a3d31c25da5 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -132,7 +132,13 @@ public class ActivationRange
@@ -135,7 +135,13 @@ public class ActivationRange
ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, 256, animalActivationRange );
ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, 256, monsterActivationRange );

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e4f8318efc90f37aa478122865d0383d39896603..e68e6b5df3606cee5a14a00c5451963191ac2cd8 100644
index 6818173e3f798b4d89a17c6934020cc929ec5e4e..5315def7ff7ba0be6c09be86453284f3aed29576 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -732,11 +732,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -739,11 +739,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try {
tickConsumer.accept(entity);
} catch (Throwable throwable) {
@ -44,10 +44,10 @@ index b300d12e9e00519028b53aca9c3fb01f589eaa91..63acd109a79ed752a05df3d4f1b99309
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 6fb729809dffc1c0ab6957a127f8403df20aae96..db3ee1f1d8429d3d646623877adc9f6920b7764f 100644
index a664126bbcd29026e9d6770e362aa04c2c0b3fc8..92ae6e100cd70772dfc781bb630f41e94f0cdd06 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1142,11 +1142,11 @@ public class LevelChunk extends ChunkAccess {
@@ -1159,11 +1159,11 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Always tick falling blocks
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 47e7fd7baf3ec6ed3ec9b5e6d73ed8611c2b1ce1..e4efed4e50188b71ff30238b3517a924b45b24b8 100644
index a5ab3e1d52ff68730a4b9069e6d25a3d31c25da5..2cb5bbe371333f566b4d6d3ee8016857986e9af0 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -89,6 +89,7 @@ public class ActivationRange
@@ -92,6 +92,7 @@ public class ActivationRange
|| entity instanceof AbstractHurtingProjectile
|| entity instanceof LightningBolt
|| entity instanceof PrimedTnt

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 989425423bb4dab3fe57ab9407bc0676675dada0..8be40065d6f0d53d5a264464fc4be208c7bad3a9 100644
index fcf3be628e5ee6155ebc4e73c24043731f2f7894..f7407f5204a2cbfcc46987d5e0a34770b2e5abbf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -705,9 +705,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -712,9 +712,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
boolean flag = this.tickRateManager().runsNormally();
int tilesThisCycle = 0;

View file

@ -88,7 +88,7 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..2b5b2869589991be37a4f128faabbff5
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 1b5eb2685c43804e5e4014ff1b70f52652be67f5..0032914a53154d11e2d36267771fd2da6d2f1d05 100644
index f7407f5204a2cbfcc46987d5e0a34770b2e5abbf..813a79866794bad9d0da105345641a6e9136ddf8 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1,5 +1,10 @@
@ -102,7 +102,7 @@ index 1b5eb2685c43804e5e4014ff1b70f52652be67f5..0032914a53154d11e2d36267771fd2da
import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import java.io.IOException;
@@ -734,6 +739,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -741,6 +746,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
@ -131,7 +131,7 @@ index 5d65baba605dd83e5f74d526aeda36d8ede8c014..604766a286d00bb4b40c20482376fe80
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index db3ee1f1d8429d3d646623877adc9f6920b7764f..7208b7b916ff179e8dbe9925fb246e3652b4f9c2 100644
index 92ae6e100cd70772dfc781bb630f41e94f0cdd06..40a829fa6b6410c2736af96ef1a46cf589056641 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,6 +1,7 @@
@ -142,7 +142,7 @@ index db3ee1f1d8429d3d646623877adc9f6920b7764f..7208b7b916ff179e8dbe9925fb246e36
import com.google.common.collect.Maps;
import com.google.common.collect.UnmodifiableIterator;
import com.mojang.logging.LogUtils;
@@ -564,10 +565,16 @@ public class LevelChunk extends ChunkAccess {
@@ -581,10 +582,16 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start
} else {
@ -163,7 +163,7 @@ index db3ee1f1d8429d3d646623877adc9f6920b7764f..7208b7b916ff179e8dbe9925fb246e36
// CraftBukkit end
}
}
@@ -1145,6 +1152,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1162,6 +1169,7 @@ public class LevelChunk extends ChunkAccess {
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0032914a53154d11e2d36267771fd2da6d2f1d05..85b1e406b856f3452fe44f909fa5475196f1cf58 100644
index 813a79866794bad9d0da105345641a6e9136ddf8..e8b2e1f45ecd13ac4bfc2c3eb09f2d397b997b78 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -345,6 +345,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -352,6 +352,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition);
}

View file

@ -30,10 +30,10 @@ index 817e0ddc8821dd112fc5aa72bbbe11fdd1b56488..181a4e0e44cd05528c66ce87b653c33d
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunk(x, z, false);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 85b1e406b856f3452fe44f909fa5475196f1cf58..c6c8e76a2820b3bd4724344db5e6852a745e663a 100644
index e8b2e1f45ecd13ac4bfc2c3eb09f2d397b997b78..f711a4ef9168e05c7d795a1a831c608b19cc989c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -499,7 +499,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -506,7 +506,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start
iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
CraftWorld world = ((ServerLevel) this).getWorld();

View file

@ -81,10 +81,10 @@ index 5bc68514a1e8a212e2681f06b918548c0ec565b6..1977e702f6af39ebf100c1f2f2edc2d1
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 28ff413396312df9de73805e06da70a6fc0e8201..7f0db74c7a247d313c33bafb0ec773ae8f4f3959 100644
index d57235720e701f765dffeafaad644cf2d7207d28..945c620d9ab369d798d1abb03ad8fa4eb02cfb5a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1282,4 +1282,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1289,4 +1289,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return ret;
}
// Paper end

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7f0db74c7a247d313c33bafb0ec773ae8f4f3959..537d532a2663a0f0384a4af1ffe008dfa395cb38 100644
index 945c620d9ab369d798d1abb03ad8fa4eb02cfb5a..b25505d7053aa6cbe8e2c10e27d9c810dd7c9529 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -346,6 +346,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -353,6 +353,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return chunk == null ? null : chunk.getFluidState(blockposition);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: Block entity unload lag spike
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 4e1b8ce73f07b8ea12f9f2b7883cd994aed73648..0e837193b5b858d0be30974c7454cf76920d58e9 100644
index 4e55288250fdefcd55d98f94b58ce8c2411fe1b4..6e3b4a0ace95331e318ce587cb3e03670a1f5c9d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -732,6 +732,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -739,6 +739,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
boolean flag = this.tickRateManager().runsNormally();
int tilesThisCycle = 0;
@ -17,7 +17,7 @@ index 4e1b8ce73f07b8ea12f9f2b7883cd994aed73648..0e837193b5b858d0be30974c7454cf76
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
@@ -740,12 +742,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -747,12 +749,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity.isRemoved()) {
// Spigot start
tilesThisCycle--;

View file

@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0e837193b5b858d0be30974c7454cf76920d58e9..a349755740483148dcdc8d490943fdce74aa4434 100644
index 6e3b4a0ace95331e318ce587cb3e03670a1f5c9d..9d2cf866cf4f0c93dea028e3673d9a51615059af 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -157,7 +157,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -30,7 +30,7 @@ index 0e837193b5b858d0be30974c7454cf76920d58e9..a349755740483148dcdc8d490943fdce
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
@@ -388,7 +388,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -395,7 +395,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -39,7 +39,7 @@ index 0e837193b5b858d0be30974c7454cf76920d58e9..a349755740483148dcdc8d490943fdce
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
this.capturedBlockStates.put(pos.immutable(), blockstate);
@@ -408,7 +408,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -415,7 +415,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit start - capture blockstates
boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) {
@ -49,7 +49,7 @@ index 0e837193b5b858d0be30974c7454cf76920d58e9..a349755740483148dcdc8d490943fdce
this.capturedBlockStates.put(pos.immutable(), blockstate);
captured = true;
}
@@ -614,7 +615,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -621,7 +622,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockState getBlockState(BlockPos pos) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {

View file

@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..422ef83670f7c4a2e5b0da48dc0906ad96b8ece0 100644
index 2a52f5fc867f35b9d94b813d5cdd92249c60ee8b..b2d679ba18e5f095d1c3e0249022fc564b1a553e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -700,7 +700,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -704,7 +704,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
@ -23,7 +23,7 @@ index 5a653dffecd3877c84ac8197e1ef4b7bbc9820ce..422ef83670f7c4a2e5b0da48dc0906ad
// Spigot end
if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) {
return false;
@@ -715,6 +717,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -719,6 +721,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
entityplayer = (ServerPlayer) iterator.next();

View file

@ -17,10 +17,10 @@ index d04d0b9cbf91beb57da7e37e72f8e7c98cf6cf4c..e6e3a7ae08f7346ccbce02b9d3623948
Iterator iterator = list.iterator();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a349755740483148dcdc8d490943fdce74aa4434..9cd032be21a5239a268d41fa2d3db0f7ee2680fd 100644
index 9d2cf866cf4f0c93dea028e3673d9a51615059af..232dfdb70e31485969a972bfad53762edacf8549 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -770,6 +770,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -777,6 +777,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
}
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 422ef83670f7c4a2e5b0da48dc0906ad96b8ece0..e4936a70d3a686e5cba0ea9d878f6e09fbee713d 100644
index b2d679ba18e5f095d1c3e0249022fc564b1a553e..304e3c177488773d488e5b82f65a7c16a3750a29 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -878,6 +878,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -882,6 +882,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
@ -16,7 +16,7 @@ index 422ef83670f7c4a2e5b0da48dc0906ad96b8ece0..e4936a70d3a686e5cba0ea9d878f6e09
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
@@ -920,7 +921,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -924,7 +925,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
}

View file

@ -11,7 +11,7 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 2a849e7125e2a6294aab49a436eeab8e4201fd15..a5bdbf62bdeb9fd505699a92701f9ed4724b6c85 100644
index 097f4e01dc9dc391ea96e2f36f18f6575e344346..91f2bb15e2eea792f205f04422655fc7d80a6da2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -31,6 +31,7 @@ import net.minecraft.nbt.CompoundTag;
@ -22,7 +22,7 @@ index 2a849e7125e2a6294aab49a436eeab8e4201fd15..a5bdbf62bdeb9fd505699a92701f9ed4
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
@@ -584,9 +585,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -591,9 +592,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return false;
} else {
FluidState fluid = this.getFluidState(pos);

View file

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a5bdbf62bdeb9fd505699a92701f9ed4724b6c85..e51f4df5b6fcd28e681a77a1aa3a9eeb0c463e1a 100644
index 91f2bb15e2eea792f205f04422655fc7d80a6da2..ee237d0e57cbb9b8fe2ae3c84fa7d7a964ad73b9 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -913,9 +913,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -920,9 +920,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {

View file

@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e4936a70d3a686e5cba0ea9d878f6e09fbee713d..2e6ff171ea9ca9159509e1bbd59f076b63c92776 100644
index 304e3c177488773d488e5b82f65a7c16a3750a29..1ce59bd654cf4cb68d510b0f6a8d1a72d2761bf7 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -533,6 +533,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -537,6 +537,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.discard();
needsRemoval = true;
}
@ -44,7 +44,7 @@ index e4936a70d3a686e5cba0ea9d878f6e09fbee713d..2e6ff171ea9ca9159509e1bbd59f076b
return !needsRemoval;
}), position); // Paper - rewrite chunk system
// CraftBukkit end
@@ -544,6 +545,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -548,6 +549,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
throw new UnsupportedOperationException(); // Paper - rewrite chunk system
}

View file

@ -28,10 +28,10 @@ index 9badb48b6004c5799132ed70ddcc767bdd72510c..7d12bedc4b80b9bcf50f468a9204191b
float f1 = 0.98F;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index e4efed4e50188b71ff30238b3517a924b45b24b8..d5374072a97f791964033d107f023b3cc657b343 100644
index 2cb5bbe371333f566b4d6d3ee8016857986e9af0..f60eb4bf10c32d2d92fa24992ed20525f0f0f781 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -257,7 +257,7 @@ public class ActivationRange
@@ -260,7 +260,7 @@ public class ActivationRange
isActive = true;
}
// Add a little performance juice to active entities. Skip 1/4 if not immune.

View file

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 2e6ff171ea9ca9159509e1bbd59f076b63c92776..4b11a14bd6ba6d90c93db1e5733120bb319c9a48 100644
index 1ce59bd654cf4cb68d510b0f6a8d1a72d2761bf7..c96b20cdd87596b6ff73478d262acdf22361858b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1199,6 +1199,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1203,6 +1203,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;

View file

@ -3,6 +3,8 @@ From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 8 Feb 2020 23:26:11 -0600
Subject: [PATCH] Entity Jump API
== AT ==
public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e06aa636bf4e18ca2810e0626f427839cd2bce88..bc51c6d8b39907d89a4f65cd7a8266df1fceab8c 100644

View file

@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 31d2de67d3facf00491814f775ef1468b33eb51b..749a056c17efb0788ac671d536658fc84b105ff2 100644
index a086e14729fbc3a7ad40807828a23594d41dabfb..673da3c93291c70ed83b1a06a068e4854fc4d32b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -360,18 +360,20 @@ public class LevelChunk extends ChunkAccess {
@@ -377,18 +377,20 @@ public class LevelChunk extends ChunkAccess {
}
public FluidState getFluidState(int x, int y, int z) {
@ -38,7 +38,7 @@ index 31d2de67d3facf00491814f775ef1468b33eb51b..749a056c17efb0788ac671d536658fc8
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@@ -381,6 +383,7 @@ public class LevelChunk extends ChunkAccess {
@@ -398,6 +400,7 @@ public class LevelChunk extends ChunkAccess {
});
throw new ReportedException(crashreport);
}
@ -47,7 +47,7 @@ index 31d2de67d3facf00491814f775ef1468b33eb51b..749a056c17efb0788ac671d536658fc8
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index d59392c322936ce89b759ac9787c8f4f0b228af6..ea2fb64ff15af1cbb7b3f59386fb7a40f54e9b4f 100644
index 2d6daf76a56574c9727b404feb4f86347f04cbae..b606e33f8b64eaba28c008cc353d88aa45549e31 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -43,7 +43,7 @@ public class LevelChunkSection {

View file

@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 4b11a14bd6ba6d90c93db1e5733120bb319c9a48..ad98c74dc6d032bedd01fffd9cdb6c8f8a267c7e 100644
index c96b20cdd87596b6ff73478d262acdf22361858b..397fcc5f3835418bb31998b0b0cdce9427a017a2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -905,6 +905,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -909,6 +909,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot

View file

@ -31,10 +31,10 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ad98c74dc6d032bedd01fffd9cdb6c8f8a267c7e..1ad4e5a0a4d236012c1dfb0dbffdacd0f134b72c 100644
index 397fcc5f3835418bb31998b0b0cdce9427a017a2..69d140fbcccc9054f15716e35a7b854b387fe21d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -912,6 +912,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -916,6 +916,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return;
}
// Paper end - ignore and warn about illegal addEntity calls instead of crashing server

View file

@ -609,10 +609,10 @@ index e697b8f7b165d2394d8155cbee7453e23ac2bee4..6706ac701963fed4798247e6e835b06f
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 749a056c17efb0788ac671d536658fc84b105ff2..90d6376f0441505a4c5f32d620827dfe233a5783 100644
index 673da3c93291c70ed83b1a06a068e4854fc4d32b..57d7392871634348ff906c03dc0ca601cd3040bd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -582,7 +582,7 @@ public class LevelChunk extends ChunkAccess {
@@ -599,7 +599,7 @@ public class LevelChunk extends ChunkAccess {
+ " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
"\nWorld: " + level.getLevel().dimension().location());

View file

@ -18,7 +18,7 @@ index 450f7c03bdcc109938ba9b66328bdbb2c96c03c9..c6241f858209ed662d8720217d143340
testImplementation("org.mockito:mockito-core:5.5.0")
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..5fb56067221434aa80e626437ed10f65bf416e4f
index 0000000000000000000000000000000000000000..8117578ced94aa6bf01871f6526a388385c4adf2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -0,0 +1,376 @@
@ -311,10 +311,10 @@ index 0000000000000000000000000000000000000000..5fb56067221434aa80e626437ed10f65
+ return deobfuscationMap.getOrDefault(name, name);
+ }
+
+ public static EnumSet<GoalType> vanillaToPaper(OptimizedSmallEnumSet<Goal.Flag> types) {
+ public static EnumSet<GoalType> vanillaToPaper(Goal goal) {
+ EnumSet<GoalType> goals = EnumSet.noneOf(GoalType.class);
+ for (GoalType type : GoalType.values()) {
+ if (types.hasElement(paperToVanilla(type))) {
+ if (goal.getFlags().contains(paperToVanilla(type))) {
+ goals.add(type);
+ }
+ }
@ -400,7 +400,7 @@ index 0000000000000000000000000000000000000000..5fb56067221434aa80e626437ed10f65
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java
new file mode 100644
index 0000000000000000000000000000000000000000..26c745dd9ccdfdd5c5039f2acc5201b9b91fb274
index 0000000000000000000000000000000000000000..b5f75ad725f5933db8f0688b2c0b27d620919241
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperCustomGoal.java
@@ -0,0 +1,53 @@
@ -420,7 +420,7 @@ index 0000000000000000000000000000000000000000..26c745dd9ccdfdd5c5039f2acc5201b9
+
+ this.setFlags(MobGoalHelper.paperToVanilla(handle.getTypes()));
+ if (this.getFlags().size() == 0) {
+ this.getFlags().addUnchecked(Flag.UNKNOWN_BEHAVIOR);
+ this.getFlags().add(Flag.UNKNOWN_BEHAVIOR);
+ }
+ }
+
@ -459,7 +459,7 @@ index 0000000000000000000000000000000000000000..26c745dd9ccdfdd5c5039f2acc5201b9
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java
new file mode 100644
index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7605a3484
index 0000000000000000000000000000000000000000..953b0f88cbf0e73c390f8086344f772ac03192bb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperMobGoals.java
@@ -0,0 +1,213 @@
@ -574,7 +574,7 @@ index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7
+ CraftMob craftMob = (CraftMob) mob;
+ Set<Goal<T>> goals = new HashSet<>();
+ for (WrappedGoal item : getHandle(craftMob, type).getAvailableGoals()) {
+ if (!item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ if (!item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
+
@ -597,7 +597,7 @@ index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7
+ continue;
+ }
+ for (WrappedGoal item : getHandle(craftMob, internalType).getAvailableGoals()) {
+ if (item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type))) {
+ if (item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type))) {
+ continue;
+ }
+
@ -626,7 +626,7 @@ index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7
+ CraftMob craftMob = (CraftMob) mob;
+ Set<Goal<T>> goals = new HashSet<>();
+ getHandle(craftMob, type).getRunningGoals()
+ .filter(item -> item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type)))
+ .filter(item -> item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
+ .forEach(item -> {
+ if (item.getGoal() instanceof PaperCustomGoal) {
+ //noinspection unchecked
@ -647,7 +647,7 @@ index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7
+ continue;
+ }
+ getHandle(craftMob, internalType).getRunningGoals()
+ .filter(item -> !item.getGoal().getFlags().hasElement(MobGoalHelper.paperToVanilla(type)))
+ .filter(item -> !item.getGoal().getFlags().contains(MobGoalHelper.paperToVanilla(type)))
+ .forEach(item -> {
+ if (item.getGoal() instanceof PaperCustomGoal) {
+ //noinspection unchecked
@ -678,7 +678,7 @@ index 0000000000000000000000000000000000000000..5e7b4a8698a00f72d6e817cc7c6716e7
+}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d30e0b21b9024df939a9d070bd4a99b217e7c12
index 0000000000000000000000000000000000000000..b5c594a5499556ad452d9939c75e150af8252e90
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/PaperVanillaGoal.java
@@ -0,0 +1,61 @@
@ -701,7 +701,7 @@ index 0000000000000000000000000000000000000000..0d30e0b21b9024df939a9d070bd4a99b
+ public PaperVanillaGoal(Goal handle) {
+ this.handle = handle;
+ this.key = MobGoalHelper.getKey(handle.getClass());
+ this.types = MobGoalHelper.vanillaToPaper(handle.getFlags());
+ this.types = MobGoalHelper.vanillaToPaper(handle);
+ }
+
+ public Goal getHandle() {

Some files were not shown because too many files have changed in this diff Show more