13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Jason Penilla 2021-06-13 22:32:56 -07:00
Ursprung d001eefd7e
Commit 3c02c90f3e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8
23 geänderte Dateien mit 157 neuen und 219 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Spawn Reason API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 476184db904d8a2e1347e1219e8ba196bf4da5cb..c1010e314144a65e12eaf5514d639a87f45891a9 100644 index cd96c851d00185e7ee3ec6682b166fc1d06b6a73..10c22809535b6151b45aa18a02b80b8f2e3e6dff 100644
--- a/src/main/java/org/bukkit/World.java --- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@

Datei anzeigen

@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 3418133d07250a7fd50caad8d97924b86fb30bad..b09d12390d5f77330ac84452e0fee63a169bd01f 100644 index 66f11e9670770e05a164922cc0f2aa863c066203..c307a58b17324d6df8c21fa45f0f1e34810f1828 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -240,6 +240,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -240,6 +240,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder

Datei anzeigen

@ -63,7 +63,7 @@ index ce751577623eaad0f31e2eb7bf0842d1ab73e845..31793f46e5623729dfb4048e901f2740
for (PluginClassLoader loader : loaders) { for (PluginClassLoader loader : loaders) {
try { try {
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index b9766b9b47547c400ed075f1635bb1461cb5e860..87016d01640d8ea86b93cf2f7ead4c88b6d9d778 100644 index 550225f168160298f4b1bf6c361207a59cf23122..9c2bde2820b92d17bc2241957390f3fb3cc50d98 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -33,7 +33,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot @@ -33,7 +33,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
@ -82,5 +82,5 @@ index b9766b9b47547c400ed075f1635bb1461cb5e860..87016d01640d8ea86b93cf2f7ead4c88
- Class<?> result = loader.getClassByName(name, resolve, description); - Class<?> result = loader.getClassByName(name, resolve, description);
+ Class<?> result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self + Class<?> result = loader.getClassByName(name, resolve, description, this); // Paper - prioritize self
if (result != null) {
// If the class was loaded from a library instead of a PluginClassLoader, we can assume that its associated plugin is a transitive dependency and can therefore skip this check. // If the class was loaded from a library instead of a PluginClassLoader, we can assume that its associated plugin is a transitive dependency and can therefore skip this check.
if (result != null && result.getClassLoader() instanceof PluginClassLoader) {

Datei anzeigen

@ -8,10 +8,10 @@ however, this provides no indication of the owner of the classloader, making
these messages effectively useless, this patch rectifies this these messages effectively useless, this patch rectifies this
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 87016d01640d8ea86b93cf2f7ead4c88b6d9d778..cb62666d14a8eeb6338ecef75d57a1946cfa99a4 100644 index 9c2bde2820b92d17bc2241957390f3fb3cc50d98..6b5d7c350c216b7a234d96ecacae1d39a1acd814 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -228,4 +228,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot @@ -230,4 +230,16 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
javaPlugin.logger = this.logger; // Paper - set logger javaPlugin.logger = this.logger; // Paper - set logger
javaPlugin.init(loader, loader.server, description, dataFolder, file, this); javaPlugin.init(loader, loader.server, description, dataFolder, file, this);
} }

Datei anzeigen

@ -11,47 +11,23 @@ This patch basically serves as a workaround by sending light maps
to the client, so that it doesn't attempt to calculate them. to the client, so that it doesn't attempt to calculate them.
This mitigates the frametime impact to a minimum (but it's still there). This mitigates the frametime impact to a minimum (but it's still there).
1.17 update note: Line sending the light update packet needs updating, rest seems to be mostly fine
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 738f1183ce663db7c67d2f0289823390a7f06a0e..8070acde38c47c364c1d26ec3b7d65da037554a5 100644 index d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7..f700ac973ebc3037a5a44eac3c9d505b98adce41 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
@@ -85,6 +85,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator; @@ -1906,9 +1906,68 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.ImposterProtoChunk;
import net.minecraft.world.level.chunk.LevelChunk;
+import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.LightChunkGetter;
import net.minecraft.world.level.chunk.ProtoChunk;
import net.minecraft.world.level.chunk.UpgradeData;
@@ -2018,7 +2019,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start public void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) { // Paper - private -> public
private static int getLightMask(final LevelChunk chunk) {
- final ChunkSection[] chunkSections = chunk.getSections();
+ final LevelChunkSection[] chunkSections = chunk.getSections();
int mask = 0;
for (int i = 0; i < chunkSections.length; ++i) {
@@ -2029,7 +2030,7 @@ Lightmasks have 18 bits, from the -1 (void) section until the 17th (air) section
Sections go from 0..16. Now whenever a section is not empty, it can potentially change lighting for the section itself, the section below and the section above, hence the bitmask 111b, which is 7d.
*/
- mask |= (ChunkSection.isEmpty(chunkSections[i]) ? 0 : 7) << i;
+ mask |= (LevelChunkSection.isEmpty(chunkSections[i]) ? 0 : 7) << i;
}
return mask;
@@ -2060,9 +2061,68 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
public final void sendChunk(ServerPlayer entityplayer, Packet<?>[] apacket, LevelChunk chunk) { this.playerLoadedChunk(entityplayer, apacket, chunk); } // Paper - OBFHELPER
private void playerLoadedChunk(ServerPlayer player, Packet<?>[] packets, LevelChunk chunk) {
if (packets[0] == null) { if (packets[0] == null) {
+ // Paper start - add 8 for light fix workaround + // Paper start - add 8 for light fix workaround
+ if (packets.length != 10) { // in case Plugins call sendChunk, resize + if (packets.length != 10) { // in case Plugins call sendChunk, resize
+ packets = new Packet[10]; + packets = new Packet[10];
+ } + }
+ // Paper end + // Paper end
packets[0] = new ClientboundLevelChunkPacket(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(player, chunk, 65535)); // Paper - Anti-Xray - Bypass packets[0] = new ClientboundLevelChunkPacket(chunk);
packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, true); packets[1] = new ClientboundLightUpdatePacket(chunk.getPos(), this.lightEngine, (BitSet) null, (BitSet) null, true);
+ +
+ // Paper start - Fix MC-162253 + // Paper start - Fix MC-162253
+ final int lightMask = getLightMask(chunk); + final int lightMask = getLightMask(chunk);
@ -75,7 +51,7 @@ index 738f1183ce663db7c67d2f0289823390a7f06a0e..8070acde38c47c364c1d26ec3b7d65da
+ continue; + continue;
+ } + }
+ +
+ packets[i] = new ClientboundLightUpdatePacket(new ChunkPos(chunk.getPos().x + x, chunk.getPos().z + z), lightEngine, updateLightMask, 0, true); + packets[i] = new ClientboundLightUpdatePacket(new ChunkPos(chunk.getPos().x + x, chunk.getPos().z + z), lightEngine, null, null, updateLightMask, 0, true); // TODO: This line needs updating
+ } + }
+ } + }
+ } + }
@ -111,10 +87,10 @@ index 738f1183ce663db7c67d2f0289823390a7f06a0e..8070acde38c47c364c1d26ec3b7d65da
player.trackChunk(chunk.getPos(), packets[0], packets[1]); player.trackChunk(chunk.getPos(), packets[0], packets[1]);
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java 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 dbea2a4370ccf24a5084cdabeecbc81f206e910a..9b76dc15417eef420804e5184a6d684e1137a746 100644 index a63dc77db41dab79f03ef7384da55c1cdeca5d98..7cced5d06f296fcdc1209a43e7b3d1d9b47c0b26 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -279,7 +279,7 @@ public class LevelChunk implements ChunkAccess { @@ -262,7 +262,7 @@ public class LevelChunk implements ChunkAccess {
// broadcast // broadcast
Object[] backingSet = inRange.getBackingSet(); Object[] backingSet = inRange.getBackingSet();
@ -122,16 +98,4 @@ index dbea2a4370ccf24a5084cdabeecbc81f206e910a..9b76dc15417eef420804e5184a6d684e
+ Packet[] chunkPackets = new Packet[10]; + Packet[] chunkPackets = new Packet[10];
for (int index = 0, len = backingSet.length; index < len; ++index) { for (int index = 0, len = backingSet.length; index < len; ++index) {
Object temp = backingSet[index]; Object temp = backingSet[index];
if (!(temp instanceof ServerPlayer)) { if (!(temp instanceof net.minecraft.server.level.ServerPlayer)) {
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 5e7f6000df129100ef306703f325af9f60da8ae6..cc7d930c1fcd7157efc181d766e1639669f6eab9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -107,6 +107,7 @@ public class LevelChunkSection {
return this.nonEmptyBlockCount == 0;
}
+ public static boolean isEmpty(@Nullable LevelChunkSection chunksection) { return isEmpty(chunksection) ; } // Paper - OBFHELPER
public static boolean isEmpty(@Nullable LevelChunkSection section) {
return section == LevelChunk.EMPTY_SECTION || section.isEmpty();
}

Datei anzeigen

@ -5,6 +5,8 @@ Subject: [PATCH] Stop copy-on-write operations for updating light data
Causes huge memory allocations + gc issues Causes huge memory allocations + gc issues
1.17 update note: Needs updating, temp skipped
diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java
index 9f33fa8f84d10f8f4089030074ad6c0d81269ce8..a1ad4d73ddaf6afe97a1f1ff7e0622b52fac8761 100644 index 9f33fa8f84d10f8f4089030074ad6c0d81269ce8..a1ad4d73ddaf6afe97a1f1ff7e0622b52fac8761 100644
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/BlockLightSectionStorage.java

Datei anzeigen

@ -8,6 +8,8 @@ an object pool for these.
Uses lots of advanced new capabilities of the Paper codebase :) Uses lots of advanced new capabilities of the Paper codebase :)
1.17 update note: ClientboundLightUpdatePacket has has made changes which necessitate updating this patch
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java
index bc1b4cc2e0a4181bde5ac05ce0a20a651cb0c4c3..902f14e2e5ac5aa11b545a68ac69e9b0282df7f4 100644 index bc1b4cc2e0a4181bde5ac05ce0a20a651cb0c4c3..902f14e2e5ac5aa11b545a68ac69e9b0282df7f4 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java

Datei anzeigen

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 8 May 2020 00:49:18 -0400
Subject: [PATCH] Fix PotionEffect ignores icon flag
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5dac3bf5a117bfbf57798238f0614558deafcd1b..067eaf1e05ced344eb168431403f3fe786eafddf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -408,7 +408,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
- getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
return true;
}

Datei anzeigen

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 15 May 2020 01:10:03 -0400
Subject: [PATCH] Ensure safe gateway teleport
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index b70e0633435a272ae1e9fbd12d7f18862de0b951..3491956cb09b825bbfc99667b058d67cef127332 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -86,9 +86,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity implements
} else if (!this.level.isClientSide) {
List<Entity> list = this.level.getEntitiesOfClass(Entity.class, new AABB(this.getBlockPos()), TheEndGatewayBlockEntity::canEntityTeleport);
- if (!list.isEmpty()) {
- this.teleportEntity((Entity) list.get(this.level.random.nextInt(list.size())));
+ // Paper start
+ for (Entity entity : list) {
+ if (entity.canChangeDimensions()) {
+ this.teleportEntity(entity);
+ break;
+ }
}
+ // Paper end
if (this.age % 2400L == 0L) {
this.triggerCooldown();

Datei anzeigen

@ -6,15 +6,13 @@ Subject: [PATCH] Add villager reputation API
diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..c6072615e95bf51c83b2f728fc3288a7043a89af index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084adfd3789
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java +++ b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationConstructor.java
@@ -0,0 +1,11 @@ @@ -0,0 +1,9 @@
+package com.destroystokyo.paper.entity.villager; +package com.destroystokyo.paper.entity.villager;
+// Must have own package due to package-level constructor. +// Must have own package due to package-level constructor.
+ +
+import Reputation;
+
+public final class ReputationConstructor { +public final class ReputationConstructor {
+ // Abuse the package-level constructor. + // Abuse the package-level constructor.
+ public static Reputation construct(int[] values) { + public static Reputation construct(int[] values) {
@ -22,33 +20,28 @@ index 0000000000000000000000000000000000000000..c6072615e95bf51c83b2f728fc3288a7
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index c4ece3ac4863067b12c10772debd1b1454bec5b4..0204f05d989d45c0848f810d1953adf0992ce3c2 100644 index 07ecb01d02f64e85d478995062a33b58c211ed7e..e316f83a7adc7bba06a6a3fdab55cc9c004cb835 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -27,7 +27,7 @@ import net.minecraft.core.SerializableUUID; @@ -29,7 +29,7 @@ import net.minecraft.util.VisibleForDebug;
public class GossipContainer { public class GossipContainer {
public static final int DISCARD_THRESHOLD = 2;
- private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap(); - private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap();
+ private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap(); public Map<UUID, GossipContainer.EntityGossips> getReputations() { return this.gossips; } // Paper - add getter for reputations + private final Map<UUID, GossipContainer.EntityGossips> gossips = Maps.newHashMap(); public Map<UUID, GossipContainer.EntityGossips> getReputations() { return this.gossips; } // Paper - add getter for reputations
public GossipContainer() {} @VisibleForDebug
public Map<UUID, Object2IntMap<GossipType>> getGossipEntries() {
@@ -142,11 +142,11 @@ public class GossipContainer { @@ -177,7 +177,7 @@ public class GossipContainer {
return k > type.max ? Math.max(type.max, left) : k; return i > type.max ? Math.max(type.max, left) : i;
} }
- static class EntityGossips { - static class EntityGossips {
+ public static class EntityGossips { // Paper - make public + public static class EntityGossips { // Paper - make public
final Object2IntMap<GossipType> entries = new Object2IntOpenHashMap<>();
private final Object2IntMap<GossipType> entries; public int weightedValue(Predicate<GossipType> gossipTypeFilter) {
@@ -228,6 +228,28 @@ public class GossipContainer {
- private EntityGossips() {
+ public EntityGossips() { // Paper - make public - update CraftVillager setReputation on change
this.entries = new Object2IntOpenHashMap();
}
@@ -200,6 +200,28 @@ public class GossipContainer {
public void remove(GossipType gossipType) { public void remove(GossipType gossipType) {
this.entries.removeInt(gossipType); this.entries.removeInt(gossipType);
} }
@ -78,10 +71,10 @@ index c4ece3ac4863067b12c10772debd1b1454bec5b4..0204f05d989d45c0848f810d1953adf0
static class GossipEntry { static class GossipEntry {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index a83a7d37f3d769535161fda46fca6f71dcc4d515..e9912551e6a19d6ad3b20fad1b716577b9d28f99 100644 index e99cdbb1d050288b5f1177737b242c331a989471..8508a3864fc3f8919f823d96f27061a6b3706713 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -1037,6 +1037,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -1065,6 +1065,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.numberOfRestocksToday = 0; this.numberOfRestocksToday = 0;
} }
@ -90,7 +83,7 @@ index a83a7d37f3d769535161fda46fca6f71dcc4d515..e9912551e6a19d6ad3b20fad1b716577
return this.gossips; return this.gossips;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index d0b933cfd02b237bfe85011831dab6e8e966496e..e3d4214ef6360b4a9949a73ba3d665ad08733b43 100644 index 115f107ac100524ef0fcf8de0fc528d164c845f7..b15db2bf0a0bbe39b8067559fbf2b6bdadf56ca4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -16,6 +16,13 @@ import org.bukkit.entity.Villager; @@ -16,6 +16,13 @@ import org.bukkit.entity.Villager;

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 8 May 2020 00:49:18 -0400
Subject: [PATCH] Fix PotionEffect ignores icon flag
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 76e9977f7b2f7fb50631fc56f3318d59d04b1398..a7a6757b83c94a0c0926097021015815f8f18b8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -400,7 +400,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
- this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
return true;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Optimize brigadier child sorting performance
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
index 120234605433165d1c78986b5f0f130e64c5a20a..5c35cef42af4053332c02b4960c227fe95d4c197 100644 index b8d646864a24bba376661cfd87901012416c669d..aa3a1795850a419f624f14bd7c4daab0020779d0 100644
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
@@ -26,7 +26,7 @@ import java.util.stream.Collectors; @@ -26,7 +26,7 @@ import java.util.stream.Collectors;
@ -17,13 +17,12 @@ index 120234605433165d1c78986b5f0f130e64c5a20a..5c35cef42af4053332c02b4960c227fe
private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap(); private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap();
private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap(); private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap();
private final Predicate<S> requirement; private final Predicate<S> requirement;
@@ -106,8 +106,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { @@ -107,7 +107,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
arguments.put(node.getName(), (ArgumentCommandNode<S, ?>) node);
} }
} }
-
- children = children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); - this.children = this.children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ //Paper - Remove manual sorting, it is no longer needed + // Paper - Remove manual sorting, it is no longer needed
} }
public void findAmbiguities(final AmbiguityConsumer<S> consumer) { public void findAmbiguities(final AmbiguityConsumer<S> consumer) {

Datei anzeigen

@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index ae6faa331fcbefd99ee1cd92c88926d767fc50ee..878a62e04962aafeaf192075fbe08e319298a800 100644 index 31b62dc1ee06b254c398cbfe157283fb199ef0fe..36ea76bfe0bd96ead82ed1ad34f25de10b7fa30e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag; @@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag;
@ -19,8 +19,8 @@ index ae6faa331fcbefd99ee1cd92c88926d767fc50ee..878a62e04962aafeaf192075fbe08e31
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.MenuProvider; import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@@ -126,6 +127,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -125,6 +126,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getHandle().sleepCounter; return this.getHandle().sleepCounter;
} }
+ // Paper start - Potential bed api + // Paper start - Potential bed api

Datei anzeigen

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does. if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 74f393ffa2ae2d0e25b3f0b674cef7a987e985d3..f530c739b6aee3718eb5d0e0e6a09d882d817c68 100644 index d7023cb0974f6c28a0fb8a0a6e5a6600fe30d3e3..11dbe48c8a8c29cd28d725c43505e326a6e626ff 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -892,6 +892,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -945,6 +945,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();
@ -22,7 +22,7 @@ index 74f393ffa2ae2d0e25b3f0b674cef7a987e985d3..f530c739b6aee3718eb5d0e0e6a09d88
// CraftBukkit end // CraftBukkit end
if (this.getConnection() != null) { if (this.getConnection() != 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 c6dc314a1735bf849ee1572e01335909bed9b455..92f1a6d32a96fee682342e86c3ffd3c65292150b 100644 index 4d6a6583af73a25b5f2783ba56a63b8c9987c0a4..94670ec4de01341822f6affe0fa1c9774dd6131b 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
@@ -937,6 +937,35 @@ public final class CraftServer implements Server { @@ -937,6 +937,35 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 6406b0a03b67ea61083b704cd24b9b25a0f33c87..5502615be430d9eba0c1c68e3f10826d75b08672 100644 index 37f4becb39d6d4c13aa0c3901ed123083518cdbf..49028fef0706a4413e446c337750f31e756e8de1 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java --- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -523,7 +523,7 @@ public abstract class Raider extends PatrollingMonster { @@ -305,7 +305,7 @@ public abstract class Raider extends PatrollingMonster {
public class ObtainRaidLeaderBannerGoal<T extends Raider> extends Goal { public class ObtainRaidLeaderBannerGoal<T extends Raider> extends Goal {
@ -18,7 +18,7 @@ index 6406b0a03b67ea61083b704cd24b9b25a0f33c87..5502615be430d9eba0c1c68e3f10826d
public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error
this.mob = entityraider; this.mob = entityraider;
@@ -532,6 +532,7 @@ public abstract class Raider extends PatrollingMonster { @@ -314,6 +314,7 @@ public abstract class Raider extends PatrollingMonster {
@Override @Override
public boolean canUse() { public boolean canUse() {

Datei anzeigen

@ -35,18 +35,18 @@ index 78271b400c79578d043b20a5389a37b1bef9a70d..5f3b0d95cc7e6a0434d78ea7305a7068
+ +
} }
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 667a6d645034c67639c01b8221591877bcb87b35..0f0a5fa2be5a7c69291b593a04cad83e069ba5b1 100644 index cdf214fca3b0055efa56702470d9d2f890a8aead..a12af10e28f2d023ba6f916b5e7a53539416713f 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -151,6 +151,7 @@ public class Explosion { @@ -174,6 +174,7 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = new BlockPos(d4, d5, d6); BlockPos blockposition = new BlockPos(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition); BlockState iblockdata = this.level.getBlockState(blockposition);
+ if (!iblockdata.isDestroyable()) continue; // Paper + if (!iblockdata.isDestroyable()) continue; // Paper
FluidState fluid = iblockdata.getFluidState(); // Paper FluidState fluid = iblockdata.getFluidState(); // Paper
Optional<Float> optional = this.damageCalculator.a(this, this.level, blockposition, iblockdata, fluid);
@@ -304,7 +305,7 @@ public class Explosion { if (!this.level.isInWorldBounds(blockposition)) {
@@ -332,7 +333,7 @@ public class Explosion {
BlockState iblockdata = this.level.getBlockState(blockposition); BlockState iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -56,10 +56,10 @@ index 667a6d645034c67639c01b8221591877bcb87b35..0f0a5fa2be5a7c69291b593a04cad83e
this.level.getProfiler().push("explosion_blocks"); this.level.getProfiler().push("explosion_blocks");
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 67ab681a9c9157a420de5fd872bde1fc0de24561..9b50b8030174338c04b60d441b980131e1d593e4 100644 index 03271675b4997588bd8f6774856aef25cdd4fa05..581e7975c4bfcc902e262003843fe54212bc5b61 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
@@ -422,6 +422,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -419,6 +419,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (this.captureTreeGeneration) { if (this.captureTreeGeneration) {
@ -67,14 +67,14 @@ index 67ab681a9c9157a420de5fd872bde1fc0de24561..9b50b8030174338c04b60d441b980131
+ BlockState type = getBlockState(pos); + BlockState type = getBlockState(pos);
+ if (!type.isDestroyable()) return false; + if (!type.isDestroyable()) return false;
+ // Paper end + // Paper end
CraftBlockState blockstate = capturedBlockStates.get(pos); CraftBlockState blockstate = this.capturedBlockStates.get(pos);
if (blockstate == null) { if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
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 fca5d175cbef24fb0ee2d0bbedc8d1c0af3eb528..5b84ee4091e354c4b6500f58a31931f2a6827ffc 100644 index 27016f964d2f6458298a9052d031a44b3d9f5f4b..878cdfc49253e7916d038495f79fec7cce75aa50 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
@@ -62,6 +62,19 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -91,6 +91,19 @@ public class Block extends BlockBehaviour implements ItemLike {
protected final StateDefinition<Block, BlockState> stateDefinition; protected final StateDefinition<Block, BlockState> stateDefinition;
private BlockState defaultBlockState; private BlockState defaultBlockState;
// Paper start // Paper start
@ -95,10 +95,10 @@ index fca5d175cbef24fb0ee2d0bbedc8d1c0af3eb528..5b84ee4091e354c4b6500f58a31931f2
public co.aikar.timings.Timing getTiming() { public co.aikar.timings.Timing getTiming() {
if (timing == null) { if (timing == null) {
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 dc9584a30c18d964afd9cc118c81c24a80beba63..40a18302dd682e5ade4ec77ac7f316b6c0f8c112 100644 index c345bd7542f3ffa09719864887e1516f1182e7e3..44cc09006eac6315d167a2628857f9942eb1fc13 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
@@ -193,6 +193,12 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -200,6 +200,12 @@ public class PistonBaseBlock extends DirectionalBlock {
@Override @Override
public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) { public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING); Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING);
@ -111,16 +111,16 @@ index dc9584a30c18d964afd9cc118c81c24a80beba63..40a18302dd682e5ade4ec77ac7f316b6
if (!world.isClientSide) { if (!world.isClientSide) {
boolean flag = this.getNeighborSignal(world, pos, enumdirection); boolean flag = this.getNeighborSignal(world, pos, enumdirection);
@@ -224,7 +230,7 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -232,7 +238,7 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
world.setBlock(pos, iblockdata1, 20); world.setBlock(pos, iblockdata1, 20);
- world.setBlockEntity(pos, MovingPistonBlock.newMovingBlockEntity((BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); - world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true));
+ world.setBlockEntity(pos, MovingPistonBlock.newMovingBlockEntity((BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change, j is facing direction - copy this above + world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata1, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change
world.blockUpdated(pos, iblockdata1.getBlock()); world.blockUpdated(pos, iblockdata1.getBlock());
iblockdata1.updateNeighbourShapes(world, pos, 2); iblockdata1.updateNeighbourShapes(world, pos, 2);
if (this.isSticky) { if (this.isSticky) {
@@ -253,7 +259,14 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -261,7 +267,14 @@ public class PistonBaseBlock extends DirectionalBlock {
} }
} }
} else { } else {
@ -137,19 +137,19 @@ index dc9584a30c18d964afd9cc118c81c24a80beba63..40a18302dd682e5ade4ec77ac7f316b6
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 57eedaeedaa24bd274fb55c6e4521f1305382645..df2836b071158729728411f5b228cc38dddd4d4e 100644 index d99ca942f5885b4d9af054547832c05ddb5634eb..6d4ef15842c6bd230543de19dd1053a4fe6ad270 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -189,7 +189,7 @@ public abstract class BlockBehaviour { @@ -206,7 +206,7 @@ public abstract class BlockBehaviour {
@Deprecated @Deprecated
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
- return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || context.getItemInHand().getItem() != this.asItem()); - return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem()));
+ return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || context.getItemInHand().getItem() != this.asItem()) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().abilities.instabuild)); // Paper + return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper
} }
@Deprecated @Deprecated
@@ -393,7 +393,11 @@ public abstract class BlockBehaviour { @@ -656,7 +656,11 @@ public abstract class BlockBehaviour {
public Block getBlock() { public Block getBlock() {
return (Block) this.owner; return (Block) this.owner;
} }
@ -162,7 +162,7 @@ index 57eedaeedaa24bd274fb55c6e4521f1305382645..df2836b071158729728411f5b228cc38
public Material getMaterial() { public Material getMaterial() {
return this.material; return this.material;
} }
@@ -483,7 +487,7 @@ public abstract class BlockBehaviour { @@ -754,7 +758,7 @@ public abstract class BlockBehaviour {
} }
public PushReaction getPistonPushReaction() { public PushReaction getPistonPushReaction() {

Datei anzeigen

@ -7,44 +7,44 @@ We can abuse the fact light is single threaded and share an instance
per light engine instance per light engine instance
diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
index 8979101a52537f4ec03a5f43030264b8e72fcea4..709fc42057f8a0282c3c942067e63abb874d9042 100644 index 729c4b1763a24bac3c0764bea505555a32e54f57..37d7165dfd17da03428f8dbbbf95aa8005be289c 100644
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java --- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java +++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
@@ -16,6 +16,7 @@ public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionSt @@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionStorage.BlockDataLayerStorageMap, BlockLightSectionStorage> {
private static final Direction[] DIRECTIONS = Direction.values(); private static final Direction[] DIRECTIONS = Direction.values();
private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
+ private final MutableInt mutableint = new MutableInt(); // Paper + private final MutableInt mutableInt = new MutableInt(); // Paper
public BlockLightEngine(LightChunkGetter chunkProvider) { public BlockLightEngine(LightChunkGetter chunkProvider) {
super(chunkProvider, LightLayer.BLOCK, new BlockLightSectionStorage(chunkProvider)); super(chunkProvider, LightLayer.BLOCK, new BlockLightSectionStorage(chunkProvider));
@@ -47,7 +48,7 @@ public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionSt @@ -44,7 +45,7 @@ public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionSt
if (enumdirection == null) { if (direction == null) {
return 15; return 15;
} else { } else {
- MutableInt mutableint = new MutableInt(); - MutableInt mutableInt = new MutableInt();
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded + //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
BlockState iblockdata = this.getStateAndOpacity(targetId, mutableint); BlockState blockState = this.getStateAndOpacity(targetId, mutableInt);
if (mutableInt.getValue() >= 15) {
if (mutableint.getValue() >= 15) { return 15;
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
index d99890121bdf1e499e364bdc953e628c04d69b95..ff1fbc46776b26ca56c3293e40ed55028230ec46 100644 index 4252247acd5c71e46d90f454663a9737e22e2a61..d122475c1a9d340046c478087d3ff5bf1ff8932c 100644
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java --- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java +++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
@@ -15,6 +15,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag @@ -14,6 +14,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> {
private static final Direction[] DIRECTIONS = Direction.values(); private static final Direction[] DIRECTIONS = Direction.values();
private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST}; private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST};
+ private final MutableInt mutableint = new MutableInt(); // Paper + private final MutableInt mutableInt = new MutableInt(); // Paper
public SkyLightEngine(LightChunkGetter chunkProvider) { public SkyLightEngine(LightChunkGetter chunkProvider) {
super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider)); super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider));
@@ -36,7 +37,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag @@ -25,7 +26,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag
if (level >= 15) { if (level >= 15) {
return level; return level;
} else { } else {
- MutableInt mutableint = new MutableInt(); - MutableInt mutableInt = new MutableInt();
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded + //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
BlockState iblockdata = this.getStateAndOpacity(targetId, mutableint); BlockState blockState = this.getStateAndOpacity(targetId, mutableInt);
if (mutableInt.getValue() >= 15) {
if (mutableint.getValue() >= 15) { return 15;

Datei anzeigen

@ -5,18 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
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 67f748d5955453ba4873b0c9bb741b5bfe52d655..738f1183ce663db7c67d2f0289823390a7f06a0e 100644 index 18335e2c5c9e50a8ed31a3d2b585835bcc28bbe6..d8f99f7f5ca0e1dbbb9b760af3a4b4f9c52ef6c7 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
@@ -95,7 +95,6 @@ import net.minecraft.world.level.levelgen.structure.StructureStart; @@ -2102,9 +2102,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource;
-import net.minecraft.world.phys.Vec3;
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.logging.log4j.LogManager;
@@ -2233,9 +2232,14 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
public void updatePlayer(ServerPlayer player) { public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) { if (player != this.entity) {
@ -31,16 +23,16 @@ index 67f748d5955453ba4873b0c9bb741b5bfe52d655..738f1183ce663db7c67d2f0289823390
- boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.entity.broadcastToPlayer(player); - boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.entity.broadcastToPlayer(player);
+ boolean flag = vec3d_dx >= (double) (-i) && vec3d_dx <= (double) i && vec3d_dz >= (double) (-i) && vec3d_dz <= (double) i && this.entity.broadcastToPlayer(player); // Paper - remove allocation of Vec3D here + boolean flag = vec3d_dx >= (double) (-i) && vec3d_dx <= (double) i && vec3d_dz >= (double) (-i) && vec3d_dz <= (double) i && this.entity.broadcastToPlayer(player); // Paper - remove allocation of Vec3D here
if (flag) { // CraftBukkit start - respect vanish API
boolean flag1 = this.entity.forcedLoading; if (this.entity instanceof ServerPlayer) {
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 d797873db52ba265ac4478f9f3c6344badd4739e..75e2274578c2c28de3d786372df0b4102337a2cc 100644 index 6b492b72b177e3c58580561585609b176876acf1..8ea4209400489116823eced292d8cd9654a1c809 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
@@ -154,8 +154,12 @@ public class ServerEntity { @@ -145,8 +145,12 @@ public class ServerEntity {
++this.teleportDelay; ++this.teleportDelay;
i = Mth.floor(this.entity.yRot * 256.0F / 360.0F); i = Mth.floor(this.entity.getYRot() * 256.0F / 360.0F);
j = Mth.floor(this.entity.xRot * 256.0F / 360.0F); j = Mth.floor(this.entity.getXRot() * 256.0F / 360.0F);
- Vec3 vec3d = this.entity.position().subtract(ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp)); - Vec3 vec3d = this.entity.position().subtract(ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp));
- boolean flag1 = vec3d.lengthSqr() >= 7.62939453125E-6D; - boolean flag1 = vec3d.lengthSqr() >= 7.62939453125E-6D;
+ // Paper start - reduce allocation of Vec3D here + // Paper start - reduce allocation of Vec3D here
@ -52,7 +44,7 @@ index d797873db52ba265ac4478f9f3c6344badd4739e..75e2274578c2c28de3d786372df0b410
Packet<?> packet1 = null; Packet<?> packet1 = null;
boolean flag2 = flag1 || this.tickCount % 60 == 0; boolean flag2 = flag1 || this.tickCount % 60 == 0;
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1; boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
@@ -172,9 +176,11 @@ public class ServerEntity { @@ -163,9 +167,11 @@ public class ServerEntity {
// CraftBukkit end // CraftBukkit end
if (this.tickCount > 0 || this.entity instanceof AbstractArrow) { if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {

Datei anzeigen

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 15 May 2020 01:10:03 -0400
Subject: [PATCH] Ensure safe gateway teleport
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 370ec4cd08a50ad0b8154db9afcaa76ec741dcb2..782becb96b6300f14deee360b653dc99c57fdc12 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -105,7 +105,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
List<Entity> list = world.getEntitiesOfClass(Entity.class, new AABB(pos), TheEndGatewayBlockEntity::canEntityTeleport);
if (!list.isEmpty()) {
- TheEndGatewayBlockEntity.teleportEntity(world, pos, state, (Entity) list.get(world.random.nextInt(list.size())), blockEntity);
+ // Paper start
+ for (Entity entity : list) {
+ if (entity.canChangeDimensions()) {
+ TheEndGatewayBlockEntity.teleportEntity(world, pos, state, entity, blockEntity);
+ break;
+ }
+ }
+ // Paper end
}
if (blockEntity.age % 2400L == 0L) {

Datei anzeigen

@ -18,21 +18,8 @@ index 5f3b0d95cc7e6a0434d78ea7305a70689c41c71c..7f140333c2e62012fa572c1a061d8443
+ } + }
+ +
} }
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 525cd44411b344bc4b5d43c087094fea88fa41a6..4817b8ab259d348b48bc325d34ba9351ffe951df 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1886,7 +1886,7 @@ public abstract class Player extends LivingEntity {
}
}
- protected void removeEntitiesOnShoulder() {
+ public void removeEntitiesOnShoulder() { // Paper - protected -> public
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {
// CraftBukkit start
if (this.spawnEntityFromShoulder(this.getShoulderEntityLeft())) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
index af986adfdb547cb61fbd52f0f89858f1a9e52cc3..80a67deaeaae3b3f0ceb9a298de5bb38b8ee707b 100644 index a885eb537d6475eefe7d06f8312ecf0a278c5a00..4d95d4f4b354fc22c29c55bb70010282a4d3c5d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
@@ -86,5 +86,15 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co @@ -86,5 +86,15 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
@ -52,7 +39,7 @@ index af986adfdb547cb61fbd52f0f89858f1a9e52cc3..80a67deaeaae3b3f0ceb9a298de5bb38
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
index d0757d116ee689041c0e64e622d2c36e0b0bcaf1..7b53b5a0857fc0ce0463db319f86a1f79833ab93 100644 index c2d163c078b569e3e97ee01d149c5c3e87f55513..d1ce98ca68690542c6864c189bc114f1f715b2b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java --- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
@@ -39,4 +39,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme @@ -39,4 +39,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme

Datei anzeigen

@ -16,23 +16,23 @@ We further improve it by making a copy of the nbt tag with only the memory
it needs, so that we dont have to hold a copy to the entire compound. it needs, so that we dont have to hold a copy to the entire compound.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 1e58958c3d7b10da5a5f22fc9591d9183e53e3cc..0adf14af9841cd3a20a8b2c0c320eb06794ef261 100644 index 7c04aef3eac54981ca1e34cb87d97104c3c9685b..b4246524dd11ad1e1dc94c56eee966c5a54d9ecc 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -26,6 +26,7 @@ import net.minecraft.nbt.CompoundTag; @@ -27,6 +27,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.LongArrayTag; import net.minecraft.nbt.LongArrayTag;
import net.minecraft.nbt.ShortTag; import net.minecraft.nbt.ShortTag;
+import net.minecraft.nbt.Tag; +import net.minecraft.nbt.Tag;
import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ThreadedLevelLightEngine;
@@ -199,15 +200,9 @@ public class ChunkSerializer { @@ -207,15 +208,9 @@ public class ChunkSerializer {
object2 = protochunkticklist1; object2 = protochunkticklist1;
} }
- object = new LevelChunk(worldserver.getLevel(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, (chunk) -> { - object = new LevelChunk(world.getLevel(), pos, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, k, achunksection, (chunk) -> {
- postLoadChunk(nbttagcompound1, chunk); - ChunkSerializer.postLoadChunk(world, nbttagcompound1, chunk);
- // CraftBukkit start - load chunk persistent data from nbt - // CraftBukkit start - load chunk persistent data from nbt
- net.minecraft.nbt.Tag persistentBase = nbttagcompound1.get("ChunkBukkitValues"); - net.minecraft.nbt.Tag persistentBase = nbttagcompound1.get("ChunkBukkitValues");
- if (persistentBase instanceof CompoundTag) { - if (persistentBase instanceof CompoundTag) {
@ -40,13 +40,13 @@ index 1e58958c3d7b10da5a5f22fc9591d9183e53e3cc..0adf14af9841cd3a20a8b2c0c320eb06
- } - }
- // CraftBukkit end - // CraftBukkit end
- }); - });
+ object = new LevelChunk(worldserver.getLevel(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, // Paper start - fix massive nbt memory leak due to lambda. move lambda into a container method to not leak scope. Only clone needed NBT keys. + object = new LevelChunk(world.getLevel(), pos, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, k, achunksection, // Paper start - fix massive nbt memory leak due to lambda. move lambda into a container method to not leak scope. Only clone needed NBT keys.
+ createLoadEntitiesConsumer(new SafeNBTCopy(nbttagcompound1, "TileEntities", "Entities", "ChunkBukkitValues")) // Paper - move CB Chunk PDC into here + createLoadEntitiesConsumer(new SafeNBTCopy(nbttagcompound1, "TileEntities", "Entities", "ChunkBukkitValues")) // Paper - move CB Chunk PDC into here
+ );// Paper end + );// Paper end
} else { } else {
ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, world); // Paper - add level
@@ -313,6 +308,50 @@ public class ChunkSerializer { @@ -321,6 +316,50 @@ public class ChunkSerializer {
return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading
} }
} }
@ -84,7 +84,7 @@ index 1e58958c3d7b10da5a5f22fc9591d9183e53e3cc..0adf14af9841cd3a20a8b2c0c320eb06
+ } + }
+ private static java.util.function.Consumer<LevelChunk> createLoadEntitiesConsumer(CompoundTag nbt) { + private static java.util.function.Consumer<LevelChunk> createLoadEntitiesConsumer(CompoundTag nbt) {
+ return (chunk) -> { + return (chunk) -> {
+ postLoadChunk(nbt, chunk); + postLoadChunk(chunk.level, nbt, chunk);
+ // CraftBukkit start - load chunk persistent data from nbt + // CraftBukkit start - load chunk persistent data from nbt
+ Tag persistentBase = nbt.get("ChunkBukkitValues"); + Tag persistentBase = nbt.get("ChunkBukkitValues");
+ if (persistentBase instanceof CompoundTag) { + if (persistentBase instanceof CompoundTag) {