Archiviert
13
0
Dieser Commit ist enthalten in:
Aurora 2021-06-14 11:46:59 +02:00
Ursprung 7fe98bd520
Commit ba3ce754a9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 89839F67B53656AD
22 geänderte Dateien mit 150 neuen und 218 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 5b382091b1466b25ad42325d5808785a8e948552..ecb5595332ab493224d06a75904e142ab541aad9 100644
index 4a6d58ef68b782291b4d26a8515be326481f5209..09dc74b0e10d075190009631c84a3710cc1f9177 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -714,5 +714,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -717,5 +717,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull
org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 4cffbc4f665e267371e99094e8b7de975fffc223..a1e211653e05f3c9bc2ddf5aa1b69dea1c4bb61b 100644
index 4eb60f2772c80f9917e88c40ed2214993709e443..26099f95d68540d4e6c54c32fd9699ff01660236 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1490,6 +1490,22 @@ public final class Bukkit {
@ -32,7 +32,7 @@ index 4cffbc4f665e267371e99094e8b7de975fffc223..a1e211653e05f3c9bc2ddf5aa1b69dea
* Creates a boss bar instance to display to players. The progress
* defaults to 1.0
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 969cba46ba2790dde32724111ad77332c5872e0b..71538dfce294776b8f98046cbddde21dc9ae89e7 100644
index 22495f576b05e3f0161bfd2c4ea5e5622fdb6302..864211431ebfe9bb333943c31892dfcbdeb33037 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1256,6 +1256,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -57,7 +57,7 @@ index 969cba46ba2790dde32724111ad77332c5872e0b..71538dfce294776b8f98046cbddde21d
* Creates a boss bar instance to display to players. The progress
* defaults to 1.0
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
index 7caef27682f22a77de283dd6f391ec8bc0b0312b..5ba77d40a38e5e592ee265e4fbd510043a0b4345 100644
index 9d7592988a2fbcc70f889b0622adbef014054d00..244a8a93c35d5a84e17672ff745051587bca384c 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -227,6 +227,22 @@ public abstract class ChunkGenerator {

Datei anzeigen

@ -5,6 +5,7 @@ Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
Update 1.17: looks like some things in here have been moved to some weird beardifier - has to be investigated further
diff --git a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
index e842dbc586234799a05b6df213b686e17b8ed1ac..2f88e015708cadb43a348ba2b144c3dd92bb95a5 100644
--- a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java

Datei anzeigen

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 6 Jul 2020 18:36:41 -0400
Subject: [PATCH] Fix Concurrency issue in WeightedList
1.17 Update: Looks like whatever this patch is trying to fix might be already fixed upstream, needs to be investigated
if multiple threads from worldgen sort at same time, it will crash.
So make a copy of the list for sorting purposes.

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Convert legacy attributes in Item Meta
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
index 2d547810125f00680ef7e60dd791d0bddd9ebd3e..320fd6780af2fa99e4e4f4193cbc9338d492dc6d 100644
index 0520c45197629cbdc2777d9ae11eef572e793160..46c313d581b9af6aa0a48f97ae3cc800a88535f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@@ -11,6 +11,20 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@ -30,10 +30,10 @@ index 2d547810125f00680ef7e60dd791d0bddd9ebd3e..320fd6780af2fa99e4e4f4193cbc9338
public CraftAttributeMap(AttributeMap handle) {
this.handle = handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 45abfebf3f947dcbd2e7b1d95be8ba918f044e51..cb66998dbaa9d93e92ef4045b83efbb0fd486234 100644
index 6252c3934d72b0d5e6809842bdd26d344cab98c6..daca454b375ab1d5900b6c3c9b6575463e47a3a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -480,7 +480,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -479,7 +479,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] Remove streams from classes related villager gossip
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 0204f05d989d45c0848f810d1953adf0992ce3c2..57832c392910d22aa81ac2b4816d043dd7ac867a 100644
index e316f83a7adc7bba06a6a3fdab55cc9c004cb835..bd661bcaf5eb65a4f34eec268ced84894d7d0898 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -9,6 +9,7 @@ import com.mojang.serialization.DynamicOps;
@@ -8,6 +8,7 @@ import com.mojang.serialization.Dynamic;
import com.mojang.serialization.DynamicOps;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import java.util.Arrays;
import java.util.Collection;
@@ -51,8 +52,21 @@ public class GossipContainer {
@@ -60,8 +61,21 @@ public class GossipContainer {
});
}
@ -34,40 +34,36 @@ index 0204f05d989d45c0848f810d1953adf0992ce3c2..57832c392910d22aa81ac2b4816d043d
+ // Paper end
+
private Collection<GossipContainer.GossipEntry> selectGossipsForTransfer(Random random, int count) {
- List<GossipContainer.GossipEntry> list = (List) this.unpack().collect(Collectors.toList());
- List<GossipContainer.GossipEntry> list = this.unpack().collect(Collectors.toList());
+ List<GossipContainer.GossipEntry> list = decompress(); // Paper - Remove streams from reputation
if (list.isEmpty()) {
return Collections.emptyList();
@@ -119,7 +133,7 @@ public class GossipContainer {
} else {
@@ -154,9 +168,9 @@ public class GossipContainer {
}
public <T> Dynamic<T> store(DynamicOps<T> dynamicops) {
- return new Dynamic(dynamicops, dynamicops.createList(this.unpack().map((reputation_b) -> {
- public <T> Dynamic<T> store(DynamicOps<T> dynamicOps) {
- return new Dynamic<>(dynamicOps, dynamicOps.createList(this.unpack().map((gossipEntry) -> {
- return gossipEntry.store(dynamicOps);
+ public <T> Dynamic<T> store(DynamicOps<T> dynamicops) {
+ return new Dynamic(dynamicops, dynamicops.createList(this.decompress().stream().map((reputation_b) -> {
return reputation_b.store(dynamicops);
+ return reputation_b.store(dynamicops);
}).map(Dynamic::getValue)));
}
@@ -144,18 +158,30 @@ public class GossipContainer {
public static class EntityGossips { // Paper - make public
- private final Object2IntMap<GossipType> entries;
+ private final Object2IntMap<GossipType> entries; private Object2IntMap<GossipType> getEntries() { return entries; } // Paper - OBFHELPER
public EntityGossips() { // Paper - make public - update CraftVillager setReputation on change
this.entries = new Object2IntOpenHashMap();
}
@@ -181,11 +195,23 @@ public class GossipContainer {
final Object2IntMap<GossipType> entries = new Object2IntOpenHashMap<>();
public int weightedValue(Predicate<GossipType> gossipTypeFilter) {
- return this.entries.object2IntEntrySet().stream().filter((entry) -> {
- return gossipTypeFilter.test(entry.getKey());
- }).mapToInt((entry) -> {
- return entry.getIntValue() * ((GossipType) entry.getKey()).weight;
- return entry.getIntValue() * (entry.getKey()).weight;
- }).sum();
+ // Paper start - Remove streams from reputation
+ int weight = 0;
+ for (Object2IntMap.Entry<GossipType> entry : getEntries().object2IntEntrySet()) {
+ for (Object2IntMap.Entry<GossipType> entry : entries.object2IntEntrySet()) {
+ if (gossipTypeFilter.test(entry.getKey())) {
+ weight += entry.getIntValue() * entry.getKey().getWeight();
+ }
@ -77,7 +73,7 @@ index 0204f05d989d45c0848f810d1953adf0992ce3c2..57832c392910d22aa81ac2b4816d043d
+
+ public List<GossipContainer.GossipEntry> decompress(UUID uuid) {
+ List<GossipContainer.GossipEntry> list = new ObjectArrayList<>();
+ for (Object2IntMap.Entry<GossipType> entry : getEntries().object2IntEntrySet()) {
+ for (Object2IntMap.Entry<GossipType> entry : entries.object2IntEntrySet()) {
+ list.add(new GossipContainer.GossipEntry(uuid, entry.getKey(), entry.getIntValue()));
+ }
+ return list;
@ -86,12 +82,12 @@ index 0204f05d989d45c0848f810d1953adf0992ce3c2..57832c392910d22aa81ac2b4816d043d
public Stream<GossipContainer.GossipEntry> unpack(UUID target) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
index 808eaaae5d534427d197c90c8e53494f4c3bfd82..c775d0df2a8f8a0fd32a8ffc26d6ea6978cbb595 100644
index c82b26dd4a16d77b7ed06c2919082edd62a3dffc..ad1b49cfa201fe6e80b3cd0204f8ffaf6115c081 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java
@@ -11,7 +11,7 @@ public enum GossipType {
MAJOR_NEGATIVE("major_negative", -5, 100, 10, 10), MINOR_NEGATIVE("minor_negative", -1, 200, 20, 20), MINOR_POSITIVE("minor_positive", 1, 200, 1, 5), MAJOR_POSITIVE("major_positive", 5, 100, 0, 100), TRADING("trading", 1, 25, 2, 20);
@@ -17,7 +17,7 @@ public enum GossipType {
public static final int REPUTATION_CHANGE_PER_EVERLASTING_MEMORY = 20;
public static final int REPUTATION_CHANGE_PER_TRADE = 2;
public final String id;
- public final int weight;
+ public final int weight; public int getWeight() { return weight; } // Paper - OBFHELPER

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index cb66998dbaa9d93e92ef4045b83efbb0fd486234..20e008277d1188fc7b31bfb2522ef9f6429cc3fb 100644
index daca454b375ab1d5900b6c3c9b6575463e47a3a9..81738dac125a7247fff5e51fa595667ef25ba0a1 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -874,11 +874,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -873,11 +873,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return CraftChatMessage.fromJSONComponent(displayName);
}
@ -31,8 +31,8 @@ index cb66998dbaa9d93e92ef4045b83efbb0fd486234..20e008277d1188fc7b31bfb2522ef9f6
+ // Paper end
@Override
public boolean hasDisplayName() {
return displayName != null;
@@ -1021,6 +1033,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.displayName != null;
@@ -1020,6 +1032,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, CraftChatMessage::fromJSONComponent));
}
@ -47,7 +47,7 @@ index cb66998dbaa9d93e92ef4045b83efbb0fd486234..20e008277d1188fc7b31bfb2522ef9f6
@Override
public void setLore(List<String> lore) {
if (lore == null || lore.isEmpty()) {
@@ -1035,6 +1055,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -1034,6 +1054,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
@ -68,8 +68,8 @@ index cb66998dbaa9d93e92ef4045b83efbb0fd486234..20e008277d1188fc7b31bfb2522ef9f6
+ // Paper end
@Override
public boolean hasCustomModelData() {
return customModelData != null;
@@ -1496,6 +1531,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.customModelData != null;
@@ -1494,6 +1529,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
for (Object object : addFrom) {

Datei anzeigen

@ -7,36 +7,36 @@ CraftBukkit has a bug in their implementation and is incorrectly handling forget
Also adds more target reasons for why it forgot target.
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
index 738162a55eb186f66df4d31e017c9b9a7cc604c2..1b6f34c2a185368aac973e8a5316a03950e4314b 100644
index 6ee0098de2b55a437f914869643adbd1ddbe7faf..00e0babb051b4fd2b9bc4a4129204c08f8ce5af0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
@@ -33,15 +33,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
@@ -50,15 +50,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
LivingEntity entityliving = this.getAttackTarget(entity);
protected void start(ServerLevel world, E entity, long time) {
if (isTiredOfTryingToReachTarget((LivingEntity) entity)) {
if (!entity.canAttack(entityliving)) {
- this.clearAttackTarget(entity);
+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
} else if (StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget((LivingEntity) entity)) {
- this.clearAttackTarget(entity);
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper
} else if (this.isCurrentTargetDeadOrRemoved(entity)) {
- this.clearAttackTarget(entity);
+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_DIED); // Paper
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_DIED); // Paper
} else if (this.isCurrentTargetInDifferentLevel(entity)) {
- this.clearAttackTarget(entity);
+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_OTHER_LEVEL); // Paper
} else if (!EntitySelector.ATTACK_ALLOWED.test(this.getAttackTarget(entity))) {
- this.clearAttackTarget(entity);
+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_OTHER_LEVEL); // Paper
} else if (this.stopAttackingWhen.test(this.getAttackTarget(entity))) {
- this.clearAttackTarget(entity);
+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
}
}
@@ -65,18 +65,21 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
@@ -82,19 +82,21 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
return optional.isPresent() && !((LivingEntity) optional.get()).isAlive();
}
- private void clearAttackTarget(E entity) {
+ private void d(E e0, EntityTargetEvent.TargetReason reason) {
- protected void clearAttackTarget(E entity) {
+ protected void clearAttackTarget(E e0, EntityTargetEvent.TargetReason reason) {
// CraftBukkit start
- LivingEntity old = entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
@ -56,7 +56,8 @@ index 738162a55eb186f66df4d31e017c9b9a7cc604c2..1b6f34c2a185368aac973e8a5316a039
+ }*/
+ // Paper end
// CraftBukkit end
- this.onTargetErased.accept(entity);
- entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
+ e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
+ this.onTargetErased.accept(e0);
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e9a658b11e2b6683831dc3f5bd20be9a7840ed69..aea2457510c75214bbb925307155611e981f115f 100644
index 96da70f1077f70c4bd5ba1196292a856deb25286..8531f1deea95aa8e73e75b714426c915a52a74af 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1164,12 +1164,13 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -1305,12 +1305,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return this.wasTouchingWater;
}
@ -23,7 +23,7 @@ index e9a658b11e2b6683831dc3f5bd20be9a7840ed69..aea2457510c75214bbb925307155611e
private boolean isInBubbleColumn() {
return this.level.getBlockState(this.blockPosition()).is(Blocks.BUBBLE_COLUMN);
}
@@ -1183,6 +1184,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
@@ -1324,6 +1325,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
}
@ -31,8 +31,8 @@ index e9a658b11e2b6683831dc3f5bd20be9a7840ed69..aea2457510c75214bbb925307155611e
public boolean isInWaterOrBubble() {
return this.isInWater() || this.isInBubbleColumn();
}
@@ -1325,6 +1327,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
return this.fluidOnEyes == tag;
@@ -1463,6 +1465,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return this.fluidOnEyes == fluidTag;
}
+ public final boolean isInLava() { return isInLava(); } // Paper - OBFHELPER
@ -40,10 +40,10 @@ index e9a658b11e2b6683831dc3f5bd20be9a7840ed69..aea2457510c75214bbb925307155611e
return !this.firstTick && this.fluidHeight.getDouble(FluidTags.LAVA) > 0.0D;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 76d652386806fd11961611486a1d0a12fe9616a4..deeae62e9926f9435907c68e7d35e7420f5e79dd 100644
index 98d3818d38f487fc7e1302ee4af9e4898efec809..26bfbab1e8332f91c4d2814cd0056ca2ea7ddab7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1135,5 +1135,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1169,5 +1169,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
return getHandle().spawnReason;
}

Datei anzeigen

@ -5,19 +5,11 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 458cdfbeac9d757c9721acd4557a548affa0ede1..04b717326524f400da3562655c25db59e72814ec 100644
index 10f55ba189d12c46e0ef38b0b96a29894b4fba93..c1667fa43194a17eeeb2ac9c5d57daf5cb131958 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -49,6 +49,7 @@ import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtOps;
+import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
@@ -135,6 +136,44 @@ public final class ItemStack {
list.sort((Comparator<? super Tag>) enchantSorter); // Paper
@@ -170,6 +170,44 @@ public final class ItemStack {
list.sort((Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
} catch (Exception ignored) {}
}
+
@ -42,7 +34,7 @@ index 458cdfbeac9d757c9721acd4557a548affa0ede1..04b717326524f400da3562655c25db59
+ try {
+ list.set(index, convert(json));
+ } catch (JsonParseException e) {
+ list.set(index, StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ list.set(index, net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ }
+ }
+ }
@ -50,26 +42,26 @@ index 458cdfbeac9d757c9721acd4557a548affa0ede1..04b717326524f400da3562655c25db59
+ }
+ }
+
+ private StringTag convert(String json) {
+ private net.minecraft.nbt.StringTag convert(String json) {
+ Component component = Component.Serializer.jsonToComponent(json);
+ if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) {
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0];
+ }
+ return StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ return net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
+ }
// Paper end
public ItemStack(ItemLike item) {
@@ -180,6 +219,7 @@ public final class ItemStack {
// CraftBukkit start - make defensive copy as this data may be coming from the save thread
@@ -216,6 +254,7 @@ public final class ItemStack {
this.tag = (CompoundTag) nbttagcompound.getCompound("tag").copy();
processEnchantOrder(this.tag); // Paper
+ processText(); // Paper
this.getItem().verifyTagAfterLoad(this.tag);
// CraftBukkit end
this.processEnchantOrder(this.tag); // Paper
+ this.processText(); // Paper
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -663,6 +703,7 @@ public final class ItemStack {
@@ -728,6 +767,7 @@ public final class ItemStack {
}
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Spawn player in correct world on login
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 713cc88dd067c0d918f253b1845f42c0d9eb920f..f36c92e42300c2056075610caf63f8bef0e7edda 100644
index 7eb3088d47ff78198e01a3a12b0ce6abe9d6ca6b..66735bbc2528c5812c9df14ef7cd91cb69d903b2 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -192,7 +192,18 @@ public abstract class PlayerList {
@@ -193,7 +193,18 @@ public abstract class PlayerList {
}String lastKnownName = s; // Paper
// CraftBukkit end

Datei anzeigen

@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 72b0cfcc5aab03e14e63440c734436e9c1432111..bc39e7464646d712b085251dc0277a5b1ec0a393 100644
index 92681e56cea92a4600ef268b21c1b56e15fe3a03..766c907f92ca8cb19b22cd19185cc92603aeca03 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -141,6 +141,7 @@ public abstract class AbstractContainerMenu {
@@ -214,6 +214,7 @@ public abstract class AbstractContainerMenu {
return nonnulllist;
}
@ -20,22 +20,22 @@ index 72b0cfcc5aab03e14e63440c734436e9c1432111..bc39e7464646d712b085251dc0277a5b
int i;
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 3d53edae7e3d5bb00913384ad0eb67551a65750e..492a42ad5dc460717de8179d522d042cee11db60 100644
index 1dad9577370bb58b27b32b997a505ce5145a6769..56d3ed1cdafd7904c35be5db568b9975a97418a7 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -307,6 +307,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -317,6 +317,7 @@ public class AnvilMenu extends ItemCombinerMenu {
}
this.createResult();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
}
// CraftBukkit start
public int getCost() {
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index 6183e33237a231be388a8ace0ca3b56720db13ee..464f27d3f0cc694257a550cf873a0ee4534e2189 100644
index 528fc4ee870303c6c42c603a9869f7e47825fd40..c96abb8945fe5dc2f963f548ccdd87272a445a7a 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -146,6 +146,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
this.setupResultSlot(itemstack, itemstack1, itemstack2);
}
@ -44,10 +44,10 @@ index 6183e33237a231be388a8ace0ca3b56720db13ee..464f27d3f0cc694257a550cf873a0ee4
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index e9e830117fe3e4e02a51eef8671a3d3b48c2858e..329a6d70d53c13cd554c64996f2ddc489bdc1e94 100644
index 34574f3945d2a7b4ab6a71adb2408b9811a3cb0d..b260216460b0bbf75edc631bb69e3e4fc94d459a 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -156,6 +156,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@@ -160,6 +160,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
super.slotsChanged(inventory);
if (inventory == this.repairSlots) {
this.createResult();
@ -56,10 +56,10 @@ index e9e830117fe3e4e02a51eef8671a3d3b48c2858e..329a6d70d53c13cd554c64996f2ddc48
}
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index d944cbcdf4d886d3b8b171edd8e2ac8a54dc19b9..8704c4dbead1ff661d84b751479babac5ebc5839 100644
index 982b7ac02335bfa2b752d900a5d0392c6660745b..eb1a0c6ce8ceab4955a5ac3d2fdf4d869a2a34ae 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -71,6 +71,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
@@ -78,6 +78,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
super.slotsChanged(inventory);
if (inventory == this.inputSlots) {
this.createResult();
@ -68,10 +68,10 @@ index d944cbcdf4d886d3b8b171edd8e2ac8a54dc19b9..8704c4dbead1ff661d84b751479babac
}
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index b33daf92752841e46f2fd9fa20dc1cfa79aa423a..3460fb2bb1451b8456a7fe42449ec4dbce641f40 100644
index 6d40ef2459e0ba5927ee723495cd6f5fd3101859..7e8b6e0e69876cb7bfd444a8dd72edf8289e6dd1 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -188,7 +188,8 @@ public class LoomMenu extends AbstractContainerMenu {
@@ -196,7 +196,8 @@ public class LoomMenu extends AbstractContainerMenu {
}
this.setupResultSlot();
@ -80,12 +80,12 @@ index b33daf92752841e46f2fd9fa20dc1cfa79aa423a..3460fb2bb1451b8456a7fe42449ec4db
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper
}
@Override
public void registerUpdateListener(Runnable inventoryChangeListener) {
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
index befb2e6294c3d0a16ae4766c3804d04fd4e1bba5..44aa1f4f91ae9f84fc7ed38cc6b3c11f07d55ba1 100644
index edb88d59a7b81b9d8b0328ce54ff1fbcf47323ae..c2b997bff39c8bf51c5f8f788696c92920b04868 100644
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
@@ -78,6 +78,7 @@ public class SmithingMenu extends ItemCombinerMenu {
@@ -76,6 +76,7 @@ public class SmithingMenu extends ItemCombinerMenu {
// CraftBukkit end
}
@ -94,10 +94,10 @@ index befb2e6294c3d0a16ae4766c3804d04fd4e1bba5..44aa1f4f91ae9f84fc7ed38cc6b3c11f
@Override
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index febf7fa112c470888af171e585ab6a052abb46ca..072bac443e7c54ac2b92e1d93b757bdacf230fbb 100644
index ddd34b07f7cf39a8b5ad51bdefb6e9d7cbf8f393..eac9765ecf0b33cab8b04204591de8d56c6f75c7 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -155,6 +155,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@@ -176,6 +176,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
this.setupRecipeList(inventory, itemstack);
}
@ -106,10 +106,10 @@ index febf7fa112c470888af171e585ab6a052abb46ca..072bac443e7c54ac2b92e1d93b757bda
private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 87fe7f4f5ed70bf1b3dc1e2a392ba42a1f8f568b..64cfa14aa4e32430a6970fd4f3654a56146ba807 100644
index d4b8035160332d98c37918f62ee9e0d630e23ee8..fc9c63b73211d05321776648d6ba9c54f14ba83d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1522,19 +1522,44 @@ public class CraftEventFactory {
@@ -1529,19 +1529,44 @@ public class CraftEventFactory {
return event;
}

Datei anzeigen

@ -4,33 +4,11 @@ Date: Wed, 29 Apr 2020 02:10:32 +0200
Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
index aaa8d78b131c4095b36c6db6078f57f927c15374..54e560348836498f16dde017c6e7e3fcc263eeea 100644
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
@@ -36,7 +36,7 @@ import org.apache.logging.log4j.Logger;
public class UpgradeData {
private static final Logger LOGGER = LogManager.getLogger();
- public static final UpgradeData EMPTY = new UpgradeData();
+ public static final UpgradeData EMPTY = new UpgradeData(); public static UpgradeData getEmptyConverter() { return EMPTY; } // Paper - obfhelper
private static final Direction8[] DIRECTIONS = Direction8.values();
private final EnumSet<Direction8> sides;
private final int[][] index;
@@ -322,7 +322,7 @@ public class UpgradeData {
if ((Integer) iblockdata.getValue(BlockStateProperties.DISTANCE) >= j) {
world.setBlock(blockposition, (BlockState) iblockdata.setValue(BlockStateProperties.DISTANCE, j), 18);
if (i != 7) {
- Direction[] aenumdirection = null.f;
+ Direction[] aenumdirection = DIRECTIONS; // Paper - decomp fix
int k = aenumdirection.length;
for (int l = 0; l < k; ++l) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2ec41cb87cec97780f1fa8abfbb756fca4dba1bf..e301aee53b19fc3f93a36d0ed03a649741123bfa 100644
index 6bc5ba51c90723c7138b1b5d2381cb215f1e5271..df2c41d18377d8519d5537186d529ecc1901f58a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2032,6 +2032,32 @@ public final class CraftServer implements Server {
@@ -2033,6 +2033,32 @@ public final class CraftServer implements Server {
return new CraftChunkData(world);
}
@ -64,20 +42,20 @@ index 2ec41cb87cec97780f1fa8abfbb756fca4dba1bf..e301aee53b19fc3f93a36d0ed03a6497
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
return new CraftBossBar(title, color, style, flags);
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
index 8d72cd6a44cf462cfe3adac9bf99a16883a587df..fd2cb2a584fea360fcf8180338708f35c4e3dc1f 100644
index 7f8d9e82c1fadc0621f6e94adbc31f7774f9568f..2f0849dd05605e693dcc12c3d0842e8dfa53a869 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
@@ -19,7 +19,7 @@ import org.bukkit.material.MaterialData;
*/
@@ -20,7 +20,7 @@ import org.bukkit.material.MaterialData;
public final class CraftChunkData implements ChunkGenerator.ChunkData {
private final int minHeight;
private final int maxHeight;
- private final LevelChunkSection[] sections;
+ private LevelChunkSection[] sections; // Paper - remove final
private Set<BlockPos> tiles;
private World world; // Paper - Anti-Xray - Add world
@@ -168,6 +168,12 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
return sections;
public CraftChunkData(World world) {
@@ -171,6 +171,12 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
return this.sections;
}
+ // Paper start
@ -87,13 +65,13 @@ index 8d72cd6a44cf462cfe3adac9bf99a16883a587df..fd2cb2a584fea360fcf8180338708f35
+ // Paper end
+
Set<BlockPos> getTiles() {
return tiles;
return this.tiles;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index eba3a6a2467116d93945ab2d5dc0a6f41d76f547..e25dc1c87752fcf73181cb02ddaf84b258ac4e9d 100644
index e9502acf47b94e529f3ce273add9b7e0f4fe6d72..a4c3e307e861e6c220425d35fe228dcb9dc7ef31 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -32,7 +32,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
@@ -34,7 +34,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
public class CustomChunkGenerator extends InternalChunkGenerator {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cec1e6105b8c2ac3d1482c00482d53d6be0d38d1..9724d4222311345a44aa101ec47523a1909fbe8f 100644
index 3a83cbe8fb1a5bfc7e7b699686b92561bf0cdba0..8781b3ac40f214974ebb3e06c789f1717735d3a6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3038,7 +3038,7 @@ public abstract class LivingEntity extends Entity {
@@ -3353,7 +3353,7 @@ public abstract class LivingEntity extends Entity {
Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - suppress

Datei anzeigen

@ -5,82 +5,44 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
index fca778d131aa10e88d5f7ed8d57eda6803318184..47a5ee9db64184f173af5984765e9b6d1a8ec367 100644
index e722cf3a8e816b0c7405e6282591d9fa8d5bfa61..22d1758e52f56b39a2c110f123bdbf80898c4d92 100644
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
@@ -151,6 +151,7 @@ public enum ConnectionProtocol {
@@ -275,6 +275,7 @@ public enum ConnectionProtocol {
@Nullable
public Packet<?> createPacket(int id) {
+ if (id < 0 || id >= this.idToConstructor.size()) return null; // Paper
Supplier<? extends Packet<T>> supplier = (Supplier) this.idToConstructor.get(id);
return supplier != null ? (Packet) supplier.get() : null;
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper
Function<FriendlyByteBuf, ? extends Packet<T>> function = this.idToDeserializer.get(id);
return function != null ? function.apply(buf) : null;
}
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
index 8363b63f8dbd16948eeba3f912dc43605ad8db6a..fbebef6525a0872fecc081c7f63f27c1a04e11dc 100644
index 5356f6484751e4b4740720aecac90bdfe044283b..ed54479b14dcfc736ac90749106557f0ff537550 100644
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
+++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
@@ -9,11 +9,21 @@ import java.util.List;
@@ -8,9 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
import java.util.List;
public class Varint21FrameDecoder extends ByteToMessageDecoder {
+ private final byte[] lenBuf = new byte[3]; // Paper
public Varint21FrameDecoder() {}
protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List<Object> list) throws Exception {
@Override
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) {
+ // Paper start - if channel is not active just discard the packet
+ if (!channelhandlercontext.channel().isActive()) {
+ bytebuf.skipBytes(bytebuf.readableBytes());
+ if (!channelHandlerContext.channel().isActive()) {
+ byteBuf.skipBytes(byteBuf.readableBytes());
+ return;
+ }
+ // Paper end
bytebuf.markReaderIndex();
- byte[] abyte = new byte[3];
byteBuf.markReaderIndex();
+ // Paper start - reuse temporary length buffer
+ byte[] abyte = lenBuf;
+ java.util.Arrays.fill(abyte, (byte) 0);
+ // Paper end
byte[] bs = new byte[3];
for (int i = 0; i < abyte.length; ++i) {
if (!bytebuf.isReadable()) {
diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java
index 22db5d0d2cc33498ca40162c66aa3b5fbf2f569f..3163502cb9bbbb5a00e7f06cf0032b1ad93c354d 100644
--- a/src/main/java/net/minecraft/network/protocol/Packet.java
+++ b/src/main/java/net/minecraft/network/protocol/Packet.java
@@ -2,8 +2,10 @@ package net.minecraft.network.protocol;
import io.netty.channel.ChannelFuture; // Paper
import java.io.IOException;
+import net.minecraft.network.Connection;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.PacketListener;
+import net.minecraft.server.level.ServerPlayer;
public interface Packet<T extends PacketListener> {
@@ -18,17 +20,17 @@ public interface Packet<T extends PacketListener> {
/**
* @param player Null if not at PLAY stage yet
*/
- default void onPacketDispatch(@javax.annotation.Nullable EntityPlayer player) {}
+ default void onPacketDispatch(@javax.annotation.Nullable ServerPlayer player) {}
/**
* @param player Null if not at PLAY stage yet
* @param future Can be null if packet was cancelled
*/
- default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable ChannelFuture future) {}
+ default void onPacketDispatchFinish(@javax.annotation.Nullable ServerPlayer player, @javax.annotation.Nullable ChannelFuture future) {}
default boolean hasFinishListener() { return false; }
default boolean isReady() { return true; }
default java.util.List<Packet> getExtraPackets() { return null; }
- default boolean packetTooLarge(NetworkManager manager) {
+ default boolean packetTooLarge(Connection manager) {
return false;
}
// Paper end
for(int i = 0; i < bs.length; ++i) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 4ae8201d7dcffeb3298a4e593f978e15ffc5ac15..5812e518222e419da141ab0f70d1e7a3939a0df0 100644
index 449f1b2f5dca350dc0912e14c8c2bf3eb4652b92..9e944aa41c184ebde1179399def662b2f08eef62 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -1,6 +1,9 @@
@ -93,7 +55,7 @@ index 4ae8201d7dcffeb3298a4e593f978e15ffc5ac15..5812e518222e419da141ab0f70d1e7a3
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import co.aikar.timings.MinecraftTimings; // Paper
@@ -30,6 +33,21 @@ public class PacketUtils {
@@ -32,6 +35,21 @@ public class PacketUtils {
try (Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} // Paper - timings
@ -113,5 +75,5 @@ index 4ae8201d7dcffeb3298a4e593f978e15ffc5ac15..5812e518222e419da141ab0f70d1e7a3
+ }
+ // Paper end
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet);
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize the advancement data player iteration to be O(N)
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 5ab62fc74085bbbb0c81b2f4d16a35c9345cd1f1..af8553f1b22e24fbeb732937fbbffc95cb9dfe90 100644
index 3d82f984648605d58fae3c57f145d0da8a2ae225..ce02a467c1c3434f2cdb112ceb9794196069a820 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -457,6 +457,16 @@ public class PlayerAdvancements {
@@ -437,6 +437,16 @@ public class PlayerAdvancements {
}
private void ensureVisibility(Advancement advancement) {
@ -26,7 +26,7 @@ index 5ab62fc74085bbbb0c81b2f4d16a35c9345cd1f1..af8553f1b22e24fbeb732937fbbffc95
boolean flag = this.shouldBeVisible(advancement);
boolean flag1 = this.visible.contains(advancement);
@@ -472,15 +482,23 @@ public class PlayerAdvancements {
@@ -452,15 +462,23 @@ public class PlayerAdvancements {
}
if (flag != flag1 && advancement.getParent() != null) {

Datei anzeigen

@ -9,10 +9,10 @@ instead of getting stuck in a never despawn state (bubble columns,
etc).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 6225f390b51733217a809910182f58acea1055e2..73df844610530bbfb133bd59d00015117b59b215 100644
index 988986d549dae93cfcb8147126c84f263efe3452..b6b729424dfade696cdf7117fc2bdf0dba03485f 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -169,6 +169,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -198,6 +198,7 @@ public abstract class AbstractArrow extends Projectile {
++this.inGroundTime;
} else {
@ -20,7 +20,7 @@ index 6225f390b51733217a809910182f58acea1055e2..73df844610530bbfb133bd59d0001511
this.inGroundTime = 0;
Vec3 vec3d2 = this.position();
@@ -290,6 +291,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -319,6 +320,7 @@ public abstract class AbstractArrow extends Projectile {
}

Datei anzeigen

@ -9,7 +9,7 @@ to race conditions.
Plus, .canUse we want to be safe for async anyways.
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
index 5c35cef42af4053332c02b4960c227fe95d4c197..757ed7a0887f4bdb187ca7c757db5c188362f1a0 100644
index aa3a1795850a419f624f14bd7c4daab0020779d0..39708be1b445791b053023dec16ad7d4efcc9048 100644
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
@@ -74,10 +74,10 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
@ -18,7 +18,7 @@ index 5c35cef42af4053332c02b4960c227fe95d4c197..757ed7a0887f4bdb187ca7c757db5c18
try {
- ((CommandSourceStack) source).currentCommand = this;
+ ((CommandSourceStack) source).currentCommand.set(this); // Paper
return requirement.test(source);
return this.requirement.test(source);
} finally {
- ((CommandSourceStack) source).currentCommand = null;
+ ((CommandSourceStack) source).currentCommand.set(null); // Paper
@ -26,7 +26,7 @@ index 5c35cef42af4053332c02b4960c227fe95d4c197..757ed7a0887f4bdb187ca7c757db5c18
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index e1f4ffaa36bfffb7741c74b7a094e26a03a9a1e6..2c024f8f8b949dc8cebd29a10415eeac6d50902e 100644
index 42d97bc67c8f4e5b65a81159179c43dc6edc804c..6a330170ec1ea9d06593a1bbd1bdb8d98c0904fb 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -54,7 +54,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@ -38,7 +38,7 @@ index e1f4ffaa36bfffb7741c74b7a094e26a03a9a1e6..2c024f8f8b949dc8cebd29a10415eeac
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String simpleName, Component name, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, simpleName, name, server, entity, false, (commandcontext, flag, j) -> {
@@ -171,9 +171,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@@ -175,9 +175,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@Override
public boolean hasPermission(int level) {
// CraftBukkit start
@ -46,7 +46,7 @@ index e1f4ffaa36bfffb7741c74b7a094e26a03a9a1e6..2c024f8f8b949dc8cebd29a10415eeac
+ // Paper start - fix concurrency issue
+ CommandNode currentCommand = this.currentCommand.get();
if (currentCommand != null) {
return hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
return this.hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
+ // Paper end
}
// CraftBukkit end

Datei anzeigen

@ -5,28 +5,30 @@ Subject: [PATCH] Move range check for block placing up
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 773f2589c14e16d2f5b01a6dbd48e09d17d19c7e..d264fca2737f83a0860394f7bb6b269ffe669594 100644
index 39777c2b1bbb12ce3e5be3724235ea0a8072cef8..99a16a2f0c2dc227dd45db1964c2d47ffdcda73e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1661,15 +1661,19 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1693,17 +1693,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Direction enumdirection = movingobjectpositionblock.getDirection();
+ // Paper start - move check up
+ Location eyeLoc = this.getPlayer().getEyeLocation();
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
+ if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
+ if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
+ return;
+ }
+ // Paper end - move check up
+
this.player.resetLastActionTime();
if (blockposition.getY() < this.server.getMaxBuildHeight()) {
int i = this.player.level.getMaxBuildHeight();
if (blockposition.getY() < i) {
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition)) {
// CraftBukkit start - Check if we can actually do something over this large a distance
- Location eyeLoc = this.getPlayer().getEyeLocation();
- Location eyeLoc = this.getCraftPlayer().getEyeLocation();
- double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
- if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
- if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? ServerGamePacketListenerImpl.CREATIVE_PLACE_DISTANCE_SQUARED : ServerGamePacketListenerImpl.SURVIVAL_PLACE_DISTANCE_SQUARED)) {
- return;
- }
+ // Paper - move check up