3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

More more more more more more more more more more work

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-24 10:01:27 +01:00 committet von MiniDigger | Martin
Ursprung 6ac2614a5f
Commit f43f1e217e
22 geänderte Dateien mit 138 neuen und 156 gelöschten Zeilen

Datei anzeigen

@ -5,12 +5,14 @@ Subject: [PATCH] Implement alternative item-despawn-rate
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 604a0b423ce7863ad872e111257ac2fe8d635d5a..0ee9ce9b1214b91942541152443951c901aeafe6 100644
index 7a97a4a395f20680bc3b028586c9a17b84783d99..252a690096a5255865f725203c4b6a401f979b94 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -536,6 +536,54 @@ public class PaperWorldConfig {
this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1);
@@ -518,5 +518,52 @@ public class PaperWorldConfig {
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
}
-}
+ public boolean altItemDespawnRateEnabled;
+ public java.util.Map<org.bukkit.Material, Integer> altItemDespawnRateMap;
@ -59,15 +61,12 @@ index 604a0b423ce7863ad872e111257ac2fe8d635d5a..0ee9ce9b1214b91942541152443951c9
+ }
+ }
+ }
+
public boolean antiXray;
public EngineMode engineMode;
public int maxBlockHeight;
+}
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 9ee1dc89dd4c6b9453e1f6f92208d454877d23c9..e0c13a112c95eed9867d4608e18dc797b0c9c9cf 100644
index 1378c8ab35b3828f7c0ad504e64bb72484a1026d..5a6534904e977b5ffbd55d05c4b65f02b3995910 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -175,7 +175,7 @@ public class ItemEntity extends Entity {
@@ -174,7 +174,7 @@ public class ItemEntity extends Entity {
}
}
@ -76,7 +75,7 @@ index 9ee1dc89dd4c6b9453e1f6f92208d454877d23c9..e0c13a112c95eed9867d4608e18dc797
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -199,7 +199,7 @@ public class ItemEntity extends Entity {
@@ -198,7 +198,7 @@ public class ItemEntity extends Entity {
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
@ -85,7 +84,7 @@ index 9ee1dc89dd4c6b9453e1f6f92208d454877d23c9..e0c13a112c95eed9867d4608e18dc797
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -559,9 +559,16 @@ public class ItemEntity extends Entity {
@@ -558,9 +558,16 @@ public class ItemEntity extends Entity {
public void makeFakeItem() {
this.setNeverPickUp();

Datei anzeigen

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 72471db48a9c67ced8b1ef1ebb3381be4f773e06..e6ae3405995c4e472a731311695de7ef9b2d704b 100644
index f3f6fc973cd75a42594f1ec222c220e3894e11ee..701f6f9e7d3077436daf03679d3a375a6647e30b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1885,6 +1885,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
@@ -1832,6 +1832,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16;
@ -20,7 +20,7 @@ index 72471db48a9c67ced8b1ef1ebb3381be4f773e06..e6ae3405995c4e472a731311695de7ef
if (j > i) {
i = j;
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
index 2d5cb8991e368372f1ab227735aac0c060deb199..24b1dfcf91d36947c87e9e5c2524317f8775ba95 100644
index 2d5cb8991e368372f1ab227735aac0c060deb199..55ce69b5fe097841d00ef5c241459dce9bb0d4db 100644
--- a/src/main/java/org/spigotmc/TrackingRange.java
+++ b/src/main/java/org/spigotmc/TrackingRange.java
@@ -6,7 +6,6 @@ import net.minecraft.world.entity.ExperienceOrb;
@ -69,7 +69,7 @@ index 2d5cb8991e368372f1ab227735aac0c060deb199..24b1dfcf91d36947c87e9e5c2524317f
return config.miscTrackingRange;
} else
{
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.getEffectiveViewDistance(); // Paper - enderdragon is exempt
return config.otherTrackingRange;
}
}

Datei anzeigen

@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2aa4f6f30e12162f7cfae5180e40f7a32fc6f24d..06597d10c640daca400da9d5a4c186cc95bca1bf 100644
index d789a9068353c8e7be774c275d4d099283bf826c..898ce2c6acb5a6af51a465344da4447809c2993a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3015,6 +3015,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3050,6 +3050,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
BlockPos blockposition1;
if (flag1) {

Datei anzeigen

@ -25,11 +25,11 @@ index fe79c0add4f7cb18d487c5bb9415c40c5b551ea2..8d9ddad1879e7616d980ca70de8aecac
poiUnload = Timings.ofSafe(name + "Chunk unload - POI");
chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk");
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0ee9ce9b1214b91942541152443951c901aeafe6..c95659ffe4722b50ea341f60c99262b60b8d0b81 100644
index 252a690096a5255865f725203c4b6a401f979b94..911af1e2c493f6712422aeeb995bf385756cdaab 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -618,5 +618,13 @@ public class PaperWorldConfig {
Bukkit.getLogger().warning("You have enabled permission-based Anti-Xray checking - depending on your permission plugin, this may cause performance issues");
@@ -566,4 +566,12 @@ public class PaperWorldConfig {
}
}
}
+
@ -41,7 +41,6 @@ index 0ee9ce9b1214b91942541152443951c901aeafe6..c95659ffe4722b50ea341f60c99262b6
+ perPlayerMobSpawns = getBoolean("per-player-mob-spawns", true);
+ }
}
diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
new file mode 100644
index 0000000000000000000000000000000000000000..72063ba7fb0d04594043cb07034590d597c3d77e
@ -548,10 +547,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 15b514aa20370a010ff3ab891d875dc70e41d75a..be9ae4f0f19da069ae44e45a772096bb09918219 100644
index 701f6f9e7d3077436daf03679d3a375a6647e30b..04c63334c4387965b2f9fc2643c28b8a954c936d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -145,6 +145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2ByteMap chunkTypeCache;
private final Queue<Runnable> unloadQueue;
int viewDistance;
@ -559,13 +558,18 @@ index 15b514aa20370a010ff3ab891d875dc70e41d75a..be9ae4f0f19da069ae44e45a772096bb
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -343,8 +344,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkMap.this.updateChunkTracking(player, new ChunkPos(rangeX, rangeZ), null, true, false); // unloaded, loaded
});
// Paper end - no-tick view distance
@@ -261,6 +262,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
this.regionManagers.add(this.dataRegionManager);
// Paper end
+ this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
}
protected ChunkGenerator generator() {
@@ -278,6 +280,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ // Paper start
+ public void updatePlayerMobTypeMap(Entity entity) {
+ if (!this.level.paperConfig.perPlayerMobSpawns) {
@ -589,14 +593,14 @@ index 15b514aa20370a010ff3ab891d875dc70e41d75a..be9ae4f0f19da069ae44e45a772096bb
double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8);
double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 5d920d7df52c12f5f1d1d8111340800cbddaac78..9f71dc37b0cef2284d6abc051b379cfa1b7e1eb5 100644
index 8923c305a34a8b8cfae90661a831a6fc656bef9f..0c84161d82245ab9d5c87a981a3c0f4fa5644640 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -912,7 +912,22 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().push("naturalSpawnCount");
@@ -914,7 +914,22 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("naturalSpawnCount");
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk);
- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ // Paper start - per player mob spawning
+ NaturalSpawner.SpawnState spawnercreature_d; // moved down
+ if (this.chunkMap.playerMobDistanceMap != null) {
@ -608,19 +612,19 @@ index 5d920d7df52c12f5f1d1d8111340800cbddaac78..9f71dc37b0cef2284d6abc051b379cfa
+ for (ServerPlayer player : this.level.players) {
+ Arrays.fill(player.mobCounts, 0);
+ }
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, true);
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), true);
+ } else {
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, false);
+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), false);
+ }
+ // Paper end
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 97d6963b6c7f0fb71324ac760df940fbf03e321f..4ca8f2f63e04da730a85a36d57058a481d1f9104 100644
index b193f8dfbe7b61c919ad5eb452d29885982e25e4..01b9edc8aaf472650f171f1b88229807bcfdc145 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -224,6 +224,11 @@ public class ServerPlayer extends Player {
@@ -227,6 +227,11 @@ public class ServerPlayer extends Player {
public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
// Paper end
@ -632,7 +636,7 @@ index 97d6963b6c7f0fb71324ac760df940fbf03e321f..4ca8f2f63e04da730a85a36d57058a48
// CraftBukkit start
public String displayName;
@@ -313,6 +318,7 @@ public class ServerPlayer extends Player {
@@ -316,6 +321,7 @@ public class ServerPlayer extends Player {
this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth();
@ -641,47 +645,38 @@ index 97d6963b6c7f0fb71324ac760df940fbf03e321f..4ca8f2f63e04da730a85a36d57058a48
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691beaec022 100644
index 63deac19b4006c5d64596cd30e6641caaabc7c1d..c62e76912413c4412ee807435d23038a65caa9ea 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -17,6 +17,7 @@ import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.Tag;
@@ -65,7 +66,12 @@ public final class NaturalSpawner {
@@ -65,7 +65,13 @@ public final class NaturalSpawner {
private NaturalSpawner() {}
+ // Paper start - add countMobs parameter
public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource) {
+ return createState(spawningChunkCount, entities, chunkSource, false);
public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator localmobcapcalculator) {
+ return createState(spawningChunkCount, entities, chunkSource, localmobcapcalculator, false);
+ }
+ public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, boolean countMobs) {
+ // Paper end - add countMobs parameter
+
+ public static NaturalSpawner.SpawnState createState(int spawningChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkSource, LocalMobCapCalculator localmobcapcalculator, boolean countMobs) {
+ // Paper end
PotentialCalculator spawnercreatureprobabilities = new PotentialCalculator();
Object2IntOpenHashMap<MobCategory> object2intopenhashmap = new Object2IntOpenHashMap();
Iterator iterator = entities.iterator();
@@ -103,6 +109,11 @@ public final class NaturalSpawner {
@@ -106,6 +112,9 @@ public final class NaturalSpawner {
}
object2intopenhashmap.addTo(enumcreaturetype, 1);
+ // Paper start
+ if (countMobs) {
+ chunk.level.getChunkSource().chunkMap.updatePlayerMobTypeMap(entity);
+ }
+ // Paper end
});
}
}
@@ -166,13 +177,31 @@ public final class NaturalSpawner {
@@ -169,13 +178,30 @@ public final class NaturalSpawner {
continue;
}
- if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && info.canSpawnForCategory(enumcreaturetype, limit)) {
- if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && info.canSpawnForCategory(enumcreaturetype, chunk.getPos(), limit)) {
+ // Paper start - only allow spawns upto the limit per chunk and update count afterwards
+ int currEntityCount = info.mobCategoryCounts.getInt(enumcreaturetype);
+ int k1 = limit * info.getSpawnableChunkCount() / NaturalSpawner.MAGIC_NUMBER;
@ -689,29 +684,28 @@ index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691
+
+ if (world.paperConfig.perPlayerMobSpawns) {
+ int minDiff = Integer.MAX_VALUE;
+ for (ServerPlayer entityplayer : world.getChunkSource().chunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) {
+ for (net.minecraft.server.level.ServerPlayer entityplayer : world.getChunkSource().chunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) {
+ minDiff = Math.min(limit - world.getChunkSource().chunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff);
+ }
+ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff;
+ }
+ // Paper end
+
+ // Paper start - per player mob spawning
+ if ((spawnAnimals || !enumcreaturetype.isFriendly()) && (spawnMonsters || enumcreaturetype.isFriendly()) && (rareSpawn || !enumcreaturetype.isPersistent()) && difference > 0) {
+ // Paper end
// CraftBukkit end
Objects.requireNonNull(info);
NaturalSpawner.SpawnPredicate spawnercreature_c = info::canSpawn;
Objects.requireNonNull(info);
- NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn);
+ // Paper start
+ int spawnCount = NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn,
+ difference, world.paperConfig.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null);
+ info.mobCategoryCounts.mergeInt(enumcreaturetype, spawnCount, Integer::sum);
+ // Paper end - per player mob spawning
+ // Paper end
}
}
@@ -180,12 +209,18 @@ public final class NaturalSpawner {
@@ -183,12 +209,18 @@ public final class NaturalSpawner {
world.getProfiler().pop();
}
@ -724,14 +718,14 @@ index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
if (blockposition.getY() >= world.getMinBuildHeight() + 1) {
- NaturalSpawner.spawnCategoryForPosition(group, world, (ChunkAccess) chunk, blockposition, checker, runner);
+ return NaturalSpawner.spawnCategoryForPosition(group, world, (ChunkAccess) chunk, blockposition, checker, runner, maxSpawns, trackEntity); // Paper
- NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner);
+ return NaturalSpawner.spawnCategoryForPosition(group, world, chunk, blockposition, checker, runner, maxSpawns, trackEntity); // Paper
}
+ return 0; // Paper
+ return 0; // paper
}
@VisibleForDebug
@@ -196,15 +231,21 @@ public final class NaturalSpawner {
@@ -199,15 +231,21 @@ public final class NaturalSpawner {
});
}
@ -750,11 +744,11 @@ index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691
if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- int j = 0;
+ // Paper - moved up
+ //int j = 0; // Paper - moved up
int k = 0;
while (k < 3) {
@@ -246,14 +287,14 @@ public final class NaturalSpawner {
@@ -249,14 +287,14 @@ public final class NaturalSpawner {
// Paper start
Boolean doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2);
if (doSpawning == null) {
@ -771,7 +765,7 @@ index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691
}
entityinsentient.moveTo(d0, (double) i, d1, world.random.nextFloat() * 360.0F, 0.0F);
@@ -265,10 +306,15 @@ public final class NaturalSpawner {
@@ -268,10 +306,15 @@ public final class NaturalSpawner {
++j;
++k1;
runner.run(entityinsentient, chunk);
@ -789,7 +783,7 @@ index 461b64232c0f04e17e168f1e7f7857ee555200fc..4d8251a961a9c52456db997506dd9691
}
if (entityinsentient.isMaxGroupSizeReached(k1)) {
@@ -290,6 +336,7 @@ public final class NaturalSpawner {
@@ -293,6 +336,7 @@ public final class NaturalSpawner {
}
}

Datei anzeigen

@ -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.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f196a184c05d5f87faee78323343d1fe19287c07..8306d6628c5b7507ee80cb2bff660e0badf84660 100644
index de7abae207b0a565a25fa4ed2f66b94c6b0cdcf9..6ec5a6239b6144b2e3f9edcafdfd6fed6de6cbcd 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -985,7 +985,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -984,7 +984,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
}
@ -27,10 +27,10 @@ index f196a184c05d5f87faee78323343d1fe19287c07..8306d6628c5b7507ee80cb2bff660e0b
}
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
index 9a7b2602c2549dd03ad097c4a922a10a5e869645..5342eafe25614d262eeb39fa517a242e27d998f6 100644
index 06649ebed94f2d3e1a076e06e1027e4ee37a8c37..8cf4373486cbb913f9876891ed3bd6f5ee2b405f 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
@@ -12,6 +12,10 @@ public class EntitySection<T> {
@@ -13,6 +13,10 @@ public class EntitySection<T extends EntityAccess> {
protected static final Logger LOGGER = LogManager.getLogger();
private final ClassInstanceMultiMap<T> storage;
private Visibility chunkStatus;
@ -41,54 +41,45 @@ index 9a7b2602c2549dd03ad097c4a922a10a5e869645..5342eafe25614d262eeb39fa517a242e
public EntitySection(Class<T> entityClass, Visibility status) {
this.chunkStatus = status;
@@ -19,10 +23,24 @@ public class EntitySection<T> {
@@ -20,10 +24,24 @@ public class EntitySection<T extends EntityAccess> {
}
public void add(T obj) {
public void add(T entityAccess) {
+ // Paper start
+ if (obj instanceof net.minecraft.world.entity.item.ItemEntity) {
+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) {
+ this.itemCount++;
+ } else if (obj instanceof net.minecraft.world.Container) {
+ } else if (entityAccess instanceof net.minecraft.world.Container) {
+ this.inventoryEntityCount++;
+ }
+ // Paper end
this.storage.add(obj);
this.storage.add(entityAccess);
}
public boolean remove(T obj) {
public boolean remove(T entityAccess) {
+ // Paper start
+ if (obj instanceof net.minecraft.world.entity.item.ItemEntity) {
+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) {
+ this.itemCount--;
+ } else if (obj instanceof net.minecraft.world.Container) {
+ } else if (entityAccess instanceof net.minecraft.world.Container) {
+ this.inventoryEntityCount--;
+ }
+ // Paper end
return this.storage.remove(obj);
return this.storage.remove(entityAccess);
}
@@ -39,7 +57,7 @@ public class EntitySection<T> {
for(T object : this.storage.find(type.getBaseClass())) {
U object2 = (U)type.tryCast(object);
if (object2 != null && filter.test(object2)) {
- action.accept((T)object2);
+ action.accept(object2); // Paper - decompile fix
@@ -42,7 +60,7 @@ public class EntitySection<T extends EntityAccess> {
for(T entityAccess : collection) {
U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess));
if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(aABB)) {
- action.accept((T)entityAccess2);
+ action.accept(entityAccess2); // Paper - decompile fixes
}
}
}
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
index 067138e3983959347d19754e668bb7a1f702bad0..24552500307c42f9f3dc5c4d9ba73a84a787423a 100644
index 2e070899554a04c6be650b5b0557b704f972d63b..344e994887e44477c0fb070b5ddcbdb18e6d8e67 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
@@ -105,7 +105,7 @@ public class EntitySectionStorage<T extends EntityAccess> {
public LongSet getAllChunksWithExistingSections() {
LongSet longSet = new LongOpenHashSet();
- this.sections.keySet().forEach((sectionPos) -> {
+ this.sections.keySet().forEach((java.util.function.LongConsumer) (sectionPos) -> { // Paper - decompile fix
longSet.add(getChunkKeyFromSectionKey(sectionPos));
});
return longSet;
@@ -118,13 +118,20 @@ public class EntitySectionStorage<T extends EntityAccess> {
@@ -111,13 +111,20 @@ public class EntitySectionStorage<T extends EntityAccess> {
}
public void getEntities(AABB box, Consumer<T> action) {
@ -97,16 +88,16 @@ index 067138e3983959347d19754e668bb7a1f702bad0..24552500307c42f9f3dc5c4d9ba73a84
+ }
+ public void getEntities(AABB box, Consumer<T> action, boolean isContainerSearch) {
+ // Paper end
this.forEachAccessibleSection(box, (entitySection) -> {
this.forEachAccessibleNonEmptySection(box, (entitySection) -> {
+ if (isContainerSearch && entitySection.inventoryEntityCount <= 0) return; // Paper
entitySection.getEntities(createBoundingBoxCheck(box), action);
entitySection.getEntities(box, action);
});
}
public <U extends T> void getEntities(EntityTypeTest<T, U> filter, AABB box, Consumer<U> action) {
this.forEachAccessibleSection(box, (entitySection) -> {
this.forEachAccessibleNonEmptySection(box, (entitySection) -> {
+ if (filter.getBaseClass() == net.minecraft.world.entity.item.ItemEntity.class && entitySection.itemCount <= 0) return; // Paper
entitySection.getEntities(filter, createBoundingBoxCheck(box), action);
entitySection.getEntities(filter, box, action);
});
}
diff --git a/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java b/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 47be3e33f89bdd633aba381c8c3052cfebf64d48..2487d636338cb968496166c68c3155d2913d6c41 100644
index d5d61129d72f061ef1e45d39778072ee1e51fc2d..678912a37167a12695388682bef634d3715def68 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -143,7 +143,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -144,7 +144,22 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
public Bee(EntityType<? extends Bee> type, Level world) {
super(type, world);
this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(this.random, 20, 60);

Datei anzeigen

@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
then unwrap it...
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9f71dc37b0cef2284d6abc051b379cfa1b7e1eb5..9b69e1fe5432b25f0908dc977188d283ae9feac4 100644
index 0c84161d82245ab9d5c87a981a3c0f4fa5644640..f3de621c371d97c24dd0c5a8039204a221bd8a3a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -609,6 +609,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -610,6 +610,12 @@ public class ServerChunkCache extends ChunkSource {
return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join();
} else {
@ -23,7 +23,7 @@ index 9f71dc37b0cef2284d6abc051b379cfa1b7e1eb5..9b69e1fe5432b25f0908dc977188d283
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
gameprofilerfiller.incrementCounter("getChunk");
@@ -660,39 +666,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -661,39 +667,7 @@ public class ServerChunkCache extends ChunkSource {
if (Thread.currentThread() != this.mainThread) {
return null;
} else {

Datei anzeigen

@ -305,22 +305,22 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9b69e1fe5432b25f0908dc977188d283ae9feac4..c6213a7dfcf9aeccdb546eaf74fa8eb119a6a32c 100644
index f3de621c371d97c24dd0c5a8039204a221bd8a3a..2f31cae237b74e8281142c5ccf9ac4272607b8eb 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -641,6 +641,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -642,6 +642,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1);
// Paper end
+ com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_a.managedBlock(completablefuture::isDone);
chunkproviderserver_b.managedBlock(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0df81cbddf2e7f164861b95cf572f9d6d3f031ca..207bcd82065e4c1832e4d7814635017210bd9d4d 100644
index 09deaa9badf53bdc1292796c643751d8d92ac585..1ac40d31c5abefb062886757a78adc65daede768 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -366,6 +366,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -379,6 +379,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
};
public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
// Paper end

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Allow overriding the java version check
-DPaper.IgnoreJavaVersion=true
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 1da136f365664d4f8ace3d2d135b19eb97e55304..33fb61c219f5356a40c4e6e47187a3a606402536 100644
index 633cfb22039f22557d71cafcf42ea27f223b7b62..867c0802557375b63e69907bdb3ccd66644f1418 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -185,7 +185,7 @@ public class Main {
@@ -191,7 +191,7 @@ public class Main {
}
if (javaVersion > 61.0) {
System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 17 is supported.");

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Entity Jump API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7fc15f7731b9a249f5a1b82278c4ad61105462ce..3837cdc92174914e503dc573f496ea3464c7b566 100644
index 8217a8e2c170aa78586ae0054a35fc9158f70bae..06c32d50d6672d2816c8cb1b4ef0dc038ffce817 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3165,8 +3165,10 @@ public abstract class LivingEntity extends Entity {
@@ -3164,8 +3164,10 @@ public abstract class LivingEntity extends Entity {
} else if (this.isInLava() && (!this.onGround || d7 > d8)) {
this.jumpInLiquid((Tag) FluidTags.LAVA);
this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
this.jumpFromGround();
@ -20,10 +20,10 @@ index 7fc15f7731b9a249f5a1b82278c4ad61105462ce..3837cdc92174914e503dc573f496ea34
} else {
this.noJumpDelay = 0;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index ddc32ee8112e318f913546fcaa1fd6b26d59a672..dadc202da2d5568dce051b9cb4aadf20cfdd2c4f 100644
index 77be09e63eecef2ecb0b8002e0201c040323e7a5..52b9eb1546dac1c7f5b866e4afdce2e5a91cf3f3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -514,7 +514,9 @@ public class Panda extends Animal {
@@ -515,7 +515,9 @@ public class Panda extends Animal {
Panda entitypanda = (Panda) iterator.next();
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
@ -34,7 +34,7 @@ index ddc32ee8112e318f913546fcaa1fd6b26d59a672..dadc202da2d5568dce051b9cb4aadf20
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 814363d0dee4a91c2e1d5f91e67530fec383c0cb..05c36f6dbd4da2cf29cc4087e3c8a78ecff41337 100644
index fb0e0c629d16bc97efc3e91f7ba6fe9e87fc950b..be1540b0a5f95f8a85f91d5fe398cd2cf8832ec4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -824,5 +824,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c95659ffe4722b50ea341f60c99262b60b8d0b81..8e2a2a069cd66605344a4d129dbb673976bf2f1f 100644
index 911af1e2c493f6712422aeeb995bf385756cdaab..884ad8d42616167fcbaf3be341d75ebcc8279889 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -526,6 +526,11 @@ public class PaperWorldConfig {
@@ -514,6 +514,11 @@ public class PaperWorldConfig {
log("Hopper Ignore Occluding Blocks: " + (hoppersIgnoreOccludingBlocks ? "enabled" : "disabled"));
}
@ -21,10 +21,10 @@ index c95659ffe4722b50ea341f60c99262b60b8d0b81..8e2a2a069cd66605344a4d129dbb6739
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 06597d10c640daca400da9d5a4c186cc95bca1bf..c8e1f38de2189c16cedfbf848593e4ae06e911f3 100644
index 898ce2c6acb5a6af51a465344da4447809c2993a..c7581c1b306d9c6498e18456d67f5acd067357e6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -330,6 +330,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -334,6 +334,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
public long activatedImmunityTick = Integer.MIN_VALUE; // Paper
public boolean isTemporarilyActive = false; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@ -32,7 +32,7 @@ index 06597d10c640daca400da9d5a4c186cc95bca1bf..c8e1f38de2189c16cedfbf848593e4ae
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1892,6 +1893,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1921,6 +1922,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
}
@ -42,7 +42,7 @@ index 06597d10c640daca400da9d5a4c186cc95bca1bf..c8e1f38de2189c16cedfbf848593e4ae
// Paper end
return nbt;
} catch (Throwable throwable) {
@@ -2033,6 +2037,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2062,6 +2066,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -51,7 +51,7 @@ index 06597d10c640daca400da9d5a4c186cc95bca1bf..c8e1f38de2189c16cedfbf848593e4ae
String spawnReasonName = nbt.getString("Paper.SpawnReason");
try {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index e34716f2a19eb578fef3f19182c124d359deb88f..cfea29f5bf1c5e74a0292c1344baaaa49c2f4403 100644
index 8edc7e3cf88eeebc06408a713ba6a41c9bd53e40..d2b82872f6f8c3febb6c4b6468fd39f3549b1ed8 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -66,6 +66,8 @@ public class NetherPortalBlock extends Block {

Datei anzeigen

@ -384,7 +384,7 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880
+ }
+}
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 737ae68ab486a324628e994586862ef7397ae278..703d2bb93d6ab76fc117a320f155570addcc543c 100644
index f2d47ea5490c03184e4854e3df1b66760855754e..e5f071c6449dc12cfed939b6b8a21a20cd7c38f7 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -95,7 +95,7 @@ public class MinecraftServerGui extends JComponent {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 3ef52d7705f3c59e19c56aac6250f2e5b5712600..4c2ebb2eb93c1f8a805dbe0919f9726ccb4fff1f 100644
index 61c95f98a3e3e52a23f65f7c957019f7f1aa7417..bf7c61c767bdfe8ddb63367f1b38dbbeba17ba02 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -344,13 +344,18 @@ public class CraftEventFactory {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 98a0034f4e19a244c22619236cd8ab76b05df1bb..d4fac789cebd17e7b244002a7382d94cf0d80bb2 100644
index 23f06b3a4c7471bd3081c5e9ee78707c26280bfd..97c67fe091b2042a3aa98cc53d5e1ea1163a0966 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1480,6 +1480,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1494,6 +1494,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Validate tripwire hook placement before update
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 3a5252afa9681fb1956493bead27e6cdb13679ca..0cfa1abca2c5744a4147b05905983ae4acaa569a 100644
index 5efec24bbc23b6a4db29693cb875b8e2e7ece9e2..02a3e1ced592784b9c66927c76376c7ab413367d 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -174,6 +174,7 @@ public class TripWireHookBlock extends Block {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1eea1d2b0747b904ff30f0c6debb8f04fcbb6923..9ce95f6b6b53f6f30d3c9aeaee8938354fc0d3b5 100644
index 884ad8d42616167fcbaf3be341d75ebcc8279889..44657a8389ea367fd5254a17f719273dfa1aa7e5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -423,6 +423,11 @@ public class PaperWorldConfig {
@@ -416,6 +416,11 @@ public class PaperWorldConfig {
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
}
@ -21,15 +21,15 @@ index 1eea1d2b0747b904ff30f0c6debb8f04fcbb6923..9ce95f6b6b53f6f30d3c9aeaee893835
private void armorStandEntityLookups() {
armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
index cc02d6324c61ce5e6387577fd08c6dfb549001bc..bf731a227944875320857e5838d50f15af13b0c1 100644
index b73968d0aa35d42db3cfecbbb056f24d87fb5cf5..d6bff18a60e1b0b507a3797742bfafff2fad10d2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
@@ -322,7 +322,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
@@ -323,7 +323,7 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata = world.getBlockState(blockposition1);
- if (!iblockdata.entityCanStandOn((BlockGetter) world, blockposition1, (Entity) this)) {
+ if (!iblockdata.entityCanStandOn((BlockGetter) world, blockposition1, (Entity) this) && !level.paperConfig.ironGolemsCanSpawnInAir) { // Paper
- if (!iblockdata.entityCanStandOn(world, blockposition1, this)) {
+ if (!iblockdata.entityCanStandOn(world, blockposition1, this) && !level.paperConfig.ironGolemsCanSpawnInAir) { // Paper
return false;
} else {
for (int i = 1; i < 3; ++i) {

Datei anzeigen

@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where:
* On normal difficulty they will have a 50% of getting infected or dying.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b8e58219847a243516754c845732d1b1e3f56f23..955cc760f3eabe2fa2d88fe277ca923944eb9aea 100644
index 44657a8389ea367fd5254a17f719273dfa1aa7e5..7c1e0c45f6456026be8d7c1d84cec3600d0a55ac 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -536,6 +536,11 @@ public class PaperWorldConfig {
@@ -524,6 +524,11 @@ public class PaperWorldConfig {
nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
}
@ -24,10 +24,10 @@ index b8e58219847a243516754c845732d1b1e3f56f23..955cc760f3eabe2fa2d88fe277ca9239
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index c3fd3b354812dd690d68b45bc5a179778e4511e0..20d8e705ea432df64917b59f8290aa5400795f4b 100644
index a54af7c5b970102e8ff7f46bf4dd34b19faf3b8a..de140adee6679e27598ecd7fe292cd657c7af303 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -452,10 +452,13 @@ public class Zombie extends Monster {
@@ -449,10 +449,13 @@ public class Zombie extends Monster {
@Override
public void killed(ServerLevel world, LivingEntity other) {
super.killed(world, other);

Datei anzeigen

@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
easier to inline due to code size
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 83ed84f89a036d3768b22a36bc8a0bfc2bc29ec7..016c2302d8bcf121eafd1be7eb4f3b206dbdbeec 100644
index 805101792508bd721dd38fb57514f7f21bd90504..fc0ac2a5ad24951f05a18607318e5b5edf4f3463 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -461,18 +461,20 @@ public class LevelChunk implements ChunkAccess {
@@ -371,18 +371,20 @@ public class LevelChunk extends ChunkAccess {
}
public FluidState getFluidState(int x, int y, int z) {
@ -20,19 +20,17 @@ index 83ed84f89a036d3768b22a36bc8a0bfc2bc29ec7..016c2302d8bcf121eafd1be7eb4f3b20
-
- if (l >= 0 && l < this.sections.length) {
- LevelChunkSection chunksection = this.sections[l];
-
- if (!LevelChunkSection.isEmpty(chunksection)) {
- return chunksection.getFluidState(x & 15, y & 15, z & 15);
+ // try { // Paper - remove try catch
+ // Paper start - reduce the number of ops in this call
+ int index = this.getSectionIndex(y);
+ if (index >= 0 && index < this.sections.length) {
+ LevelChunkSection chunksection = this.sections[index];
+
+ if (chunksection != null) {
if (!chunksection.hasOnlyAir()) {
- return chunksection.getFluidState(x & 15, y & 15, z & 15);
+ return chunksection.states.get((y & 15) << 8 | (z & 15) << 4 | x & 15).getFluidState();
+ // Paper end
}
+ // Paper end
}
return Fluids.EMPTY.defaultFluidState();
@ -40,7 +38,7 @@ index 83ed84f89a036d3768b22a36bc8a0bfc2bc29ec7..016c2302d8bcf121eafd1be7eb4f3b20
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Getting fluid state");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Block being got");
@@ -482,6 +484,7 @@ public class LevelChunk implements ChunkAccess {
@@ -392,6 +394,7 @@ public class LevelChunk extends ChunkAccess {
});
throw new ReportedException(crashreport);
}
@ -49,14 +47,14 @@ index 83ed84f89a036d3768b22a36bc8a0bfc2bc29ec7..016c2302d8bcf121eafd1be7eb4f3b20
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index c9fefeef19bd46ade51b23eadb5eef3a88024ea1..cdac1f7b30e4c043dcb12ac9e29af926df8170bd 100644
index 92a42aea3f54c49e2055e8000645d91da9471e09..74f84597aa2631d693e4ed7b1ae525af4c80d37c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -50,7 +50,7 @@ public class LevelChunkSection {
@@ -48,7 +48,7 @@ public class LevelChunkSection {
}
public FluidState getFluidState(int x, int y, int z) {
- return this.states.get(x, y, z).getFluidState();
- return ((BlockState) this.states.get(x, y, z)).getFluidState();
+ return this.states.get(x, y, z).getFluidState(); // Paper - diff on change - we expect this to be effectively just getType(x, y, z).getFluid(). If this changes we need to check other patches that use IBlockData#getFluid.
}