More more more more more more more patches

This commit is contained in:
Nassim Jahnke 2022-06-08 12:20:57 +02:00
parent 0e06c77264
commit f0e575f445
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
42 changed files with 201 additions and 201 deletions

View File

@ -30,12 +30,14 @@ This patch also specifically optimises other areas of code to
use PoiAccess. For example, some villager AI and portaling code use PoiAccess. For example, some villager AI and portaling code
had to be specifically modified. had to be specifically modified.
TODO: See two still conflicting hunks and two TODOs
diff --git a/src/main/java/io/papermc/paper/util/PoiAccess.java b/src/main/java/io/papermc/paper/util/PoiAccess.java diff --git a/src/main/java/io/papermc/paper/util/PoiAccess.java b/src/main/java/io/papermc/paper/util/PoiAccess.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b3b8b3280 index 0000000000000000000000000000000000000000..a2ea0ec9e25c0c1fc95ac5376d4ed2f6884e14df
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/util/PoiAccess.java +++ b/src/main/java/io/papermc/paper/util/PoiAccess.java
@@ -0,0 +1,748 @@ @@ -0,0 +1,749 @@
+package io.papermc.paper.util; +package io.papermc.paper.util;
+ +
+import it.unimi.dsi.fastutil.doubles.Double2ObjectMap; +import it.unimi.dsi.fastutil.doubles.Double2ObjectMap;
@ -43,6 +45,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue; +import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue;
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockPos;
+import net.minecraft.core.Holder;
+import net.minecraft.util.Mth; +import net.minecraft.util.Mth;
+import net.minecraft.world.entity.ai.village.poi.PoiManager; +import net.minecraft.world.entity.ai.village.poi.PoiManager;
+import net.minecraft.world.entity.ai.village.poi.PoiRecord; +import net.minecraft.world.entity.ai.village.poi.PoiRecord;
@ -114,7 +117,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ // only includes x/z axis + // only includes x/z axis
+ // finds the closest poi data by distance. + // finds the closest poi data by distance.
+ public static BlockPos findClosestPoiDataPosition(final PoiManager poiStorage, + public static BlockPos findClosestPoiDataPosition(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -132,7 +135,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ // only includes x/z axis + // only includes x/z axis
+ // finds the closest poi data by distance. if multiple match the same distance, then they all are returned. + // finds the closest poi data by distance. if multiple match the same distance, then they all are returned.
+ public static void findClosestPoiDataPositions(final PoiManager poiStorage, + public static void findClosestPoiDataPositions(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -163,7 +166,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ // only includes x/z axis + // only includes x/z axis
+ // finds the closest poi data by distance. + // finds the closest poi data by distance.
+ public static PoiRecord findClosestPoiDataRecord(final PoiManager poiStorage, + public static PoiRecord findClosestPoiDataRecord(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -181,7 +184,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ // only includes x/z axis + // only includes x/z axis
+ // finds the closest poi data by distance. if multiple match the same distance, then they all are returned. + // finds the closest poi data by distance. if multiple match the same distance, then they all are returned.
+ public static void findClosestPoiDataRecords(final PoiManager poiStorage, + public static void findClosestPoiDataRecords(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -264,13 +267,13 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ final PoiSection poiSection = poiSectionOptional.orElse(null); + final PoiSection poiSection = poiSectionOptional.orElse(null);
+ +
+ final Map<PoiType, Set<PoiRecord>> sectionData = poiSection.getData(); + final Map<Holder<PoiType>, Set<PoiRecord>> sectionData = poiSection.getData();
+ if (sectionData.isEmpty()) { + if (sectionData.isEmpty()) {
+ continue; + continue;
+ } + }
+ +
+ // now we search the section data + // now we search the section data
+ for (final Map.Entry<PoiType, Set<PoiRecord>> entry : sectionData.entrySet()) { + for (final Map.Entry<Holder<PoiType>, Set<PoiRecord>> entry : sectionData.entrySet()) {
+ if (!villagePlaceType.test(entry.getKey())) { + if (!villagePlaceType.test(entry.getKey())) {
+ // filter out by poi type + // filter out by poi type
+ continue; + continue;
@ -355,7 +358,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ // finds the closest poi entry pos. + // finds the closest poi entry pos.
+ public static BlockPos findNearestPoiPosition(final PoiManager poiStorage, + public static BlockPos findNearestPoiPosition(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -371,7 +374,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ // finds the closest `max` poi entry positions. + // finds the closest `max` poi entry positions.
+ public static void findNearestPoiPositions(final PoiManager poiStorage, + public static void findNearestPoiPositions(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -402,7 +405,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ // finds the closest poi entry. + // finds the closest poi entry.
+ public static PoiRecord findNearestPoiRecord(final PoiManager poiStorage, + public static PoiRecord findNearestPoiRecord(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -420,7 +423,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ // finds the closest `max` poi entries. + // finds the closest `max` poi entries.
+ public static void findNearestPoiRecords(final PoiManager poiStorage, + public static void findNearestPoiRecords(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ // position predicate must not modify chunk POI + // position predicate must not modify chunk POI
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
@ -507,13 +510,13 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ +
+ final PoiSection poiSection = poiSectionOptional.orElse(null); + final PoiSection poiSection = poiSectionOptional.orElse(null);
+ +
+ final Map<PoiType, Set<PoiRecord>> sectionData = poiSection.getData(); + final Map<Holder<PoiType>, Set<PoiRecord>> sectionData = poiSection.getData();
+ if (sectionData.isEmpty()) { + if (sectionData.isEmpty()) {
+ continue; + continue;
+ } + }
+ +
+ // now we search the section data + // now we search the section data
+ for (final Map.Entry<PoiType, Set<PoiRecord>> entry : sectionData.entrySet()) { + for (final Map.Entry<Holder<PoiType>, Set<PoiRecord>> entry : sectionData.entrySet()) {
+ if (!villagePlaceType.test(entry.getKey())) { + if (!villagePlaceType.test(entry.getKey())) {
+ // filter out by poi type + // filter out by poi type
+ continue; + continue;
@ -641,7 +644,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ } + }
+ +
+ public static BlockPos findAnyPoiPosition(final PoiManager poiStorage, + public static BlockPos findAnyPoiPosition(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
+ final int range, // distance on x y z axis + final int range, // distance on x y z axis
@ -655,7 +658,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ } + }
+ +
+ public static void findAnyPoiPositions(final PoiManager poiStorage, + public static void findAnyPoiPositions(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
+ final int range, // distance on x y z axis + final int range, // distance on x y z axis
@ -683,7 +686,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ } + }
+ +
+ public static PoiRecord findAnyPoiRecord(final PoiManager poiStorage, + public static PoiRecord findAnyPoiRecord(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
+ final int range, // distance on x y z axis + final int range, // distance on x y z axis
@ -695,7 +698,7 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ } + }
+ +
+ public static void findAnyPoiRecords(final PoiManager poiStorage, + public static void findAnyPoiRecords(final PoiManager poiStorage,
+ final Predicate<PoiType> villagePlaceType, + final Predicate<Holder<PoiType>> villagePlaceType,
+ final Predicate<BlockPos> positionPredicate, + final Predicate<BlockPos> positionPredicate,
+ final BlockPos sourcePosition, + final BlockPos sourcePosition,
+ final int range, // distance on x y z axis + final int range, // distance on x y z axis
@ -731,13 +734,13 @@ index 0000000000000000000000000000000000000000..0a88c60161b04a733151c15046358f4b
+ continue; + continue;
+ } + }
+ +
+ final Map<PoiType, Set<PoiRecord>> sectionData = poiSection.getData(); + final Map<Holder<PoiType>, Set<PoiRecord>> sectionData = poiSection.getData();
+ if (sectionData.isEmpty()) { + if (sectionData.isEmpty()) {
+ continue; + continue;
+ } + }
+ +
+ // now we search the section data + // now we search the section data
+ for (final Map.Entry<PoiType, Set<PoiRecord>> entry : sectionData.entrySet()) { + for (final Map.Entry<Holder<PoiType>, Set<PoiRecord>> entry : sectionData.entrySet()) {
+ if (!villagePlaceType.test(entry.getKey())) { + if (!villagePlaceType.test(entry.getKey())) {
+ // filter out by poi type + // filter out by poi type
+ continue; + continue;
@ -821,30 +824,30 @@ index 0eea3e39616e40e15d1662b973c097cda3b2cee7..3ccc1421f4a5a08dadb9fe3c9fa3ac31
BlockPos blockPos = path.getTarget(); BlockPos blockPos = path.getTarget();
Optional<PoiType> optional = poiManager.getType(blockPos); Optional<PoiType> optional = poiManager.getType(blockPos);
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 4a972b26242cf4c9d7e8f655cb1264cddad5f143..8a569e3300543cb171c3befae59969628adc424c 100644 index ab9bb440c8e91ecb49c1e14a427d35087a87ac80..96708500deb6cda561bad81956cfb8619a066ae0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -37,7 +37,7 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -40,7 +40,7 @@ public class PoiManager extends SectionStorage<PoiSection> {
public static final int VILLAGE_SECTION_SIZE = 1; public static final int VILLAGE_SECTION_SIZE = 1;
private final PoiManager.DistanceTracker distanceTracker; private final PoiManager.DistanceTracker distanceTracker;
private final LongSet loadedChunks = new LongOpenHashSet(); private final LongSet loadedChunks = new LongOpenHashSet();
- private final net.minecraft.server.level.ServerLevel world; // Paper - private final net.minecraft.server.level.ServerLevel world; // Paper
+ public final net.minecraft.server.level.ServerLevel world; // Paper // Paper public + public final net.minecraft.server.level.ServerLevel world; // Paper // Paper public
public PoiManager(Path path, DataFixer dataFixer, boolean dsync, LevelHeightAccessor world) { public PoiManager(Path path, DataFixer dataFixer, boolean dsync, RegistryAccess registryManager, LevelHeightAccessor world) {
super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, world); super(path, PoiSection::codec, PoiSection::new, dataFixer, DataFixTypes.POI_CHUNK, dsync, registryManager, world);
@@ -100,36 +100,55 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -113,16 +113,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
} }
public Optional<BlockPos> find(Predicate<PoiType> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { public Optional<BlockPos> find(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
- return this.findAll(typePredicate, posPredicate, pos, radius, occupationStatus).findFirst(); - return this.findAll(typePredicate, posPredicate, pos, radius, occupationStatus).findFirst();
+ // Paper start - re-route to faster logic + // Paper start - re-route to faster logic
+ BlockPos ret = io.papermc.paper.util.PoiAccess.findAnyPoiPosition(this, typePredicate, posPredicate, pos, radius, occupationStatus, false); + BlockPos ret = io.papermc.paper.util.PoiAccess.findAnyPoiPosition(this, typePredicate, posPredicate, pos, radius, occupationStatus, false);
+ return Optional.ofNullable(ret); + return Optional.ofNullable(ret);
+ // Paper end - re-route to faster logic + // Paper end
} }
public Optional<BlockPos> findClosest(Predicate<PoiType> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).min(Comparator.comparingDouble((blockPos2) -> { - return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).min(Comparator.comparingDouble((blockPos2) -> {
- return blockPos2.distSqr(pos); - return blockPos2.distSqr(pos);
- })); - }));
@ -854,7 +857,15 @@ index 4a972b26242cf4c9d7e8f655cb1264cddad5f143..8a569e3300543cb171c3befae5996962
+ // Paper end - re-route to faster logic + // Paper end - re-route to faster logic
} }
public Optional<BlockPos> findClosest(Predicate<PoiType> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { public Optional<Pair<Holder<PoiType>, BlockPos>> findClosestWithType(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
+ //TODO re-route to faster logic
return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble((poi) -> {
return poi.getPos().distSqr(pos);
})).map((poi) -> {
@@ -131,12 +136,14 @@ public class PoiManager extends SectionStorage<PoiSection> {
}
public Optional<BlockPos> findClosest(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).filter(posPredicate).min(Comparator.comparingDouble((blockPos2) -> { - return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).filter(posPredicate).min(Comparator.comparingDouble((blockPos2) -> {
- return blockPos2.distSqr(pos); - return blockPos2.distSqr(pos);
- })); - }));
@ -864,28 +875,16 @@ index 4a972b26242cf4c9d7e8f655cb1264cddad5f143..8a569e3300543cb171c3befae5996962
+ // Paper end - re-route to faster logic + // Paper end - re-route to faster logic
} }
public Optional<BlockPos> take(Predicate<PoiType> typePredicate, Predicate<BlockPos> positionPredicate, BlockPos pos, int radius) { public Optional<BlockPos> take(Predicate<Holder<PoiType>> typePredicate, BiPredicate<Holder<PoiType>, BlockPos> biPredicate, BlockPos pos, int radius) {
- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> { + //TODO re-route to faster logic
- return positionPredicate.test(poi.getPos()); return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> {
- }).findFirst().map((poi) -> { return biPredicate.test(poi.getPoiType(), poi.getPos());
- poi.acquireTicket(); }).findFirst().map((poi) -> {
- return poi.getPos(); @@ -146,10 +153,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
- });
+ // Paper start - re-route to faster logic
+ PoiRecord ret = io.papermc.paper.util.PoiAccess.findAnyPoiRecord(
+ this, typePredicate, positionPredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE, false
+ );
+ if (ret == null) {
+ return Optional.empty();
+ }
+ ret.acquireTicket();
+ return Optional.of(ret.getPos());
+ // Paper end - re-route to faster logic
} }
public Optional<BlockPos> getRandom(Predicate<PoiType> typePredicate, Predicate<BlockPos> positionPredicate, PoiManager.Occupancy occupationStatus, BlockPos pos, int radius, Random random) { public Optional<BlockPos> getRandom(Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> positionPredicate, PoiManager.Occupancy occupationStatus, BlockPos pos, int radius, RandomSource random) {
- List<PoiRecord> list = this.getInRange(typePredicate, pos, radius, occupationStatus).collect(Collectors.toList()); - List<PoiRecord> list = Util.toShuffledList(this.getInRange(typePredicate, pos, radius, occupationStatus), random);
- Collections.shuffle(list, random);
- return list.stream().filter((poi) -> { - return list.stream().filter((poi) -> {
- return positionPredicate.test(poi.getPos()); - return positionPredicate.test(poi.getPos());
- }).findFirst().map(PoiRecord::getPos); - }).findFirst().map(PoiRecord::getPos);
@ -908,23 +907,23 @@ index 4a972b26242cf4c9d7e8f655cb1264cddad5f143..8a569e3300543cb171c3befae5996962
public boolean release(BlockPos pos) { public boolean release(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
index 3959eeb9090e8e4c999d89ec32fac8c46d5cdc75..4d71c4a43d6624d4292e9902ee8dad5fd4d9b8fb 100644 index bb2be6eea7a0cff4cc70bd43738b1ce213e43558..b71a4027a0eed467a3707c59315092ddecfd6bf3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
@@ -25,7 +25,7 @@ import org.slf4j.Logger; @@ -26,7 +26,7 @@ import org.slf4j.Logger;
public class PoiSection { public class PoiSection {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
private final Short2ObjectMap<PoiRecord> records = new Short2ObjectOpenHashMap<>(); private final Short2ObjectMap<PoiRecord> records = new Short2ObjectOpenHashMap<>();
- private final Map<PoiType, Set<PoiRecord>> byType = Maps.newHashMap(); - private final Map<Holder<PoiType>, Set<PoiRecord>> byType = Maps.newHashMap();
+ private final Map<PoiType, Set<PoiRecord>> byType = Maps.newHashMap(); public final Map<PoiType, Set<PoiRecord>> getData() { return this.byType; } // Paper - public accessor + private final Map<Holder<PoiType>, Set<PoiRecord>> byType = Maps.newHashMap(); public final Map<Holder<PoiType>, Set<PoiRecord>> getData() { return this.byType; } // Paper - public accessor
private final Runnable setDirty; private final Runnable setDirty;
private boolean isValid; private boolean isValid;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
index 3e08ff74979c78b27537403bbcaf13459e9e06b1..c4bb280aef31c14e71337db0d6dbc5f06d9b9730 100644 index 80a7a1340908ae783a029912487485f7596bec5b..83d41596e53b3bd2e983561688c49399bdaa2095 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
@@ -65,11 +65,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl @@ -71,11 +71,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
} }
@Nullable @Nullable
@ -939,7 +938,7 @@ index 3e08ff74979c78b27537403bbcaf13459e9e06b1..c4bb280aef31c14e71337db0d6dbc5f0
return Optional.empty(); return Optional.empty();
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index ed79058696eb26a89b9d4116821840dbad9ea449..8f147cd9798779eb2a72f444bf7fcb6c3cdc4971 100644 index 504f5d98d4a3d6b5bbd0998b495196aa6b39f47a..436f31ab1450bb087e00bed2c6acd8d8833e0598 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -51,18 +51,41 @@ public class PortalForcer { @@ -51,18 +51,41 @@ public class PortalForcer {
@ -947,8 +946,8 @@ index ed79058696eb26a89b9d4116821840dbad9ea449..8f147cd9798779eb2a72f444bf7fcb6c
// CraftBukkit end // CraftBukkit end
- villageplace.ensureLoadedAndValid(this.level, blockposition, i); - villageplace.ensureLoadedAndValid(this.level, blockposition, i);
- Optional<PoiRecord> optional = villageplace.getInSquare((villageplacetype) -> { - Optional<PoiRecord> optional = villageplace.getInSquare((holder) -> {
- return villageplacetype == PoiType.NETHER_PORTAL; - return holder.is(PoiTypes.NETHER_PORTAL);
- }, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> { - }, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> {
- return worldborder.isWithinBounds(villageplacerecord.getPos()); - return worldborder.isWithinBounds(villageplacerecord.getPos());
- }).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error - }).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error

View File

@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot. Combined, this adds up a lot.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b56fe14e7b7de95876ba2b1d084856d6935e591c..c4e679eca56ca756d2d7a9d2ffa2a56e5ab3f721 100644 index b56fe14e7b7de95876ba2b1d084856d6935e591c..4c3efab510e0041b00af9967226c711304862248 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -990,7 +990,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -961,7 +961,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
} }

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Added EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index dc192218aa2e325040dc2bf0f8586e1c1577e4c7..a61a309bb921deba8b8022bc4e9fd04c2f8eba63 100644 index 2f06f33a495f94e3bf8ab755db6320fab04bd767..d1938cf3e56c3a4fd8623349038d5f38dd3ea472 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -535,7 +535,7 @@ public final class ItemStack { @@ -549,7 +549,7 @@ public final class ItemStack {
return this.getItem().getMaxDamage(); return this.getItem().getMaxDamage();
} }
- public boolean hurt(int amount, Random random, @Nullable ServerPlayer player) { - public boolean hurt(int amount, RandomSource random, @Nullable ServerPlayer player) {
+ public boolean hurt(int amount, Random random, @Nullable LivingEntity player) { // Paper - allow any living entity instead of only ServerPlayers + public boolean hurt(int amount, RandomSource random, @Nullable LivingEntity player) { // Paper - allow any living entity instead of only ServerPlayers
if (!this.isDamageableItem()) { if (!this.isDamageableItem()) {
return false; return false;
} else { } else {
@@ -553,8 +553,8 @@ public final class ItemStack { @@ -567,8 +567,8 @@ public final class ItemStack {
amount -= k; amount -= k;
// CraftBukkit start // CraftBukkit start
@ -28,7 +28,7 @@ index dc192218aa2e325040dc2bf0f8586e1c1577e4c7..a61a309bb921deba8b8022bc4e9fd04c
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) { if (amount != event.getDamage() || event.isCancelled()) {
@@ -565,6 +565,14 @@ public final class ItemStack { @@ -579,6 +579,14 @@ public final class ItemStack {
} }
amount = event.getDamage(); amount = event.getDamage();
@ -43,7 +43,7 @@ index dc192218aa2e325040dc2bf0f8586e1c1577e4c7..a61a309bb921deba8b8022bc4e9fd04c
} }
// CraftBukkit end // CraftBukkit end
if (amount <= 0) { if (amount <= 0) {
@@ -572,8 +580,8 @@ public final class ItemStack { @@ -586,8 +594,8 @@ public final class ItemStack {
} }
} }
@ -54,7 +54,7 @@ index dc192218aa2e325040dc2bf0f8586e1c1577e4c7..a61a309bb921deba8b8022bc4e9fd04c
} }
j = this.getDamageValue() + amount; j = this.getDamageValue() + amount;
@@ -585,7 +593,7 @@ public final class ItemStack { @@ -599,7 +607,7 @@ public final class ItemStack {
public <T extends LivingEntity> void hurtAndBreak(int amount, T entity, Consumer<T> breakCallback) { public <T extends LivingEntity> void hurtAndBreak(int amount, T entity, Consumer<T> breakCallback) {
if (!entity.level.isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) { if (!entity.level.isClientSide && (!(entity instanceof net.minecraft.world.entity.player.Player) || !((net.minecraft.world.entity.player.Player) entity).getAbilities().instabuild)) {
if (this.isDamageableItem()) { if (this.isDamageableItem()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize indirect passenger iteration
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 468fffe6dbecbf276fbcac92a3345625b5218f34..d838e884564e2763a6918a1a778a91c84f498649 100644 index 27846c6b42602a6e23031f79b05ae832c6a76061..cef2315a03ec30889e8f73648749e45268d88203 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3508,26 +3508,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3559,26 +3559,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
private Stream<Entity> getIndirectPassengersStream() { private Stream<Entity> getIndirectPassengersStream() {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix block drops position losing precision millions of blocks
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 17c369b49272ac72119708b507e6fa119343706e..6b4cd795f23bd8d51dff5f2b72f588ca51404b99 100644 index 24556481bf72dae526eb0f13826d693d6516bfb4..5eff2180dba05c29fb0a653caea695fa1b50e0a0 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -344,9 +344,11 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -346,9 +346,11 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void popResource(Level world, BlockPos pos, ItemStack stack) { public static void popResource(Level world, BlockPos pos, ItemStack stack) {
float f = EntityType.ITEM.getHeight() / 2.0F; float f = EntityType.ITEM.getHeight() / 2.0F;
@ -24,7 +24,7 @@ index 17c369b49272ac72119708b507e6fa119343706e..6b4cd795f23bd8d51dff5f2b72f588ca
Block.popResource(world, () -> { Block.popResource(world, () -> {
return new ItemEntity(world, d0, d1, d2, stack); return new ItemEntity(world, d0, d1, d2, stack);
@@ -359,9 +361,11 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -361,9 +363,11 @@ public class Block extends BlockBehaviour implements ItemLike {
int k = direction.getStepZ(); int k = direction.getStepZ();
float f = EntityType.ITEM.getWidth() / 2.0F; float f = EntityType.ITEM.getWidth() / 2.0F;
float f1 = EntityType.ITEM.getHeight() / 2.0F; float f1 = EntityType.ITEM.getHeight() / 2.0F;

View File

@ -21,15 +21,15 @@ index ebc8ffcf19a1eb8e1e318df3aca6cc80beacb16f..a3e25ebe096a687de0b63f9618c49198
private void fixItemsMergingThroughWalls() { private void fixItemsMergingThroughWalls() {
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 5128efe19f57278ebc8540f3a614cebc27dbd3b0..ea9cd490fc3bfcf6a2900a702615e6626f0ed98b 100644 index 98142edeb105e213545b47ba1addf2e6f799861c..66df9492004ae648c5a5db8d1e76931284297ec1 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -98,7 +98,7 @@ public class ServerEntity { @@ -100,7 +100,7 @@ public class ServerEntity {
ItemFrame entityitemframe = (ItemFrame) this.entity; if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
ItemStack itemstack = entityitemframe.getItem(); ItemStack itemstack = entityitemframe.getItem();
- if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks - if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
+ if (this.level.paperConfig.mapItemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig.mapItemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable + if (this.level.paperConfig.mapItemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig.mapItemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
Integer integer = MapItem.getMapId(itemstack); Integer integer = MapItem.getMapId(itemstack);
MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level); MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make EntityUnleashEvent cancellable
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 2f347a0687e592bf00ef7e5a031a5dde5177ba3b..cd6c48bac5c782166de274da6a50629efbc82c4c 100644 index 0582c118b6206406764d1ea83ca6289cbb0a1392..11f3a492748d291c9c58c09d6ed62188f0868438 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1468,7 +1468,7 @@ public abstract class Mob extends LivingEntity { @@ -1482,7 +1482,7 @@ public abstract class Mob extends LivingEntity {
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
// Paper start - drop leash variable // Paper start - drop leash variable
EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true); EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true);
@ -18,7 +18,7 @@ index 2f347a0687e592bf00ef7e5a031a5dde5177ba3b..cd6c48bac5c782166de274da6a50629e
// Paper end // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 5f256c1ac5d49e19cfccf174dd55506313c493e0..744a99151ceecc85349861a99f6cb65e04c41b73 100644 index 41fa86e009a6bc2faf32a211639e8bc6a40bb00c..32cd54c9154f43824e2f05ab277321cde26d6545 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -51,7 +51,7 @@ public abstract class PathfinderMob extends Mob { @@ -51,7 +51,7 @@ public abstract class PathfinderMob extends Mob {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Clear bucket NBT after dispense
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 047dd5600e3aae8b19bfc33566ee60541131e60a..4b151444f8d7ed26dc87c9ae55fa8a14a8d84ed7 100644 index 15fc100e468e68cbb0c43363c0eb25dc2ef8c6e0..3d2b5f040715a0e4fac0e6786bd11a4d715330ce 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -633,8 +633,7 @@ public interface DispenseItemBehavior { @@ -642,8 +642,7 @@ public interface DispenseItemBehavior {
Item item = Items.BUCKET; Item item = Items.BUCKET;
stack.shrink(1); stack.shrink(1);
if (stack.isEmpty()) { if (stack.isEmpty()) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Change EnderEye target without changing other things
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
index ab0493b975206b15095175149086cf1a6663995d..909de00db8c94ade82231e76ccd6c884cefed70b 100644 index 16f520706c22bd55135fe2bc114bdf440925333b..ac4b6840cca345416a9e5695fc07879cd96f64d2 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java --- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java +++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
@@ -75,6 +75,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier { @@ -75,6 +75,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 6b4cd795f23bd8d51dff5f2b72f588ca51404b99..a80f4dc0a642c744223a155232291ace6e007636 100644 index 5eff2180dba05c29fb0a653caea695fa1b50e0a0..fea6866b769c6cf2975b04a843018724a73e5752 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -331,6 +331,23 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -333,6 +333,23 @@ public class Block extends BlockBehaviour implements ItemLike {
} }
} }
@ -33,18 +33,18 @@ index 6b4cd795f23bd8d51dff5f2b72f588ca51404b99..a80f4dc0a642c744223a155232291ace
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) { public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index f4f49cc4109d4ae72c0a50f7acbd181d05bf415a..322b3119682fbab5e790ce9255e96a519f03143d 100644 index 053bb85355c1b0fd93477187f4cedc582c6a480b..6d3c9d6c75897af52bbcce50bf23f28269a3ff5c 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -399,7 +399,7 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -400,7 +400,7 @@ public class PistonBaseBlock extends DirectionalBlock {
iblockdata1 = world.getBlockState(blockposition3); iblockdata1 = world.getBlockState(blockposition3);
BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null; BlockEntity tileentity = iblockdata1.hasBlockEntity() ? world.getBlockEntity(blockposition3) : null;
- dropResources(iblockdata1, world, blockposition3, tileentity); - dropResources(iblockdata1, world, blockposition3, tileentity);
+ dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper + dropResources(iblockdata1, world, blockposition3, tileentity, pos); // Paper
world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18); world.setBlock(blockposition3, Blocks.AIR.defaultBlockState(), 18);
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1));
if (!iblockdata1.is(BlockTags.FIRE)) { if (!iblockdata1.is(BlockTags.FIRE)) {
world.addDestroyBlockEffect(blockposition3, iblockdata1);
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 02be7c3d104fe3b3a2772201f5ebdfb6d16e9b49..ff40fe323964f173561a6838fb443e79abf9df38 100644 index 02be7c3d104fe3b3a2772201f5ebdfb6d16e9b49..ff40fe323964f173561a6838fb443e79abf9df38 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@ -67,7 +67,7 @@ index 02be7c3d104fe3b3a2772201f5ebdfb6d16e9b49..ff40fe323964f173561a6838fb443e79
private static short getCacheKey(BlockPos blockposition, BlockPos blockposition1) { private static short getCacheKey(BlockPos blockposition, BlockPos blockposition1) {
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index c2beaba9095c9163f25a46c8b2c423e820639cf6..56d50b9310d30e0f81f3d2549ff5c256eb07cc2a 100644 index a10b6a6b0ff9c104a94be3e9d0d1757333d81a00..ac33ba631f4b0ae0e08bff5748440ef5b76c2117 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -63,6 +63,13 @@ public abstract class WaterFluid extends FlowingFluid { @@ -63,6 +63,13 @@ public abstract class WaterFluid extends FlowingFluid {

View File

@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..0b42306f17bf8850a13a51067c2d19e7
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
index 5df1e8c7277759bda57253db449907eb1185cce3..f36aa9d37facc5f1e2c6ae95f27c7020b5d0002b 100644 index c4ea6760f489e6171f9e6e170160b932597f842f..245a9b062a0033a39fd42f3ff94350192570aec4 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
@@ -5,7 +5,7 @@ import org.bukkit.World; @@ -5,7 +5,7 @@ import org.bukkit.World;
@ -58,7 +58,7 @@ index 5df1e8c7277759bda57253db449907eb1185cce3..f36aa9d37facc5f1e2c6ae95f27c7020
super(world, tileEntity); super(world, tileEntity);
@@ -41,5 +41,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> @@ -41,5 +41,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
public void name(net.kyori.adventure.text.Component name) { public void name(net.kyori.adventure.text.Component name) {
getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name)); getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
} }
+ +
+ @Override + @Override

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d838e884564e2763a6918a1a778a91c84f498649..c2f12edf1045667641579788d8a38706dc1285ab 100644 index cef2315a03ec30889e8f73648749e45268d88203..eaeb863a77b1a6f5430ec21806419abff21989df 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3013,6 +3013,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3060,6 +3060,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else { } else {
// CraftBukkit start // CraftBukkit start
worldserver = shapedetectorshape.world; worldserver = shapedetectorshape.world;
@ -32,7 +32,7 @@ index d838e884564e2763a6918a1a778a91c84f498649..c2f12edf1045667641579788d8a38706
if (worldserver == this.level) { if (worldserver == this.level) {
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in // SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot); this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
@@ -3032,8 +3049,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3079,8 +3096,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (entity != null) { if (entity != null) {
entity.restoreFrom(this); entity.restoreFrom(this);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 384222f321f1678803d62187b76bf3dee1970c0c..b10c0099ba0691cb167e78b8decafe39146caaf2 100644 index 62bb1fd46e4dff43e9c83c05260c7deaffe445a9..87d7a28aa9060b0576b443cb67cea9e77de8e2f6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -754,6 +754,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -772,6 +772,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
protected BlockPos findLightningTargetAround(BlockPos pos) { protected BlockPos findLightningTargetAround(BlockPos pos) {
@ -20,7 +20,7 @@ index 384222f321f1678803d62187b76bf3dee1970c0c..b10c0099ba0691cb167e78b8decafe39
BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos); BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(blockposition1); Optional<BlockPos> optional = this.findLightningRod(blockposition1);
@@ -768,6 +773,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -786,6 +791,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!list.isEmpty()) { if (!list.isEmpty()) {
return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition(); return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition();
} else { } else {
@ -29,7 +29,7 @@ index 384222f321f1678803d62187b76bf3dee1970c0c..b10c0099ba0691cb167e78b8decafe39
blockposition1 = blockposition1.above(2); blockposition1 = blockposition1.above(2);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 047be408426750fcc4a84372e7250b749e747369..c38f9db699240f203c8353019df82a0fc824a510 100644 index 1274bc5324f8cbf1ae8d37190eafeb8cb9b6e233..ac4aaf2efa1217f4b57e483adbdb13b394619813 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -691,6 +691,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -691,6 +691,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..4ecba0b02c2813a890aecc5586987879
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 5e6e0b137604ac64e11a2dd883978ff1c8c59012..acd2bbe5807fcf1abc65da63c2a049735aefe977 100644 index 3ae0f73b00496ff05b845aff057fd4f91dad0ccd..074de9061b4bd6a59e584746f560c43ff4755f93 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -562,6 +562,18 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -562,6 +562,18 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add ItemFactory#getMonsterEgg API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index e8ed3017e2d1ac55f79c85be1860aae84db96edc..697d6d8387d1451ac3158d35bbaa00229dcfcbc6 100644 index f3a6a4d97b5be2e75c438a6f7010a8f588afe86c..4a8ac558d308c4e3bc63cdd8d7071a3f9ff3aa81 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -434,5 +434,17 @@ public final class CraftItemFactory implements ItemFactory { @@ -440,5 +440,17 @@ public final class CraftItemFactory implements ItemFactory {
entity.getUniqueId().toString(), entity.getUniqueId().toString(),
new net.md_5.bungee.api.chat.TextComponent(customName)); new net.md_5.bungee.api.chat.TextComponent(customName));
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add critical damage API
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 80d19af2ad423bd3de0e039c5bb8f97af536aaa9..a828cad27fcd39f8bfbaefa97052a2a3b6650ee7 100644 index 752f9f11227a47b7bed675b93e95af89c6732f63..67bce77093dcc126098731047447da2031e3388d 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java --- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java +++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -64,6 +64,19 @@ public class DamageSource { @@ -64,6 +64,19 @@ public class DamageSource {
@ -29,10 +29,10 @@ index 80d19af2ad423bd3de0e039c5bb8f97af536aaa9..a828cad27fcd39f8bfbaefa97052a2a3
public static DamageSource sting(LivingEntity attacker) { public static DamageSource sting(LivingEntity attacker) {
return new EntityDamageSource("sting", attacker); return new EntityDamageSource("sting", attacker);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 909f5c26ca149687c03688c33c241e549f19a3e9..8c74787c81d2b72a8b1c9dfff0a9db38ab13c973 100644 index 8d8ecdbb8447a2d19cf380ae1f35291c3adf3300..c8b87d5f7af7f19968007cbc18359f0af33040a5 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1230,7 +1230,7 @@ public abstract class Player extends LivingEntity { @@ -1275,7 +1275,7 @@ public abstract class Player extends LivingEntity {
flag1 = true; flag1 = true;
} }
@ -41,7 +41,7 @@ index 909f5c26ca149687c03688c33c241e549f19a3e9..8c74787c81d2b72a8b1c9dfff0a9db38
flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting(); flag2 = flag2 && !this.isSprinting();
@@ -1270,7 +1270,7 @@ public abstract class Player extends LivingEntity { @@ -1315,7 +1315,7 @@ public abstract class Player extends LivingEntity {
} }
Vec3 vec3d = target.getDeltaMovement(); Vec3 vec3d = target.getDeltaMovement();
@ -50,7 +50,7 @@ index 909f5c26ca149687c03688c33c241e549f19a3e9..8c74787c81d2b72a8b1c9dfff0a9db38
if (flag5) { if (flag5) {
if (i > 0) { if (i > 0) {
@@ -1298,7 +1298,7 @@ public abstract class Player extends LivingEntity { @@ -1343,7 +1343,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits // CraftBukkit start - Only apply knockback if the damage hits
@ -60,10 +60,10 @@ index 909f5c26ca149687c03688c33c241e549f19a3e9..8c74787c81d2b72a8b1c9dfff0a9db38
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index b436103957113bff5e553dacb869c775a3f8b059..3d3dcb47720055f550d17d1f106a2c0e59de2919 100644 index cad3d93c2a8cd8f5b55ba05a50a2cdc22729ebd8..0d1458152b7ef8227b601d287b53989059468dce 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -381,6 +381,7 @@ public abstract class AbstractArrow extends Projectile { @@ -382,6 +382,7 @@ public abstract class AbstractArrow extends Projectile {
} }
} }

View File

@ -37,7 +37,7 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index acd2bbe5807fcf1abc65da63c2a049735aefe977..2ab43400661fcc98d989e375dbeffa12e187c5e9 100644 index 074de9061b4bd6a59e584746f560c43ff4755f93..3ce051a68288732a850558d85154f4575ca09d5d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -574,6 +574,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -574,6 +574,12 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Goat ram API
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 8618790938f182e4aa0e27ea79dea1d35a36ec6e..78f1082b0a3bad923c1e142d15bc7dad2ae5ff15 100644 index 1935db7bd6d0976fd0bb9e482cd8044b79b0a452..56dd01801f56c56d07101e7e22b58ac059f5f07f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java --- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -274,4 +274,15 @@ public class Goat extends Animal { @@ -359,4 +359,15 @@ public class Goat extends Animal {
public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) { public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos); return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
} }
+ +
@ -25,10 +25,10 @@ index 8618790938f182e4aa0e27ea79dea1d35a36ec6e..78f1082b0a3bad923c1e142d15bc7dad
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
index ae74df5c9845ac125968a52897f4343b0f348217..436aa41563b8fab112d03c8cc516cf6ff37587bd 100644 index 9142b132f045af55b6bb436a39a9ca416bcfc698..e4be28b130e35ea263f85b3157898cd3a7e80561 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
@@ -34,4 +34,11 @@ public class CraftGoat extends CraftAnimals implements Goat { @@ -54,4 +54,11 @@ public class CraftGoat extends CraftAnimals implements Goat {
public void setScreaming(boolean screaming) { public void setScreaming(boolean screaming) {
this.getHandle().setScreamingGoat(screaming); this.getHandle().setScreamingGoat(screaming);
} }

View File

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c2f12edf1045667641579788d8a38706dc1285ab..9c33b2259bf741c5f891691836ad19f9200c4308 100644 index eaeb863a77b1a6f5430ec21806419abff21989df..3a4ea867f8d8013813ff4aceb7cc54ff9d9116c2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1837,6 +1837,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1885,6 +1885,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
} }
@ -25,10 +25,10 @@ index c2f12edf1045667641579788d8a38706dc1285ab..9c33b2259bf741c5f891691836ad19f9
return this.isPassenger() ? false : this.saveAsPassenger(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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 23f3acdc37968ec76ffb57e022755c97ff02ff67..9e5f338d0bb64ac47a99cd08a2ab083d2f5caf6c 100644 index 2a3addb00244b8ba68a3eeebba016553782946fd..ad3d005992d7f79b4c756410b063427acaddfbc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1284,5 +1284,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1295,5 +1295,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
return set; return set;
} }
@ -45,7 +45,7 @@ index 23f3acdc37968ec76ffb57e022755c97ff02ff67..9e5f338d0bb64ac47a99cd08a2ab083d
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 2ab43400661fcc98d989e375dbeffa12e187c5e9..5b05ef93a02e8a8525cf1558273d0f8963407862 100644 index 3ce051a68288732a850558d85154f4575ca09d5d..8d0de7b529a9dc946b6b56e83238dcacb4496906 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -457,6 +457,30 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -457,6 +457,30 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -30,13 +30,14 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..f875507241ac6769545e91cd3285232b
private RedirectModifier<S> modifier = null; private RedirectModifier<S> modifier = null;
private boolean forks; private boolean forks;
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 8f51b814c5b1c2c14378565363119df45af25726..13a0f78abbb00b489b63d88ce14f60cb04402085 100644 index f34e8f5b6837473b5aef96fea89ec7564a86f430..af00f7dcbc1c4fb8da25128d5603b3ef041db7da 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -213,6 +213,13 @@ public class Commands { @@ -210,7 +210,13 @@ public class Commands {
if (environment.includeIntegrated) {
PublishCommand.register(this.dispatcher); PublishCommand.register(this.dispatcher);
} }
-
+ // Paper start + // Paper start
+ for (final CommandNode<CommandSourceStack> node : this.dispatcher.getRoot().getChildren()) { + for (final CommandNode<CommandSourceStack> node : this.dispatcher.getRoot().getChildren()) {
+ if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.<CommandSourceStack>defaultRequirement()) { + if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.<CommandSourceStack>defaultRequirement()) {
@ -44,11 +45,11 @@ index 8f51b814c5b1c2c14378565363119df45af25726..13a0f78abbb00b489b63d88ce14f60cb
+ } + }
+ } + }
+ // Paper end + // Paper end
this.dispatcher.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> { // CraftBukkit start
// CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection}); // CraftBukkit }
});
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index 0377c706c9aec6f367e83f859f9a3432ad5bba4a..e9d1fb479855194da5a05e86861848158736cbb4 100644 index 5ed34b60a32a2aac214de84c44689fd5a0b00a10..8dca2ad7d25f740941187698d77819af8ebc2805 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -87,7 +87,23 @@ public final class VanillaCommandWrapper extends BukkitCommand { @@ -87,7 +87,23 @@ public final class VanillaCommandWrapper extends BukkitCommand {

View File

@ -10,10 +10,10 @@ schedules. Effectively, use the callback executor as a tool of
finding issues rather than hiding these issues. finding issues rather than hiding these issues.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 104e7d0c18b032ee8198c4de25a57676d0f64745..d53ff732a503eab3aea0384475f8a56d3076828d 100644 index 648a03beb70ee3905360e992a891b74c38fcef68..cf5dd1f83e3fa3fce9e40a38733c0238305a2bb3 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -164,17 +164,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -168,17 +168,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {

View File

@ -10,10 +10,10 @@ to be unloaded will simply be unloaded next tick, rather than
immediately. immediately.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d0170f92335b331d6904e8c27e75f97efc7875c7..b338abc1bd96e1bb5e90ed7594504c4e41f94eff 100644 index ab22b2a9287bb2c70404d6ff488af2001151f48d..588b018fac48a371cd285a13c1dd5e978b5aceef 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -872,6 +872,7 @@ public class ServerChunkCache extends ChunkSource { @@ -873,6 +873,7 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below // CraftBukkit start - modelled on below
public void purgeUnload() { public void purgeUnload() {

View File

@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways. state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b10c0099ba0691cb167e78b8decafe39146caaf2..a7ad8fcbd99b94440803290b7fe7465c638dc895 100644 index 87d7a28aa9060b0576b443cb67cea9e77de8e2f6..ea58a43df4b6637a1a9e736aeead6d88396f6395 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1312,9 +1312,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1330,9 +1330,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start // Spigot Start
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) { if (tileentity instanceof net.minecraft.world.Container) {
@ -28,10 +28,10 @@ index b10c0099ba0691cb167e78b8decafe39146caaf2..a7ad8fcbd99b94440803290b7fe7465c
} }
// Spigot End // Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c8be2fa8c0b39e7b02d5214551e13b49af0c4730..6f55fa61f4c3291413aab076a46cec2cc103dac5 100644 index a39a387a744ec1f63c06fc05b431983a6e8bf70a..866e4aa0080363976861fcbfe6aedc380bbc5e53 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1580,6 +1580,18 @@ public class ServerPlayer extends Player { @@ -1589,6 +1589,18 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
this.doCloseContainer(); this.doCloseContainer();
} }
@ -51,10 +51,10 @@ index c8be2fa8c0b39e7b02d5214551e13b49af0c4730..6f55fa61f4c3291413aab076a46cec2c
public void doCloseContainer() { public void doCloseContainer() {
this.containerMenu.removed(this); this.containerMenu.removed(this);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8c74787c81d2b72a8b1c9dfff0a9db38ab13c973..2483d7df7f1bf94344afd38b37602c645a4a2dff 100644 index c8b87d5f7af7f19968007cbc18359f0af33040a5..520150814d5ceaba80c34b0f4ea0bb7abe4e8269 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -497,6 +497,11 @@ public abstract class Player extends LivingEntity { @@ -507,6 +507,11 @@ public abstract class Player extends LivingEntity {
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
// Paper end // Paper end

View File

@ -8,10 +8,10 @@ cause a recursive call which would handle the increase but then
the caller would think the chunk would be unloaded. the caller would think the chunk would be unloaded.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 0d9fbdb23d28a4082c71275ca00e42f3bcb31926..dbae93f9c6358ef61c6b1f29860e9905a4b74332 100644 index e4dcce973fa6d6db8ddd37400125be8b7ee64c64..2e86997038f8ec950dd84f363ed2b1827b86ee4b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -463,8 +463,10 @@ public class ChunkHolder { @@ -467,8 +467,10 @@ public class ChunkHolder {
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
} }
@ -22,7 +22,7 @@ index 0d9fbdb23d28a4082c71275ca00e42f3bcb31926..dbae93f9c6358ef61c6b1f29860e9905
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
@@ -506,6 +508,12 @@ public class ChunkHolder { @@ -510,6 +512,12 @@ public class ChunkHolder {
// Run callback right away if the future was already done // Run callback right away if the future was already done
chunkStorage.callbackExecutor.run(); chunkStorage.callbackExecutor.run();

View File

@ -7,7 +7,7 @@ Separate lookup and state access locks prevent lookups
from stalling simple state access/write calls from stalling simple state access/write calls
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index f379e108ec3c762940bddea878a0a7112f0e9746..764132b38be5a87e09a3bfe5262e59df5b225519 100644 index ddd78b2836c1f4a6b4fcd532153f5d3e17f91ea8..2097d9eef58eb291c9055189fc3da6222ab8429f 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -62,6 +62,11 @@ public class GameProfileCache { @@ -62,6 +62,11 @@ public class GameProfileCache {

View File

@ -10,10 +10,10 @@ chunk future to complete. We can simply schedule to the immediate
executor to get this effect, rather than the main mailbox. executor to get this effect, rather than the main mailbox.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d53ff732a503eab3aea0384475f8a56d3076828d..971a31641ec33a80f45e507944fa4cd90bfc466a 100644 index cf5dd1f83e3fa3fce9e40a38733c0238305a2bb3..63ef27cf48071eca0f6450e6276f956d94b7dd59 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1300,9 +1300,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1326,9 +1326,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return chunk; return chunk;
}); });

View File

@ -8,18 +8,18 @@ Sync loading the chunk at this stage would cause it to load
older data, as well as screwing our region state. older data, as well as screwing our region state.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 971a31641ec33a80f45e507944fa4cd90bfc466a..5d60fa26e9f5d3c9c57a61c509d5b924bbed3281 100644 index 63ef27cf48071eca0f6450e6276f956d94b7dd59..30fbb3df9b91697cca0f0fc7982dced758bdd778 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -313,6 +313,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -317,6 +317,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
// Paper end // Paper end
+ boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks + boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) { 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); super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone(); this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -707,6 +708,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -723,6 +724,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable @Nullable
ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) { ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) {
@ -27,7 +27,7 @@ index 971a31641ec33a80f45e507944fa4cd90bfc466a..5d60fa26e9f5d3c9c57a61c509d5b924
if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) { if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) {
return holder; return holder;
} else { } else {
@@ -910,6 +912,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -926,6 +928,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) { if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder); this.scheduleUnload(pos, holder);
} else { } else {
@ -40,7 +40,7 @@ index 971a31641ec33a80f45e507944fa4cd90bfc466a..5d60fa26e9f5d3c9c57a61c509d5b924
// Paper start // Paper start
boolean removed; boolean removed;
if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) { if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
@@ -947,6 +955,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -963,6 +971,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
} }
} // Paper end } // Paper end
@ -49,10 +49,10 @@ index 971a31641ec33a80f45e507944fa4cd90bfc466a..5d60fa26e9f5d3c9c57a61c509d5b924
} }
}; };
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index b338abc1bd96e1bb5e90ed7594504c4e41f94eff..4b4952d632845fad5dd61c345dc5dba79a7ee209 100644 index 588b018fac48a371cd285a13c1dd5e978b5aceef..f8c85ceaa3754febf0fe5643ef97eecb429286e9 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -808,6 +808,7 @@ public class ServerChunkCache extends ChunkSource { @@ -809,6 +809,7 @@ public class ServerChunkCache extends ChunkSource {
public boolean runDistanceManagerUpdates() { public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority

View File

@ -8,10 +8,10 @@ This WILL cause state corruption if it happens. So, don't
allow it. allow it.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index dbae93f9c6358ef61c6b1f29860e9905a4b74332..b9d3535dd4e0af771bb74c85f18265e38f383e0e 100644 index 2e86997038f8ec950dd84f363ed2b1827b86ee4b..77c7fe4d39f09499274ac34fd6c3f3a99cfbdd1d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -443,7 +443,13 @@ public class ChunkHolder { @@ -447,7 +447,13 @@ public class ChunkHolder {
CompletableFuture<Void> completablefuture1 = new CompletableFuture(); CompletableFuture<Void> completablefuture1 = new CompletableFuture();
completablefuture1.thenRunAsync(() -> { completablefuture1.thenRunAsync(() -> {
@ -25,7 +25,7 @@ index dbae93f9c6358ef61c6b1f29860e9905a4b74332..b9d3535dd4e0af771bb74c85f18265e3
}, executor); }, executor);
this.pendingFullStateConfirmation = completablefuture1; this.pendingFullStateConfirmation = completablefuture1;
completablefuture.thenAccept((either) -> { completablefuture.thenAccept((either) -> {
@@ -460,7 +466,12 @@ public class ChunkHolder { @@ -464,7 +470,12 @@ public class ChunkHolder {
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) { private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
this.pendingFullStateConfirmation.cancel(false); this.pendingFullStateConfirmation.cancel(false);

View File

@ -10,10 +10,10 @@ out due to a sync load, as the worldgen threads will be
stalling on profile lookups. stalling on profile lookups.
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index c506b837d0f8b49fa65efe7ff80dd64c2d653e35..da55a78b28b463f737464ebc818e918425903571 100644 index 5f9e3d37c3ba79d26806374d73f87328cebb562d..206c6ce227ba19620185ac835af28d67caa76c40 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -70,6 +70,22 @@ public class Util { @@ -80,6 +80,22 @@ public class Util {
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
@ -37,7 +37,7 @@ index c506b837d0f8b49fa65efe7ff80dd64c2d653e35..da55a78b28b463f737464ebc818e9184
public static LongSupplier timeSource = System::nanoTime; public static LongSupplier timeSource = System::nanoTime;
public static final Ticker TICKER = new Ticker() { public static final Ticker TICKER = new Ticker() {
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 764132b38be5a87e09a3bfe5262e59df5b225519..9259eeea54d77ddecf044edf80e0eca6cb95278f 100644 index 2097d9eef58eb291c9055189fc3da6222ab8429f..1c5dfd2aa50118fcd2a451472873975d75a8e327 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -206,7 +206,7 @@ public class GameProfileCache { @@ -206,7 +206,7 @@ public class GameProfileCache {
@ -50,10 +50,10 @@ index 764132b38be5a87e09a3bfe5262e59df5b225519..9259eeea54d77ddecf044edf80e0eca6
}, this.executor).whenCompleteAsync((optional, throwable) -> { }, this.executor).whenCompleteAsync((optional, throwable) -> {
consumer.accept(optional); consumer.accept(optional);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index e3efea8623c7d34915069a6b9b7da9f2b1694c28..118472b83a21a250f398c088c91ac4560c19c749 100644 index 170f051d820ee1add1b61a20dbd1f18f758717dc..c1703a67a615f563dab4fb442a6df7082229af57 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -148,7 +148,7 @@ public class SkullBlockEntity extends BlockEntity { @@ -149,7 +149,7 @@ public class SkullBlockEntity extends BlockEntity {
public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) { public static void updateGameprofile(@Nullable GameProfile owner, Consumer<GameProfile> callback) {
if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) { if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) {
profileCache.getAsync(owner.getName(), (profile) -> { profileCache.getAsync(owner.getName(), (profile) -> {

View File

@ -275,10 +275,10 @@ index fa0b824747c5b15cfb29e22b2d30b9c6932c1320..ca401a3203176578f9cd399aa740f071
List<org.bukkit.World> worlds; List<org.bukkit.World> worlds;
if (args.length < 2 || args[1].equals("*")) { if (args.length < 2 || args[1].equals("*")) {
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index ce6051531f021bf20851bc5ab763e732ee10427d..87d1f5b2717fc82203b5674ac0bf2704117f8f63 100644 index 611dbcebd54604da5bd3e6ed510032db2a70401d..a04b8eeb9b4cbd700b95552c46fdf0da4c03b3eb 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -190,6 +190,16 @@ public final class NaturalSpawner { @@ -191,6 +191,16 @@ public final class NaturalSpawner {
world.getProfiler().pop(); world.getProfiler().pop();
} }
@ -292,14 +292,14 @@ index ce6051531f021bf20851bc5ab763e732ee10427d..87d1f5b2717fc82203b5674ac0bf2704
+ } + }
+ // Paper end + // Paper end
+ +
// Paper start - add parameters and int ret type
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) { public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
// Paper start - add parameters and int ret type
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 538e5663e7e23a1bcc2c832930d4c1489a48c07a..83bbe0e65760a7f380e19da5a3938b1a30e5d679 100644 index 9486c53285fabb2d72b2bc3881673cd6640bd50e..a97565735bf6005b77859e8453171cd8eaefab81 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2149,6 +2149,11 @@ public final class CraftServer implements Server { @@ -2131,6 +2131,11 @@ public final class CraftServer implements Server {
@Override @Override
public int getSpawnLimit(SpawnCategory spawnCategory) { public int getSpawnLimit(SpawnCategory spawnCategory) {
@ -312,7 +312,7 @@ index 538e5663e7e23a1bcc2c832930d4c1489a48c07a..83bbe0e65760a7f380e19da5a3938b1a
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c38f9db699240f203c8353019df82a0fc824a510..42434152c79f8318009b02e9a39326fd9d4ff466 100644 index ac4aaf2efa1217f4b57e483adbdb13b394619813..fdc4879ff05616dfe89b78bfae5c1d9aad87577d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1706,9 +1706,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1706,9 +1706,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -18,10 +18,10 @@ index d2865ce0523b74aaa935db72c6f3478894e13408..ea4e46c113d3f0a5db6c891021e2e4c5
while (objectiterator.hasNext()) { while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 4b4952d632845fad5dd61c345dc5dba79a7ee209..eca75916c5e476db280e58522e5540def4f4de68 100644 index f8c85ceaa3754febf0fe5643ef97eecb429286e9..ad36cf0788044d2249d71223d85d9a43c0d16067 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -713,6 +713,8 @@ public class ServerChunkCache extends ChunkSource { @@ -714,6 +714,8 @@ public class ServerChunkCache extends ChunkSource {
return completablefuture; return completablefuture;
} }
@ -30,7 +30,7 @@ index 4b4952d632845fad5dd61c345dc5dba79a7ee209..eca75916c5e476db280e58522e5540de
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
// Paper start - add isUrgent - old sig left in place for dirty nms plugins // Paper start - add isUrgent - old sig left in place for dirty nms plugins
return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false); return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false);
@@ -731,9 +733,12 @@ public class ServerChunkCache extends ChunkSource { @@ -732,9 +734,12 @@ public class ServerChunkCache extends ChunkSource {
ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel()); ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel());
currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)); currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER));
} }
@ -43,7 +43,7 @@ index 4b4952d632845fad5dd61c345dc5dba79a7ee209..eca75916c5e476db280e58522e5540de
if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
if (this.chunkAbsent(playerchunk, l)) { if (this.chunkAbsent(playerchunk, l)) {
ProfilerFiller gameprofilerfiller = this.level.getProfiler(); ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -744,13 +749,21 @@ public class ServerChunkCache extends ChunkSource { @@ -745,13 +750,21 @@ public class ServerChunkCache extends ChunkSource {
playerchunk = this.getVisibleChunkIfPresent(k); playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop(); gameprofilerfiller.pop();
if (this.chunkAbsent(playerchunk, l)) { if (this.chunkAbsent(playerchunk, l)) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Sanitize ResourceLocation error logging
diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java
index 30e5d27080b3246b87f90f838fb0305e7bb0d9d7..7c8f56557e0e6c3a142cd27af50d017df0fbe8f0 100644 index 0e04275f62c5c2d8afede431f78f38f06e8009e6..7017dd42f832d928f1008a05f01701667d951644 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java --- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -32,9 +32,9 @@ public class ResourceLocation implements Comparable<ResourceLocation> { @@ -32,9 +32,9 @@ public class ResourceLocation implements Comparable<ResourceLocation> {

View File

@ -9,7 +9,7 @@ This patch will be used to optimise out flush calls in later
patches. patches.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e574276e9d01cf 100644 index 00ab93e02a884e51cd6cc647c7e58c2e53b8a7cc..47d4a22577f583acad44c1124a39ede6c33d03fa 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -104,6 +104,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -104,6 +104,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -52,7 +52,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
public Connection(PacketFlow side) { public Connection(PacketFlow side) {
this.receiving = side; this.receiving = side;
} }
@@ -267,7 +300,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -269,7 +302,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() && net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
(packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty()) (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
))) { ))) {
@ -61,7 +61,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
return; return;
} }
// write the packets to the queue, then flush - antixray hooks there already // write the packets to the queue, then flush - antixray hooks there already
@@ -291,6 +324,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -293,6 +326,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) { private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) {
@ -76,7 +76,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
ConnectionProtocol enumprotocol = ConnectionProtocol.getProtocolForPacket(packet); ConnectionProtocol enumprotocol = ConnectionProtocol.getProtocolForPacket(packet);
ConnectionProtocol enumprotocol1 = this.getCurrentProtocol(); ConnectionProtocol enumprotocol1 = this.getCurrentProtocol();
@@ -301,16 +342,21 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -303,16 +344,21 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
if (this.channel.eventLoop().inEventLoop()) { if (this.channel.eventLoop().inEventLoop()) {
@ -100,7 +100,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
if (packetState != currentState) { if (packetState != currentState) {
this.setProtocol(packetState); this.setProtocol(packetState);
} }
@@ -324,7 +370,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -326,7 +372,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
try { try {
// Paper end // Paper end
@ -109,7 +109,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
if (callback != null) { if (callback != null) {
channelfuture.addListener(callback); channelfuture.addListener(callback);
@@ -366,6 +412,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -368,6 +414,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
private boolean processQueue() { private boolean processQueue() {
if (this.queue.isEmpty()) return true; if (this.queue.isEmpty()) return true;
@ -120,7 +120,7 @@ index 8536dd544876e245a611379a7ed1446b0ed06eac..2717252c8c87abeb90c9a0ee82e57427
// If we are on main, we are safe here in that nothing else should be processing queue off main anymore // If we are on main, we are safe here in that nothing else should be processing queue off main anymore
// But if we are not on main due to login/status, the parent is synchronized on packetQueue // But if we are not on main due to login/status, the parent is synchronized on packetQueue
java.util.Iterator<PacketHolder> iterator = this.queue.iterator(); java.util.Iterator<PacketHolder> iterator = this.queue.iterator();
@@ -373,16 +423,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -375,16 +425,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
PacketHolder queued = iterator.next(); // poll -> peek PacketHolder queued = iterator.next(); // poll -> peek
// Fix NPE (Spigot bug caused by handleDisconnection()) // Fix NPE (Spigot bug caused by handleDisconnection())

View File

@ -31,7 +31,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..a176a886235494fdc722030a93658d36
throw new UnsupportedOperationException("Only one concurrent iteration supported"); throw new UnsupportedOperationException("Only one concurrent iteration supported");
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 2110cb437807f99994838b57653caefe2f01a9c5..35e3926a878dd87f05bb41e9e52b4e04e30752eb 100644 index 823489437dad68f52213f25d84d84ac64f7cc208..664fd701130713379dbc0c3a452732fe529ce4a4 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -166,6 +166,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -166,6 +166,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A

View File

@ -914,23 +914,23 @@ index 0000000000000000000000000000000000000000..3ba094e640d7fe7803e2bbdab8ff3beb
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a7ad8fcbd99b94440803290b7fe7465c638dc895..848601bf0a5af305a0eef48d5870afc0fcce3af0 100644 index ea58a43df4b6637a1a9e736aeead6d88396f6395..18f28b5ea2919fb12fd1e76555026c2161564372 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -431,7 +431,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -446,7 +446,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
DataFixer datafixer = minecraftserver.getFixerUpper(); DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
- this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage); - this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage);
+ this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper + this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper
StructureManager definedstructuremanager = minecraftserver.getStructureManager(); StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager();
int j = this.spigotConfig.viewDistance; // Spigot int j = this.spigotConfig.viewDistance; // Spigot
int k = this.spigotConfig.simulationDistance; // Spigot int k = this.spigotConfig.simulationDistance; // Spigot
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 8fdda1e5805534d08c0a06b15e89d85b3d9c21e9..a24f605bd033f249a374e83ba094880106260eee 100644 index ba3023c7dd5b3bcf66f829fe5dc9757f96d16b45..05ff7bcc79e617904903cf082f6687d24e587547 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -490,4 +490,21 @@ public class WorldGenRegion implements WorldGenLevel { @@ -497,4 +497,21 @@ public class WorldGenRegion implements WorldGenLevel {
public long nextSubTickCount() { public long nextSubTickCount() {
return this.subTickCount.getAndIncrement(); return this.subTickCount.getAndIncrement();
} }
@ -953,10 +953,10 @@ index 8fdda1e5805534d08c0a06b15e89d85b3d9c21e9..a24f605bd033f249a374e83ba0948801
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9c33b2259bf741c5f891691836ad19f9200c4308..9a91de63420e5b910e37773362376d500c78ce97 100644 index 3a4ea867f8d8013813ff4aceb7cc54ff9d9116c2..3f163aac6d5074e8952f48176481403834f20ae0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -428,6 +428,56 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -449,6 +449,56 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
// Paper end - make end portalling safe // Paper end - make end portalling safe
@ -1013,7 +1013,7 @@ index 9c33b2259bf741c5f891691836ad19f9200c4308..9a91de63420e5b910e37773362376d50
public Entity(EntityType<?> type, Level world) { public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
@@ -2272,11 +2322,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2320,11 +2370,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return InteractionResult.PASS; return InteractionResult.PASS;
} }
@ -1051,10 +1051,10 @@ index 1a3be6f0570c7c746eafa36544debe90d7629432..c0817ef8927f00e2fd3fbf3289f8041f
<T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate); <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 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380d9ec39c9 100644 index 397afdf68e6330c5aaf465f219800985ad26e9e2..e613d3171200dc436a45bd1980a106d936e351cd 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -278,6 +278,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -289,6 +289,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.chunkPacketBlockController = this.paperConfig.antiXray ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
@ -1062,7 +1062,7 @@ index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380
} }
// Paper start // Paper start
@@ -988,26 +989,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -963,26 +964,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) { public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities"); this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
@ -1090,7 +1090,7 @@ index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380
return list; return list;
} }
@@ -1016,27 +998,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -991,27 +973,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.getProfiler().incrementCounter("getEntities"); this.getProfiler().incrementCounter("getEntities");
List<T> list = Lists.newArrayList(); List<T> list = Lists.newArrayList();
@ -1133,7 +1133,7 @@ index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380
return list; return list;
} }
@@ -1389,4 +1366,46 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1338,4 +1315,46 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public long nextSubTickCount() { public long nextSubTickCount() {
return (long) (this.subTickCount++); return (long) (this.subTickCount++);
} }
@ -1181,7 +1181,7 @@ index c293531a6913b365c3bf804d6d0bfae24378dc43..944519c4433710610ac5015d3d3de380
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 35e3926a878dd87f05bb41e9e52b4e04e30752eb..5029ab81e3d7943a001b6367083eb511ce7d3572 100644 index 664fd701130713379dbc0c3a452732fe529ce4a4..3019646ae30ce7f89e1e1f3eb39eaa69e58a0f50 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -49,8 +49,10 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -49,8 +49,10 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@ -1220,7 +1220,7 @@ index 35e3926a878dd87f05bb41e9e52b4e04e30752eb..5029ab81e3d7943a001b6367083eb511
Visibility visibility = this.currentSection.getStatus(); Visibility visibility = this.currentSection.getStatus();
if (!this.currentSection.remove(this.entity)) { if (!this.currentSection.remove(this.entity)) {
@@ -503,6 +508,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -512,6 +517,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
if (!this.currentSection.remove(this.entity)) { if (!this.currentSection.remove(this.entity)) {
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason}); PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason});
} }
@ -1229,10 +1229,10 @@ index 35e3926a878dd87f05bb41e9e52b4e04e30752eb..5029ab81e3d7943a001b6367083eb511
Visibility visibility = PersistentEntitySectionManager.getEffectiveStatus(this.entity, this.currentSection.getStatus()); Visibility visibility = PersistentEntitySectionManager.getEffectiveStatus(this.entity, this.currentSection.getStatus());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index f8f44cb6e823a0150f3abdab133f8ae247c9b89c..0085a4dd0f0def1ba71342e20aecdd46a3761b02 100644 index e28efd61e5b773064af077be6497caec63df1140..4a9b20e0dae3d502738e71e0f6119bdb3e0e2f16 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -133,9 +133,7 @@ public class CraftChunk implements Chunk { @@ -134,9 +134,7 @@ public class CraftChunk implements Chunk {
long pair = ChunkPos.asLong(x, z); long pair = ChunkPos.asLong(x, z);
if (entityManager.areEntitiesLoaded(pair)) { if (entityManager.areEntitiesLoaded(pair)) {
@ -1243,7 +1243,7 @@ index f8f44cb6e823a0150f3abdab133f8ae247c9b89c..0085a4dd0f0def1ba71342e20aecdd46
} }
entityManager.ensureChunkQueuedForLoad(pair); // Start entity loading entityManager.ensureChunkQueuedForLoad(pair); // Start entity loading
@@ -171,9 +169,7 @@ public class CraftChunk implements Chunk { @@ -172,9 +170,7 @@ public class CraftChunk implements Chunk {
} }
} }
@ -1255,10 +1255,10 @@ index f8f44cb6e823a0150f3abdab133f8ae247c9b89c..0085a4dd0f0def1ba71342e20aecdd46
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 13e887e9d06c3eb8649613d1ecb3d26de6b9d6ef..34e2e14ebb007cceb8b64d3eb321646e834215d4 100644 index 3bedc22c253c3632b5624c05e78ed3671e5d30ce..fbd82b6be6604bf854e01ed5718e4e072f42b265 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -251,4 +251,20 @@ public class DummyGeneratorAccess implements WorldGenLevel { @@ -254,4 +254,20 @@ public class DummyGeneratorAccess implements WorldGenLevel {
public boolean destroyBlock(BlockPos pos, boolean drop, Entity breakingEntity, int maxUpdateDepth) { public boolean destroyBlock(BlockPos pos, boolean drop, Entity breakingEntity, int maxUpdateDepth) {
return false; // SPIGOT-6515 return false; // SPIGOT-6515
} }