[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-21 13:56:22 +01:00
parent 98e6d20ebd
commit e9e0bc168d
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
57 changed files with 324 additions and 349 deletions

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 8e8bcf829818fbbaedb13d9eddca096d457c511a..19e8d10727fc4838cd8261dfec92f3828ea5b09f 100644 index 7f85121b6830ebf480c5ca7b42d3c835911de836..9b9504ca32d8cc7c037e0a96f2d8aa03d5c5495d 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -407,6 +407,7 @@ public final class ItemStack { @@ -407,6 +407,7 @@ public final class ItemStack {
enuminteractionresult = InteractionResult.FAIL; // cancel placement enuminteractionresult = InteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed // PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory(); placeEvent.getPlayer().updateInventory();
+ world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot + world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot
// revert back all captured blocks // revert back all captured blocks
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710 world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
for (BlockState blockstate : blocks) { for (BlockState blockstate : blocks) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
index d4f5af759bbb6208432ad7b5002af5455dc7958c..a71414397bd45ee7bcacfeef0041d80dfa25f114 100644 index d4f5af759bbb6208432ad7b5002af5455dc7958c..9b1243d96e0694c62fc9e82e9be540bce0d2b3ad 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
@@ -237,7 +237,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement @@ -237,7 +237,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
@ -25,7 +25,7 @@ index d4f5af759bbb6208432ad7b5002af5455dc7958c..a71414397bd45ee7bcacfeef0041d80d
@Override @Override
public boolean onlyOpCanSetNbt() { public boolean onlyOpCanSetNbt() {
- return true; - return true;
+ return false; // Paper + return false; // Paper - Allow chests to be placed with NBT data
} }
// CraftBukkit end // CraftBukkit end
} }

View File

@ -160,30 +160,30 @@ index 0000000000000000000000000000000000000000..064712e7b27a200b29c72076a82f4f56
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
index 539dc45c3c7ffc60cf3fb47ae4df65e604e8627b..eea4c932d909145e7af848cf76e3f49dbb2deff2 100644 index 539dc45c3c7ffc60cf3fb47ae4df65e604e8627b..3049edb5a8b5967e5242a3896b23665888eb3472 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
@@ -18,6 +18,7 @@ public class Path { @@ -18,6 +18,7 @@ public class Path {
private final BlockPos target; private final BlockPos target;
private final float distToTarget; private final float distToTarget;
private final boolean reached; private final boolean reached;
+ public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper + public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper - Mob Pathfinding API
public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) { public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) {
this.nodes = nodes; this.nodes = nodes;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index a75623fd1b2d36530c55c7a380e68b8dc7e58021..c2acbf533b5f3aebe4837512f694fe25abee65d6 100644 index a75623fd1b2d36530c55c7a380e68b8dc7e58021..018884ced888fcd03d2fb17b3620f8e6125e67da 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -15,8 +15,11 @@ import org.bukkit.loot.LootTable; @@ -15,8 +15,11 @@ import org.bukkit.loot.LootTable;
public abstract class CraftMob extends CraftLivingEntity implements Mob { public abstract class CraftMob extends CraftLivingEntity implements Mob {
public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) { public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) {
super(server, entity); super(server, entity);
+ paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper + paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper - Mob Pathfinding API
} }
+ private final com.destroystokyo.paper.entity.PaperPathfinder paperPathfinder; // Paper + private final com.destroystokyo.paper.entity.PaperPathfinder paperPathfinder; // Paper - Mob Pathfinding API
+ @Override public com.destroystokyo.paper.entity.Pathfinder getPathfinder() { return paperPathfinder; } // Paper + @Override public com.destroystokyo.paper.entity.Pathfinder getPathfinder() { return paperPathfinder; } // Paper - Mob Pathfinding API
@Override @Override
public void setTarget(LivingEntity target) { public void setTarget(LivingEntity target) {
Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation"); Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
@ -191,13 +191,13 @@ index a75623fd1b2d36530c55c7a380e68b8dc7e58021..c2acbf533b5f3aebe4837512f694fe25
return (net.minecraft.world.entity.Mob) this.entity; return (net.minecraft.world.entity.Mob) this.entity;
} }
+ // Paper start + // Paper start - Mob Pathfinding API
+ @Override + @Override
+ public void setHandle(net.minecraft.world.entity.Entity entity) { + public void setHandle(net.minecraft.world.entity.Entity entity) {
+ super.setHandle(entity); + super.setHandle(entity);
+ paperPathfinder.setHandle(getHandle()); + paperPathfinder.setHandle(getHandle());
+ } + }
+ // Paper end + // Paper end - Mob Pathfinding API
+ +
@Override @Override
public String toString() { public String toString() {

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu> From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:55 +0300 Date: Wed, 12 Sep 2018 18:53:55 +0300
Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38814c18e1 100644 index ff199678850d848c5d2ce76270d674738eec58f7..1ecea757fffb480af0d27c3326093d79cb93c73b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -85,6 +85,12 @@ import org.bukkit.persistence.PersistentDataContainer; @@ -85,6 +85,12 @@ import org.bukkit.persistence.PersistentDataContainer;
@ -25,10 +25,10 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
@Specific(Specific.To.NBT) @Specific(Specific.To.NBT)
static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag"); static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag");
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues"); static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy"); + static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy");
+ static final ItemMetaKey CAN_PLACE_ON = new ItemMetaKey("CanPlaceOn"); + static final ItemMetaKey CAN_PLACE_ON = new ItemMetaKey("CanPlaceOn");
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
// We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304 // We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304
private String displayName; private String displayName;
@ -36,10 +36,10 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
private int hideFlag; private int hideFlag;
private boolean unbreakable; private boolean unbreakable;
private int damage; private int damage;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ private Set<Namespaced> placeableKeys = Sets.newHashSet(); + private Set<Namespaced> placeableKeys = Sets.newHashSet();
+ private Set<Namespaced> destroyableKeys = Sets.newHashSet(); + private Set<Namespaced> destroyableKeys = Sets.newHashSet();
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
private static final Set<String> HANDLED_TAGS = Sets.newHashSet(); private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
@ -47,7 +47,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
this.hideFlag = meta.hideFlag; this.hideFlag = meta.hideFlag;
this.unbreakable = meta.unbreakable; this.unbreakable = meta.unbreakable;
this.damage = meta.damage; this.damage = meta.damage;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (meta.hasPlaceableKeys()) { + if (meta.hasPlaceableKeys()) {
+ this.placeableKeys = new java.util.HashSet<>(meta.placeableKeys); + this.placeableKeys = new java.util.HashSet<>(meta.placeableKeys);
+ } + }
@ -55,7 +55,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
+ if (meta.hasDestroyableKeys()) { + if (meta.hasDestroyableKeys()) {
+ this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys); + this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
+ } + }
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
this.unhandledTags.putAll(meta.unhandledTags); this.unhandledTags.putAll(meta.unhandledTags);
this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw()); this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
@ -63,7 +63,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
this.persistentDataContainer.put(key, compound.get(key).copy()); this.persistentDataContainer.put(key, compound.get(key).copy());
} }
} }
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (tag.contains(CAN_DESTROY.NBT)) { + if (tag.contains(CAN_DESTROY.NBT)) {
+ ListTag list = tag.getList(CAN_DESTROY.NBT, CraftMagicNumbers.NBT.TAG_STRING); + ListTag list = tag.getList(CAN_DESTROY.NBT, CraftMagicNumbers.NBT.TAG_STRING);
+ for (int i = 0; i < list.size(); i++) { + for (int i = 0; i < list.size(); i++) {
@ -87,7 +87,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
+ this.placeableKeys.add(namespaced); + this.placeableKeys.add(namespaced);
+ } + }
+ } + }
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
Set<String> keys = tag.getAllKeys(); Set<String> keys = tag.getAllKeys();
for (String key : keys) { for (String key : keys) {
@ -95,7 +95,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
this.setDamage(damage); this.setDamage(damage);
} }
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ Iterable<?> canPlaceOnSerialized = SerializableMeta.getObject(Iterable.class, map, CAN_PLACE_ON.BUKKIT, true); + Iterable<?> canPlaceOnSerialized = SerializableMeta.getObject(Iterable.class, map, CAN_PLACE_ON.BUKKIT, true);
+ if (canPlaceOnSerialized != null) { + if (canPlaceOnSerialized != null) {
+ for (Object canPlaceOnElement : canPlaceOnSerialized) { + for (Object canPlaceOnElement : canPlaceOnSerialized) {
@ -121,7 +121,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
+ this.destroyableKeys.add(value); + this.destroyableKeys.add(value);
+ } + }
+ } + }
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
+ +
String internal = SerializableMeta.getString(map, "internal", true); String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) { if (internal != null) {
@ -130,7 +130,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
if (this.hasDamage()) { if (this.hasDamage()) {
itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage); itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage);
} }
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (hasPlaceableKeys()) { + if (hasPlaceableKeys()) {
+ List<String> items = this.placeableKeys.stream() + List<String> items = this.placeableKeys.stream()
+ .map(this::serializeNamespaced) + .map(this::serializeNamespaced)
@ -146,7 +146,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
+ +
+ itemTag.put(CAN_DESTROY.NBT, createNonComponentStringList(items)); + itemTag.put(CAN_DESTROY.NBT, createNonComponentStringList(items));
+ } + }
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
for (Map.Entry<String, Tag> e : this.unhandledTags.entrySet()) { for (Map.Entry<String, Tag> e : this.unhandledTags.entrySet()) {
itemTag.put(e.getKey(), e.getValue()); itemTag.put(e.getKey(), e.getValue());
@ -154,7 +154,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
} }
} }
+ // Paper start + // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ static ListTag createNonComponentStringList(List<String> list) { + static ListTag createNonComponentStringList(List<String> list) {
+ if (list == null || list.isEmpty()) { + if (list == null || list.isEmpty()) {
+ return null; + return null;
@ -167,7 +167,7 @@ index ff199678850d848c5d2ce76270d674738eec58f7..df7a93208a2a0720fc3cd33f84cace38
+ +
+ return tagList; + return tagList;
+ } + }
+ // Paper end + // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
+ +
ListTag createStringList(List<String> list) { ListTag createStringList(List<String> list) {
if (list == null) { if (list == null) {

View File

@ -3,15 +3,13 @@ From: Tassu <git@tassu.me>
Date: Thu, 13 Sep 2018 08:45:21 +0300 Date: Thu, 13 Sep 2018 08:45:21 +0300
Subject: [PATCH] Implement furnace cook speed multiplier API Subject: [PATCH] Implement furnace cook speed multiplier API
Signed-off-by: Tassu <git@tassu.me>
Fixed an issue where a furnace's cook-speed multiplier rounds down Fixed an issue where a furnace's cook-speed multiplier rounds down
to the nearest Integer when updating its current cook time. to the nearest Integer when updating its current cook time.
Modified by: Eric Su <ericsu@alumni.usc.edu> Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca5a7589cd 100644 index 7a13042631bea761952490cfd14dc20147405161..9801b777bc6ab7de91d82b29a142459292ee8605 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -78,11 +78,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -78,11 +78,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -24,7 +22,7 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
protected final ContainerData dataAccess; protected final ContainerData dataAccess;
public final Object2IntOpenHashMap<ResourceLocation> recipesUsed; public final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck; private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck;
+ public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper + public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper - cook speed multiplier API
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) { protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(blockEntityType, pos, state); super(blockEntityType, pos, state);
@ -32,7 +30,7 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
}; };
this.recipesUsed = new Object2IntOpenHashMap(); this.recipesUsed = new Object2IntOpenHashMap();
this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
+ this.recipeType = recipeType; // Paper + this.recipeType = recipeType; // Paper - cook speed multiplier API
} }
public static Map<Item, Integer> getFuel() { public static Map<Item, Integer> getFuel() {
@ -40,11 +38,11 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s)); this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
} }
+ // Paper start - cook speed API + // Paper start - cook speed multiplier API
+ if (nbt.contains("Paper.CookSpeedMultiplier")) { + if (nbt.contains("Paper.CookSpeedMultiplier")) {
+ this.cookSpeedMultiplier = nbt.getDouble("Paper.CookSpeedMultiplier"); + this.cookSpeedMultiplier = nbt.getDouble("Paper.CookSpeedMultiplier");
+ } + }
+ // Paper end + // Paper end - cook speed multiplier API
} }
@Override @Override
@ -73,7 +71,7 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
+ if (blockEntity.cookingProgress >= blockEntity.cookingTotalTime) { // Paper - cook speed multiplier API + if (blockEntity.cookingProgress >= blockEntity.cookingTotalTime) { // Paper - cook speed multiplier API
blockEntity.cookingProgress = 0; blockEntity.cookingProgress = 0;
- blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity); - blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity);
+ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper + blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper - cook speed multiplier API
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit
blockEntity.setRecipeUsed(recipeholder); blockEntity.setRecipeUsed(recipeholder);
} }
@ -86,12 +84,12 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
- return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> { - return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> {
- return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime(); - return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime();
- }).orElse(200); - }).orElse(200);
+ // Paper start + // Paper start - cook speed multiplier API
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { + public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) {
+ /* Scale the recipe's cooking time to the current cookSpeedMultiplier */ + /* Scale the recipe's cooking time to the current cookSpeedMultiplier */
+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200)); + int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200));
+ return (int) Math.ceil (cookTime / cookSpeedMultiplier); + return (int) Math.ceil (cookTime / cookSpeedMultiplier);
+ // Paper end + // Paper end - cook speed multiplier API
} }
public static boolean isFuel(ItemStack stack) { public static boolean isFuel(ItemStack stack) {
@ -100,7 +98,7 @@ index 7a13042631bea761952490cfd14dc20147405161..939a192dd66d5fb8da5beada7c22eeca
if (slot == 0 && !flag) { if (slot == 0 && !flag) {
- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this); - this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this);
+ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper + this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API
this.cookingProgress = 0; this.cookingProgress = 0;
this.setChanged(); this.setChanged();
} }

View File

@ -5,26 +5,26 @@ Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java
index be5e603d505566feac61cc7e591d35ce483a92df..2061d7ae62c1335c87aa67fd0cc004c42e34e3a7 100644 index be5e603d505566feac61cc7e591d35ce483a92df..8dcdc664470fcac00c203b9499ea0a45df7d86ef 100644
--- a/src/main/java/net/minecraft/world/entity/AgeableMob.java --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java
@@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob { @@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob {
} }
public void ageUp(int age, boolean overGrow) { public void ageUp(int age, boolean overGrow) {
+ if (this.ageLocked) return; // Paper - GH-1459 + if (this.ageLocked) return; // Paper - Honor ageLock
int j = this.getAge(); int j = this.getAge();
int k = j; int k = j;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 2700f7dc650dc19da75e9351f6d558d05be80dc5..5f2042d565974a5509aec8f744e091fe7c576c98 100644 index 2700f7dc650dc19da75e9351f6d558d05be80dc5..949eda8e743df7ab83f18f15471a33e538aecdc5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -299,6 +299,7 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -299,6 +299,7 @@ public class BeehiveBlockEntity extends BlockEntity {
} }
private static void setBeeReleaseData(int ticks, Bee bee) { private static void setBeeReleaseData(int ticks, Bee bee) {
+ if (!bee.ageLocked) { // Paper - respect age lock + if (!bee.ageLocked) { // Paper - Honor ageLock
int j = bee.getAge(); int j = bee.getAge();
if (j < 0) { if (j < 0) {
@ -32,7 +32,7 @@ index 2700f7dc650dc19da75e9351f6d558d05be80dc5..5f2042d565974a5509aec8f744e091fe
} else if (j > 0) { } else if (j > 0) {
bee.setAge(Math.max(0, j - ticks)); bee.setAge(Math.max(0, j - ticks));
} }
+ } // Paper - respect age lock + } // Paper - Honor ageLock
bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticks)); bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticks));
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..f7527ed1d47901e52df4e3fffbdcd838782c90db 100644 index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..0aeb9faa1ce22359361741a591aa3d465d955970 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -176,7 +176,8 @@ public abstract class FlowingFluid extends Fluid { @@ -176,7 +176,8 @@ public abstract class FlowingFluid extends Fluid {
@ -13,29 +13,28 @@ index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..f7527ed1d47901e52df4e3fffbdcd838
FluidState fluid1 = (FluidState) entry.getValue(); FluidState fluid1 = (FluidState) entry.getValue();
BlockPos blockposition1 = pos.relative(enumdirection); BlockPos blockposition1 = pos.relative(enumdirection);
- BlockState iblockdata1 = world.getBlockState(blockposition1); - BlockState iblockdata1 = world.getBlockState(blockposition1);
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper + BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing
+ if (iblockdata1 == null) continue; // Paper + if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing
if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) { if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) {
// CraftBukkit start // CraftBukkit start
@@ -203,7 +204,9 @@ public abstract class FlowingFluid extends Fluid { @@ -203,7 +204,8 @@ public abstract class FlowingFluid extends Fluid {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection); BlockPos blockposition1 = pos.relative(enumdirection);
- BlockState iblockdata1 = world.getBlockState(blockposition1); - BlockState iblockdata1 = world.getBlockState(blockposition1);
+ + BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper + if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing
+ if (iblockdata1 == null) continue; // Paper
FluidState fluid = iblockdata1.getFluidState(); FluidState fluid = iblockdata1.getFluidState();
if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) { if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) {
@@ -320,11 +323,18 @@ public abstract class FlowingFluid extends Fluid { @@ -320,11 +322,18 @@ public abstract class FlowingFluid extends Fluid {
if (enumdirection1 != direction) { if (enumdirection1 != direction) {
BlockPos blockposition2 = pos.relative(enumdirection1); BlockPos blockposition2 = pos.relative(enumdirection1);
short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2); short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2);
- Pair<BlockState, FluidState> pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> { - Pair<BlockState, FluidState> pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> {
- BlockState iblockdata1 = world.getBlockState(blockposition2); - BlockState iblockdata1 = world.getBlockState(blockposition2);
+ // Paper start - avoid loading chunks + // Paper start - Prevent chunk loading from fluid flowing
+ Pair<BlockState, FluidState> pair = stateCache.get(short0); + Pair<BlockState, FluidState> pair = stateCache.get(short0);
+ if (pair == null) { + if (pair == null) {
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2); + BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2);
@ -48,11 +47,11 @@ index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..f7527ed1d47901e52df4e3fffbdcd838
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState()); + pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
+ stateCache.put(short0, pair); + stateCache.put(short0, pair);
+ } + }
+ // Paper end + // Paper end - Prevent chunk loading from fluid flowing
BlockState iblockdata1 = (BlockState) pair.getFirst(); BlockState iblockdata1 = (BlockState) pair.getFirst();
FluidState fluid = (FluidState) pair.getSecond(); FluidState fluid = (FluidState) pair.getSecond();
@@ -396,11 +406,16 @@ public abstract class FlowingFluid extends Fluid { @@ -396,11 +405,16 @@ public abstract class FlowingFluid extends Fluid {
Direction enumdirection = (Direction) iterator.next(); Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection); BlockPos blockposition1 = pos.relative(enumdirection);
short short0 = FlowingFluid.getCacheKey(pos, blockposition1); short short0 = FlowingFluid.getCacheKey(pos, blockposition1);
@ -61,7 +60,7 @@ index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..f7527ed1d47901e52df4e3fffbdcd838
- -
- return Pair.of(iblockdata1, iblockdata1.getFluidState()); - return Pair.of(iblockdata1, iblockdata1.getFluidState());
- }); - });
+ // Paper start + // Paper start - Prevent chunk loading from fluid flowing
+ Pair pair = (Pair) short2objectmap.get(short0); + Pair pair = (Pair) short2objectmap.get(short0);
+ if (pair == null) { + if (pair == null) {
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition1); + BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition1);
@ -70,7 +69,7 @@ index 818c83934a97c4b2ad4db69f4b0fcf0a500ea918..f7527ed1d47901e52df4e3fffbdcd838
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState()); + pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
+ short2objectmap.put(short0, pair); + short2objectmap.put(short0, pair);
+ } + }
+ // Paper end + // Paper end - Prevent chunk loading from fluid flowing
BlockState iblockdata1 = (BlockState) pair.getFirst(); BlockState iblockdata1 = (BlockState) pair.getFirst();
FluidState fluid = (FluidState) pair.getSecond(); FluidState fluid = (FluidState) pair.getSecond();
FluidState fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1); FluidState fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1);

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 22 Sep 2018 15:56:59 -0400 Date: Sat, 22 Sep 2018 15:56:59 -0400
Subject: [PATCH] Catch JsonParseException in Entity and TE names Subject: [PATCH] Catch JsonParseException in entity and block entity names
As a result, data that no longer parses correctly will not crash the server As a result, data that no longer parses correctly will not crash the server
instead just logging the exception and continuing (and in most cases should instead just logging the exception and continuing (and in most cases should

View File

@ -11,35 +11,21 @@ public net.minecraft.world.entity.animal.Turtle setGoingHome(Z)V
public net.minecraft.world.entity.animal.Turtle isTravelling()Z public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..7153e00a640abfeb134ff1dcb93f363b972a4233 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal {
protected int nextStartTick;
protected int tryTicks;
private int maxStayTicks;
- protected BlockPos blockPos = BlockPos.ZERO;
+ protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
private boolean reachedTarget;
private final int searchRange;
private final int verticalSearchRange;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index 0dab0da65788720e56a568918de458ab7195ef5c..722e323d2ae3f4ac8aa3197fed79f7d926d5ccfa 100644 index 0dab0da65788720e56a568918de458ab7195ef5c..6bbcdd34fb89ea5774e825de8f9a588552716fc2 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -491,14 +491,18 @@ public class Turtle extends Animal { @@ -491,14 +491,17 @@ public class Turtle extends Animal {
if (!this.turtle.isInWater() && this.isReachedTarget()) { if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) { if (this.turtle.layEggCounter < 1) {
- this.turtle.setLayingEgg(true); - this.turtle.setLayingEgg(true);
+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.getTargetPosition())).callEvent()); // Paper + this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos)).callEvent()); // Paper - Turtle API
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) { } else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
Level world = this.turtle.level(); Level world = this.turtle.level();
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit - if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit
+ // CraftBukkit start + // Paper start - Turtle API
+ // Paper start
+ int eggCount = this.turtle.random.nextInt(4) + 1; + int eggCount = this.turtle.random.nextInt(4) + 1;
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount); + com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount);
+ if (layEggEvent.callEvent() && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()))) { + if (layEggEvent.callEvent() && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()))) {
@ -50,12 +36,12 @@ index 0dab0da65788720e56a568918de458ab7195ef5c..722e323d2ae3f4ac8aa3197fed79f7d9
world.setBlock(blockposition1, iblockdata, 3); world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata)); world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata));
@@ -568,7 +572,7 @@ public class Turtle extends Animal { @@ -568,7 +571,7 @@ public class Turtle extends Animal {
@Override @Override
public boolean canUse() { public boolean canUse() {
- return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))); - return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D)));
+ return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper + return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper - Turtle API
} }
@Override @Override

View File

@ -19,14 +19,14 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b2864db793e8d764cf06229d7868fcf80247f938..aa4257a7d2e676cafeb85ceaeab364a83dead616 100644 index 6795bfdbdbd4e548c394e02a0e121b26facab8ea..e4d773356ae8b310908f502d12bab08dc6862e40 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2085,6 +2085,21 @@ public class ServerPlayer extends Player { @@ -2085,6 +2085,21 @@ public class ServerPlayer extends Player {
this.camera = (Entity) (entity == null ? this : entity); this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) { if (entity1 != this.camera) {
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event + // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity
+ if (this.camera == this) { + if (this.camera == this) {
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity()); + com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
+ if (!playerStopSpectatingEntityEvent.callEvent()) { + if (!playerStopSpectatingEntityEvent.callEvent()) {
@ -40,7 +40,7 @@ index b2864db793e8d764cf06229d7868fcf80247f938..aa4257a7d2e676cafeb85ceaeab364a8
+ return; + return;
+ } + }
+ } + }
+ // Paper end + // Paper end - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity
Level world = this.camera.level(); Level world = this.camera.level();
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index ee2abc0c39a76a74c151ecc8660d2037f3db0636..485d14d71fb26e6e0d00a43da040bf63d696b66a 100644 index ee2abc0c39a76a74c151ecc8660d2037f3db0636..01897af1e6253b987734a24c052daf2ce1314092 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
@ -13,7 +13,7 @@ index ee2abc0c39a76a74c151ecc8660d2037f3db0636..485d14d71fb26e6e0d00a43da040bf63
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); - this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false));
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper + if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper - Check drowned for villager aggression config
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ea7eb7be6abfcfc3c70eba42cf31cc2030747428..0a9a13404885e13061a8de88c25b01d3db039018 100644 index dd2ae4c0e4dad3f7c246357a9b45c832a091a576..6b9a53b244f5eca443697d01cc5938d85be4b99f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -475,9 +475,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -475,9 +475,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -34,7 +34,7 @@ index ea7eb7be6abfcfc3c70eba42cf31cc2030747428..0a9a13404885e13061a8de88c25b01d3
+ this.connection.send(new ClientboundMoveVehiclePacket(entity)); + this.connection.send(new ClientboundMoveVehiclePacket(entity));
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Prevent moving into unloaded chunks
+ +
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end // CraftBukkit end
@ -61,7 +61,7 @@ index ea7eb7be6abfcfc3c70eba42cf31cc2030747428..0a9a13404885e13061a8de88c25b01d3
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet()); + this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Prevent moving into unloaded chunks
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) { if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F; float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index aa4257a7d2e676cafeb85ceaeab364a83dead616..471fd247659da0cc327e0695095bf8c0a517d087 100644 index e4d773356ae8b310908f502d12bab08dc6862e40..2119ad9a167ef50f912e8408702f310a61e1527e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2560,6 +2560,7 @@ public class ServerPlayer extends Player { @@ -2560,6 +2560,7 @@ public class ServerPlayer extends Player {
this.setHealth(this.getMaxHealth()); this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset
+ this.setAirSupply(this.getMaxAirSupply()); // Paper + this.setAirSupply(this.getMaxAirSupply()); // Paper - Reset players airTicks on respawn
this.setRemainingFireTicks(0); this.setRemainingFireTicks(0);
this.fallDistance = 0; this.fallDistance = 0;
this.foodData = new FoodData(this); this.foodData = new FoodData(this);

View File

@ -7,14 +7,14 @@ Mojang was sleeping even if we had no more requests to go after
the current one finished, resulting in 100ms lost per profile lookup the current one finished, resulting in 100ms lost per profile lookup
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
index b87546f0061458b2b919a1fe00dde1f4eea6cb3e..498623aa5da5fb861615c602019784d66a84e3a0 100644 index b87546f0061458b2b919a1fe00dde1f4eea6cb3e..55dac5edf694b3bf82b475a71e3524a1bce98882 100644
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java --- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java +++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
@@ -44,6 +44,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { @@ -44,6 +44,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
final int page = 0; final int page = 0;
+ boolean hasRequested = false; // Paper + boolean hasRequested = false; // Paper - Don't sleep after profile lookups if not needed
for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) { for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) {
final List<String> normalizedRequest = request.stream().map(YggdrasilGameProfileRepository::normalizeName).toList(); final List<String> normalizedRequest = request.stream().map(YggdrasilGameProfileRepository::normalizeName).toList();
@ -22,12 +22,12 @@ index b87546f0061458b2b919a1fe00dde1f4eea6cb3e..498623aa5da5fb861615c602019784d6
LOGGER.debug("Couldn't find profile {}", name); LOGGER.debug("Couldn't find profile {}", name);
callback.onProfileLookupFailed(name, new ProfileNotFoundException("Server did not find the requested profile")); callback.onProfileLookupFailed(name, new ProfileNotFoundException("Server did not find the requested profile"));
} }
+ // Paper start + // Paper start - Don't sleep after profile lookups if not needed
+ if (!hasRequested) { + if (!hasRequested) {
+ hasRequested = true; + hasRequested = true;
+ continue; + continue;
+ } + }
+ // Paper end + // Paper end - Don't sleep after profile lookups if not needed
try { try {
Thread.sleep(DELAY_BETWEEN_PAGES); Thread.sleep(DELAY_BETWEEN_PAGES);

View File

@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index aa52b271bd556a29f774fde375b713d0d187521b..90f5e7d36719dc9b464dd6ba0335da035bab29d3 100644 index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63f7f31498 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -86,7 +86,7 @@ public class Util { @@ -86,7 +86,7 @@ public class Util {
@ -46,7 +46,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..90f5e7d36719dc9b464dd6ba0335da03
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10; private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
+ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority + private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - Perf: add priority
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
@ -56,8 +56,8 @@ index aa52b271bd556a29f774fde375b713d0d187521b..90f5e7d36719dc9b464dd6ba0335da03
- private static ExecutorService makeExecutor(String name) { - private static ExecutorService makeExecutor(String name) {
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads()); - int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads());
+ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority + private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - Perf: add priority
+ // Paper start - use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs + // Paper start - Perf: use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
+ int cpus = Runtime.getRuntime().availableProcessors() / 2; + int cpus = Runtime.getRuntime().availableProcessors() / 2;
+ int i; + int i;
+ if (cpus <= 4) { + if (cpus <= 4) {
@ -87,19 +87,19 @@ index aa52b271bd556a29f774fde375b713d0d187521b..90f5e7d36719dc9b464dd6ba0335da03
return forkJoinWorkerThread; return forkJoinWorkerThread;
}, Util::onThreadException, true); }, Util::onThreadException, true);
} }
+ }*/ // Paper end + }*/ // Paper end - Perf: use simpler thread pool
return executorService; return executorService;
} }
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 79a7f64edcfc750bf2753b5b20e4c2ae322e01ab..7a12c0f5a6cb205e8ae7667b9334efe1999e2a6a 100644 index 85beb9c7a02f7f561716d017f40ae24ad49a61a3..b57661a04bba7d32a338a0ee485f9ee8475ea246 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
@@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
thread.setUncaughtExceptionHandler((thread1, throwable) -> { thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable); MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
}); });
+ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority + thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - Perf: Boost priority
if (Runtime.getRuntime().availableProcessors() > 4) { if (Runtime.getRuntime().availableProcessors() > 4) {
thread.setPriority(8); thread.setPriority(8);
} }

View File

@ -8,7 +8,7 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled. object for every player unless they have per-player time enabled.
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 7a12c0f5a6cb205e8ae7667b9334efe1999e2a6a..420201b60be7d07fbbb75192f14e4222f4b386aa 100644 index b57661a04bba7d32a338a0ee485f9ee8475ea246..bfcb155b1e8b04edfdbd26f4cc3bc2b4a7cbf5ea 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
@@ -1469,12 +1469,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1469,12 +1469,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -19,7 +19,7 @@ index 7a12c0f5a6cb205e8ae7667b9334efe1999e2a6a..420201b60be7d07fbbb75192f14e4222
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) { - for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
- ServerPlayer entityplayer = (ServerPlayer) this.getPlayerList().players.get(i); - ServerPlayer entityplayer = (ServerPlayer) this.getPlayerList().players.get(i);
- entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time - entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
+ // Paper start - optimize time updates + // Paper start - Perf: Optimize time updates
+ for (final ServerLevel level : this.getAllLevels()) { + for (final ServerLevel level : this.getAllLevels()) {
+ final boolean doDaylight = level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT); + final boolean doDaylight = level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT);
+ final long dayTime = level.getDayTime(); + final long dayTime = level.getDayTime();
@ -36,7 +36,7 @@ index 7a12c0f5a6cb205e8ae7667b9334efe1999e2a6a..420201b60be7d07fbbb75192f14e4222
+ entityplayer.connection.send(packet); // Add support for per player time + entityplayer.connection.send(packet); // Add support for per player time
} }
} }
+ // Paper end + // Paper end - Perf: Optimize time updates
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
while (iterator.hasNext()) { while (iterator.hasNext()) {

View File

@ -6,18 +6,18 @@ Subject: [PATCH] Fix SpongeAbsortEvent handling
Only process drops when the block is actually going to be removed Only process drops when the block is actually going to be removed
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
index 1238317d3e6d968525a10c5480a7d44d56abb071..c4667bea0708d12e228ec2a4c84fcee7e48ca08c 100644 index 1238317d3e6d968525a10c5480a7d44d56abb071..8f3cca228f8ec1ea9379fa43af4baa7b18012dd2 100644
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java --- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
@@ -134,7 +134,11 @@ public class SpongeBlock extends Block { @@ -134,7 +134,11 @@ public class SpongeBlock extends Block {
} else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) { } else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) {
BlockEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null; BlockEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
+ // Paper start + // Paper start - Fix SpongeAbsortEvent handling
+ if (block.getHandle().isAir()) { + if (block.getHandle().isAir()) {
dropResources(iblockdata, world, blockposition1, tileentity); dropResources(iblockdata, world, blockposition1, tileentity);
+ } + }
+ // Paper end + // Paper end - Fix SpongeAbsortEvent handling
} }
} }
world.setBlock(blockposition1, block.getHandle(), block.getFlag()); world.setBlock(blockposition1, block.getHandle(), block.getFlag());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index e3b7441d875b55ffce295c948f3dc867be09e042..79020edc9fac79e8b186d0f57f956d2189d3dc8e 100644 index e3b7441d875b55ffce295c948f3dc867be09e042..32327f639b3cc10444ad122fb3405174e32c4f01 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -119,8 +119,8 @@ public class ServerPlayerGameMode { @@ -119,8 +119,8 @@ public class ServerPlayerGameMode {
@ -14,8 +14,8 @@ index e3b7441d875b55ffce295c948f3dc867be09e042..79020edc9fac79e8b186d0f57f956d21
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
- iblockdata = this.level.getBlockState(this.delayedDestroyPos); - iblockdata = this.level.getBlockState(this.delayedDestroyPos);
- if (iblockdata.isAir()) { - if (iblockdata.isAir()) {
+ iblockdata = this.level.getBlockStateIfLoaded(this.delayedDestroyPos); // Paper + iblockdata = this.level.getBlockStateIfLoaded(this.delayedDestroyPos); // Paper - Don't allow digging into unloaded chunks
+ if (iblockdata == null || iblockdata.isAir()) { // Paper + if (iblockdata == null || iblockdata.isAir()) { // Paper - Don't allow digging into unloaded chunks
this.hasDelayedDestroy = false; this.hasDelayedDestroy = false;
} else { } else {
float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart); float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart);
@ -24,13 +24,13 @@ index e3b7441d875b55ffce295c948f3dc867be09e042..79020edc9fac79e8b186d0f57f956d21
} }
} else if (this.isDestroyingBlock) { } else if (this.isDestroyingBlock) {
- iblockdata = this.level.getBlockState(this.destroyPos); - iblockdata = this.level.getBlockState(this.destroyPos);
+ // Paper start - don't want to do same logic as above, return instead + // Paper start - Don't allow digging into unloaded chunks; don't want to do same logic as above, return instead
+ iblockdata = this.level.getBlockStateIfLoaded(this.destroyPos); + iblockdata = this.level.getBlockStateIfLoaded(this.destroyPos);
+ if (iblockdata == null) { + if (iblockdata == null) {
+ this.isDestroyingBlock = false; + this.isDestroyingBlock = false;
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Don't allow digging into unloaded chunks
if (iblockdata.isAir()) { if (iblockdata.isAir()) {
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1); this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
this.lastSentState = -1; this.lastSentState = -1;
@ -38,7 +38,7 @@ index e3b7441d875b55ffce295c948f3dc867be09e042..79020edc9fac79e8b186d0f57f956d21
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) { public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) { if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
+ if (true) return; // Paper - Don't notify if unreasonably far away + if (true) return; // Paper - Don't allow digging into unloaded chunks; Don't notify if unreasonably far away
this.debugLogging(pos, false, sequence, "too far"); this.debugLogging(pos, false, sequence, "too far");
} else if (pos.getY() >= worldHeight) { } else if (pos.getY() >= worldHeight) {
this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos))); this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos)));
@ -59,19 +59,19 @@ index e3b7441d875b55ffce295c948f3dc867be09e042..79020edc9fac79e8b186d0f57f956d21
this.level.destroyBlockProgress(this.player.getId(), pos, -1); this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0a9a13404885e13061a8de88c25b01d3db039018..20b8fe97ee0b73e3b1a71b8366267d7c5de5da2e 100644 index 6b9a53b244f5eca443697d01cc5938d85be4b99f..b04323c2e8697c2b406bb861b25aa5b0f7032557 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1592,6 +1592,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1592,6 +1592,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case START_DESTROY_BLOCK: case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK: case STOP_DESTROY_BLOCK:
+ // Paper start - Don't allow digging in unloaded chunks + // Paper start - Don't allow digging into unloaded chunks
+ if (this.player.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { + if (this.player.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
+ this.player.connection.ackBlockChangesUpTo(packet.getSequence()); + this.player.connection.ackBlockChangesUpTo(packet.getSequence());
+ return; + return;
+ } + }
+ // Paper end - Don't allow digging in unloaded chunks + // Paper end - Don't allow digging into unloaded chunks
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence()); this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence());
this.player.connection.ackBlockChangesUpTo(packet.getSequence()); this.player.connection.ackBlockChangesUpTo(packet.getSequence());
return; return;

View File

@ -7,14 +7,14 @@ If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead. split the inventory set into multiple packets instead.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index df5da9398c903d073485aaa0dce8e70947137cb9..6fcbf8205e1852d5193a42bfe1154f62ab01e7ad 100644 index df5da9398c903d073485aaa0dce8e70947137cb9..090a130676de3ab458df6bd1e08f0b755a3f685a 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -156,6 +156,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -156,6 +156,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
+ // Paper start + // Paper start - Handle large packets disconnecting client
+ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException packetTooLargeException) { + if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException packetTooLargeException) {
+ final Packet<?> packet = packetTooLargeException.getPacket(); + final Packet<?> packet = packetTooLargeException.getPacket();
+ final io.netty.util.Attribute<ConnectionProtocol.CodecData<?>> codecDataAttribute = channelhandlercontext.channel().attr(packetTooLargeException.codecKey); + final io.netty.util.Attribute<ConnectionProtocol.CodecData<?>> codecDataAttribute = channelhandlercontext.channel().attr(packetTooLargeException.codecKey);
@ -29,12 +29,12 @@ index df5da9398c903d073485aaa0dce8e70947137cb9..6fcbf8205e1852d5193a42bfe1154f62
+ throwable = throwable.getCause(); + throwable = throwable.getCause();
+ } + }
+ } + }
+ // Paper end + // Paper end - Handle large packets disconnecting client
if (throwable instanceof SkipPacketException) { if (throwable instanceof SkipPacketException) {
Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause()); Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause());
} else { } else {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 7070d093c80033b61a9c8495bc56153d986b6b03..2907536f8f9b4b9dccb96f8b4f19d75fa3c5b864 100644 index 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec3935a38314 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -41,7 +41,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -41,7 +41,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
@ -42,7 +42,7 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..2907536f8f9b4b9dccb96f8b4f19d75f
packet.write(friendlyByteBuf); packet.write(friendlyByteBuf);
int k = friendlyByteBuf.writerIndex() - j; int k = friendlyByteBuf.writerIndex() - j;
- if (k > 8388608) { - if (k > 8388608) {
+ if (false && k > 8388608) { // Paper - disable + if (false && k > 8388608) { // Paper - Handle large packets disconnecting client; disable
throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
} }
@ -50,12 +50,12 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..2907536f8f9b4b9dccb96f8b4f19d75f
throw var13; throw var13;
} finally { } finally {
+ // Paper start + // Paper start - Handle large packets disconnecting client
+ int packetLength = friendlyByteBuf.readableBytes(); + int packetLength = friendlyByteBuf.readableBytes();
+ if (packetLength > MAX_PACKET_SIZE) { + if (packetLength > MAX_PACKET_SIZE) {
+ throw new PacketTooLargeException(packet, this.codecKey, packetLength); + throw new PacketTooLargeException(packet, this.codecKey, packetLength);
+ } + }
+ // Paper end + // Paper end - Handle large packets disconnecting client
ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
} }

View File

@ -20,24 +20,24 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome! Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6d04954493680bc4fbad67ff2e43411f970f78f5..e44d983e7b44225bdd7395488d2b246761e8e02a 100644 index 6d04954493680bc4fbad67ff2e43411f970f78f5..1793fbd803bfdb5d43d83d15b238d70da06b8780 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2606,11 +2606,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2606,11 +2606,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public void removeVehicle() { public void removeVehicle() {
+ // Paper start + // Paper start - Force entity dismount during teleportation
+ stopRiding(false); + stopRiding(false);
+ } + }
+ public void stopRiding(boolean suppressCancellation) { + public void stopRiding(boolean suppressCancellation) {
+ // Paper end + // Paper end - Force entity dismount during teleportation
if (this.vehicle != null) { if (this.vehicle != null) {
Entity entity = this.vehicle; Entity entity = this.vehicle;
this.vehicle = null; this.vehicle = null;
- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit - if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
+ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper + if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper - Force entity dismount during teleportation
} }
} }
@ -46,10 +46,10 @@ index 6d04954493680bc4fbad67ff2e43411f970f78f5..e44d983e7b44225bdd7395488d2b2467
} }
- protected boolean removePassenger(Entity entity) { // CraftBukkit - protected boolean removePassenger(Entity entity) { // CraftBukkit
+ // Paper start + // Paper start - Force entity dismount during teleportation
+ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);} + protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);}
+ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit + protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit
+ // Paper end + // Paper end - Force entity dismount during teleportation
if (entity.getVehicle() == this) { if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
@ -58,7 +58,7 @@ index 6d04954493680bc4fbad67ff2e43411f970f78f5..e44d983e7b44225bdd7395488d2b2467
VehicleExitEvent event = new VehicleExitEvent( VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(), (Vehicle) this.getBukkitEntity(),
- (LivingEntity) entity.getBukkitEntity() - (LivingEntity) entity.getBukkitEntity()
+ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper + (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper - Force entity dismount during teleportation
); );
// Suppress during worldgen // Suppress during worldgen
if (this.valid) { if (this.valid) {
@ -67,33 +67,33 @@ index 6d04954493680bc4fbad67ff2e43411f970f78f5..e44d983e7b44225bdd7395488d2b2467
} }
- EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()); - EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
+ EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper + EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - Force entity dismount during teleportation
// Suppress during worldgen // Suppress during worldgen
if (this.valid) { if (this.valid) {
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0085d4727e9bd1c6f451666e6012b8abcd74d129..8e89eb11e8477c921b30840644b6c3ba9d18c3ef 100644 index 0085d4727e9bd1c6f451666e6012b8abcd74d129..9e3571220ba3eef5fa950ddd83af13ff45ae38ae 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3471,9 +3471,15 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3471,9 +3471,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override @Override
public void stopRiding() { public void stopRiding() {
+ // Paper start + // Paper start - Force entity dismount during teleportation
+ stopRiding(false); + stopRiding(false);
+ } + }
+ @Override + @Override
+ public void stopRiding(boolean suppressCancellation) { + public void stopRiding(boolean suppressCancellation) {
+ // Paper end + // Paper end - Force entity dismount during teleportation
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
- super.stopRiding(); - super.stopRiding();
+ super.stopRiding(suppressCancellation); // Paper - suppress + super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) { if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
this.dismountVehicle(entity); this.dismountVehicle(entity);
} }
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 0d8261e15a1a66df17727788c387dca8fbe2ae84..110c751dc108dbdc2fd9fdd25ca07df7acc723e5 100644 index 0d8261e15a1a66df17727788c387dca8fbe2ae84..76a3e38a49d6ea8cf01604be4da12ad4e4fa3da4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1149,7 +1149,13 @@ public abstract class Player extends LivingEntity { @@ -1149,7 +1149,13 @@ public abstract class Player extends LivingEntity {
@ -101,13 +101,13 @@ index 0d8261e15a1a66df17727788c387dca8fbe2ae84..110c751dc108dbdc2fd9fdd25ca07df7
@Override @Override
public void removeVehicle() { public void removeVehicle() {
- super.removeVehicle(); - super.removeVehicle();
+ // Paper start + // Paper start - Force entity dismount during teleportation
+ stopRiding(false); + stopRiding(false);
+ } + }
+ @Override + @Override
+ public void stopRiding(boolean suppressCancellation) { + public void stopRiding(boolean suppressCancellation) {
+ // Paper end + super.stopRiding(suppressCancellation);
+ super.stopRiding(suppressCancellation); // Paper - suppress + // Paper end - Force entity dismount during teleportation
this.boardingCooldown = 0; this.boardingCooldown = 0;
} }

View File

@ -7,14 +7,14 @@ Subject: [PATCH] Add more Zombie API
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..d4f72024c15d03f70a86f09714403ace6e26885a 100644 index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..37730675250f03ff6786992949813d67583610b3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -96,6 +96,7 @@ public class Zombie extends Monster { @@ -96,6 +96,7 @@ public class Zombie extends Monster {
private int inWaterTime; private int inWaterTime;
public int conversionTime; public int conversionTime;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+ private boolean shouldBurnInDay = true; // Paper + private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
public Zombie(EntityType<? extends Zombie> type, Level world) { public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world); super(type, world);
@ -22,12 +22,12 @@ index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..d4f72024c15d03f70a86f09714403ace
super.aiStep(); super.aiStep();
} }
+ // Paper start + // Paper start - Add more Zombie API
+ public void stopDrowning() { + public void stopDrowning() {
+ this.conversionTime = -1; + this.conversionTime = -1;
+ this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false); + this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false);
+ } + }
+ // Paper end + // Paper end - Add more Zombie API
public void startUnderWaterConversion(int ticksUntilWaterConversion) { public void startUnderWaterConversion(int ticksUntilWaterConversion) {
this.lastTick = MinecraftServer.currentTick; // CraftBukkit this.lastTick = MinecraftServer.currentTick; // CraftBukkit
this.conversionTime = ticksUntilWaterConversion; this.conversionTime = ticksUntilWaterConversion;
@ -36,14 +36,14 @@ index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..d4f72024c15d03f70a86f09714403ace
public boolean isSunSensitive() { public boolean isSunSensitive() {
- return true; - return true;
+ return this.shouldBurnInDay; // Paper - use api value instead + return this.shouldBurnInDay; // Paper - Add more Zombie API
} }
+ // Paper start + // Paper start - Add more Zombie API
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { + public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ this.shouldBurnInDay = shouldBurnInDay; + this.shouldBurnInDay = shouldBurnInDay;
+ } + }
+ // Paper end + // Paper end - Add more Zombie API
+ +
@Override @Override
public boolean hurt(DamageSource source, float amount) { public boolean hurt(DamageSource source, float amount) {
@ -52,7 +52,7 @@ index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..d4f72024c15d03f70a86f09714403ace
nbt.putBoolean("CanBreakDoors", this.canBreakDoors()); nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper + nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
} }
@Override @Override
@ -60,11 +60,11 @@ index 2aec8e2f45fe6ba56d84e5a51a6e30d36505df42..d4f72024c15d03f70a86f09714403ace
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) { if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime")); this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
} }
+ // Paper start + // Paper start - Add more Zombie API
+ if (nbt.contains("Paper.ShouldBurnInDay")) { + if (nbt.contains("Paper.ShouldBurnInDay")) {
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); + this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ } + }
+ // Paper end + // Paper end - Add more Zombie API
} }

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Book Size Limits
Puts some limits on the size of books. Puts some limits on the size of books.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e0954ab93e4b528595fc3be40a30e2e6775bc4a2..564cc26f8201bd864f5f58c740c9de942d384394 100644 index e0954ab93e4b528595fc3be40a30e2e6775bc4a2..2ee2e497f716f54dc8cd3d9b906d7bc2b7106448 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1026,6 +1026,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1026,6 +1026,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleEditBook(ServerboundEditBookPacket packet) { public void handleEditBook(ServerboundEditBookPacket packet) {
+ // Paper start + // Paper start - Book size limits
+ if (!this.cserver.isPrimaryThread()) { + if (!this.cserver.isPrimaryThread()) {
+ List<String> pageList = packet.getPages(); + List<String> pageList = packet.getPages();
+ long byteTotal = 0; + long byteTotal = 0;
@ -51,7 +51,7 @@ index e0954ab93e4b528595fc3be40a30e2e6775bc4a2..564cc26f8201bd864f5f58c740c9de94
+ return; + return;
+ } + }
+ } + }
+ // Paper end + // Paper end - Book size limits
// CraftBukkit start // CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) { if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
this.disconnect("Book edited too quickly!"); this.disconnect("Book edited too quickly!");

View File

@ -38,7 +38,7 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state public net.minecraft.server.network.ServerLoginPacketListenerImpl state
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..25881c890c643ce90bdcda6b094d912bafb0ed75 100644 index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..8870d97194e1389ca747b74b092b1f8fb9090fb0 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -644,6 +644,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -644,6 +644,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -64,7 +64,7 @@ index 6fcbf8205e1852d5193a42bfe1154f62ab01e7ad..25881c890c643ce90bdcda6b094d912b
+ ((java.net.InetSocketAddress)address).getAddress(), false).callEvent(); + ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
+ } + }
+ } + }
+ // Paper end + // Paper end - Add PlayerConnectionCloseEvent
} }
} }

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io> From: Zach Brown <zach@zachbr.io>
Date: Wed, 2 Jan 2019 00:35:43 -0600 Date: Wed, 2 Jan 2019 00:35:43 -0600
Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed Subject: [PATCH] Replace OfflinePlayer#getLastPlayed
Currently OfflinePlayer#getLastPlayed could more accurately be described Currently OfflinePlayer#getLastPlayed could more accurately be described
as "OfflinePlayer#getLastTimeTheirDataWasSaved". as "OfflinePlayer#getLastTimeTheirDataWasSaved".
@ -16,26 +16,26 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose. documented as to their purpose.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 54297045b5da66827426ae354883a9709d9cdefc..7a5977aa72a0a198144d7b490abe0685326de260 100644 index 54297045b5da66827426ae354883a9709d9cdefc..27f0fce3e5e5faec8f2717b5068cb23e2054ce8b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -248,6 +248,7 @@ public class ServerPlayer extends Player { @@ -248,6 +248,7 @@ public class ServerPlayer extends Player {
private int containerCounter; private int containerCounter;
public boolean wonGame; public boolean wonGame;
private int containerUpdateDelay; // Paper private int containerUpdateDelay; // Paper
+ public long loginTime; // Paper + public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed
// Paper start - cancellable death event // Paper start - cancellable death event
public boolean queueHealthUpdatePacket = false; public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6a3961350030e63b27512261402f675c3cd78485..d3f57dfd5156a5df17a5a7a6e5fe51d8804fd38f 100644 index 6a3961350030e63b27512261402f675c3cd78485..154881ee9a837fea159246c6a826257bcf7a079a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -179,6 +179,7 @@ public abstract class PlayerList { @@ -179,6 +179,7 @@ public abstract class PlayerList {
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
player.isRealPlayer = true; // Paper player.isRealPlayer = true; // Paper
+ player.loginTime = System.currentTimeMillis(); // Paper + player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache(); GameProfileCache usercache = this.server.getProfileCache();
String s; String s;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7a5977aa72a0a198144d7b490abe0685326de260..8cc33c1b14668c085dbad1f3feabf7b602812471 100644 index 27f0fce3e5e5faec8f2717b5068cb23e2054ce8b..7c20af6a72603e46b4aec46a079101981eb59c08 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1749,6 +1749,13 @@ public class ServerPlayer extends Player { @@ -1749,6 +1749,13 @@ public class ServerPlayer extends Player {
@ -13,11 +13,11 @@ index 7a5977aa72a0a198144d7b490abe0685326de260..8cc33c1b14668c085dbad1f3feabf7b6
this.disconnected = true; this.disconnected = true;
this.ejectPassengers(); this.ejectPassengers();
+ +
+ // Paper start - Workaround an issue where the vehicle doesn't track the passenger disconnection dismount. + // Paper start - Workaround vehicle not tracking the passenger disconnection dismount
+ if (this.isPassenger() && this.getVehicle() instanceof ServerPlayer) { + if (this.isPassenger() && this.getVehicle() instanceof ServerPlayer) {
+ this.stopRiding(); + this.stopRiding();
+ } + }
+ // Paper end + // Paper end - Workaround vehicle not tracking the passenger disconnection dismount
+ +
if (this.isSleeping()) { if (this.isSleeping()) {
this.stopSleepInBed(true, false); this.stopSleepInBed(true, false);

View File

@ -11,7 +11,7 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 14c963d507173dae6015a0c81e3a690768012bed..b10c93cbcf264a3e13d48f30a2c09ae5568a510e 100644 index 14c963d507173dae6015a0c81e3a690768012bed..a683908b18114cad6100e3d5c8eb5a8dfd33163a 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
@@ -31,6 +31,7 @@ import net.minecraft.nbt.CompoundTag; @@ -31,6 +31,7 @@ import net.minecraft.nbt.CompoundTag;
@ -26,7 +26,7 @@ index 14c963d507173dae6015a0c81e3a690768012bed..b10c93cbcf264a3e13d48f30a2c09ae5
return false; return false;
} else { } else {
FluidState fluid = this.getFluidState(pos); FluidState fluid = this.getFluidState(pos);
+ // Paper start - while the above setAir method is named same and looks very similar + // Paper start - BlockDestroyEvent; while the above setAir method is named same and looks very similar
+ // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent, + // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
+ // it doesn't imply destruction of a block that plays a sound effect / drops an item. + // it doesn't imply destruction of a block that plays a sound effect / drops an item.
+ boolean playEffect = true; + boolean playEffect = true;
@ -42,12 +42,12 @@ index 14c963d507173dae6015a0c81e3a690768012bed..b10c93cbcf264a3e13d48f30a2c09ae5
+ drop = event.willDrop(); + drop = event.willDrop();
+ xp = event.getExpToDrop(); + xp = event.getExpToDrop();
+ } + }
+ // Paper end + // Paper end - BlockDestroyEvent
- if (!(iblockdata.getBlock() instanceof BaseFireBlock)) { - if (!(iblockdata.getBlock() instanceof BaseFireBlock)) {
- this.levelEvent(2001, pos, Block.getId(iblockdata)); - this.levelEvent(2001, pos, Block.getId(iblockdata));
+ if (playEffect && !(effectType.getBlock() instanceof BaseFireBlock)) { // Paper + if (playEffect && !(effectType.getBlock() instanceof BaseFireBlock)) { // Paper - BlockDestroyEvent
+ this.levelEvent(2001, pos, Block.getId(effectType)); // Paper + this.levelEvent(2001, pos, Block.getId(effectType)); // Paper - BlockDestroyEvent
} }
if (drop) { if (drop) {

View File

@ -9,14 +9,14 @@ commands if the server is restarting. Using the default async pool caused issues
due to the shutdown logic generally being much later. due to the shutdown logic generally being much later.
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2a88cf008c98284954108f2362f46ac14c84200a 100644 index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2b722091920116ded43ff54c413d4dd47da65ed4 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -458,6 +458,24 @@ public class Commands { @@ -458,6 +458,24 @@ public class Commands {
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
// CraftBukkit start // CraftBukkit start
// Register Vanilla commands into builtRoot as before // Register Vanilla commands into builtRoot as before
+ // Paper start - Async command map building + // Paper start - Perf: Async command map building
+ COMMAND_SENDING_POOL.execute(() -> { + COMMAND_SENDING_POOL.execute(() -> {
+ this.sendAsync(player); + this.sendAsync(player);
+ }); + });
@ -33,7 +33,7 @@ index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2a88cf008c98284954108f2362f46ac1
+ ); + );
+ +
+ private void sendAsync(ServerPlayer player) { + private void sendAsync(ServerPlayer player) {
+ // Paper end - Async command map building + // Paper end - Perf: Async command map building
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode(); RootCommandNode vanillaRoot = new RootCommandNode();
@ -41,26 +41,26 @@ index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2a88cf008c98284954108f2362f46ac1
for (CommandNode node : rootcommandnode.getChildren()) { for (CommandNode node : rootcommandnode.getChildren()) {
bukkit.add(node.getName()); bukkit.add(node.getName());
} }
+ // Paper start - Async command map building + // Paper start - Perf: Async command map building
+ net.minecraft.server.MinecraftServer.getServer().execute(() -> { + net.minecraft.server.MinecraftServer.getServer().execute(() -> {
+ runSync(player, bukkit, rootcommandnode); + runSync(player, bukkit, rootcommandnode);
+ }); + });
+ } + }
+ private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) { + private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
+ // Paper end - Async command map building + // Paper end - Perf: Async command map building
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
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 420201b60be7d07fbbb75192f14e4222f4b386aa..ce370cb1ed9ef67044c5ab448c52367779e5105f 100644 index e6b029c8ee05c5e045a7d694a9e8616d6a1ea484..5f377267cc3c72e4d55c29f20ce3cd3eed0e5258 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
@@ -926,6 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -926,6 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
MinecraftServer.LOGGER.info("Stopping server"); MinecraftServer.LOGGER.info("Stopping server");
+ Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing + Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
MinecraftTimings.stopServer(); // Paper MinecraftTimings.stopServer(); // Paper
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 19 Apr 2020 18:15:29 -0400 Date: Sun, 19 Apr 2020 18:15:29 -0400
Subject: [PATCH] Implement Brigadier Mojang API Subject: [PATCH] Brigadier Mojang API
Adds AsyncPlayerSendCommandsEvent Adds AsyncPlayerSendCommandsEvent
- Allows modifying on a per command basis what command data they see. - Allows modifying on a per command basis what command data they see.
@ -22,7 +22,7 @@ index 30edfbf16e7bed29b3261b51d9e4f3124beef026..eaaf9a9779f57ee048245899750bf7a1
implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.minecrell:terminalconsoleappender:1.3.0")
diff --git a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java diff --git a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java
index 3370731ee064d2693b972a0765c13dd4fd69f66a..614eba6cc55d1eb7755cac35c671cb6f6cacca13 100644 index 3370731ee064d2693b972a0765c13dd4fd69f66a..09d486a05179b9d878e1c33725b4e614c3544da9 100644
--- a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java --- a/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java
+++ b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java +++ b/src/main/java/com/mojang/brigadier/exceptions/CommandSyntaxException.java
@@ -5,7 +5,7 @@ package com.mojang.brigadier.exceptions; @@ -5,7 +5,7 @@ package com.mojang.brigadier.exceptions;
@ -30,7 +30,7 @@ index 3370731ee064d2693b972a0765c13dd4fd69f66a..614eba6cc55d1eb7755cac35c671cb6f
import com.mojang.brigadier.Message; import com.mojang.brigadier.Message;
-public class CommandSyntaxException extends Exception { -public class CommandSyntaxException extends Exception {
+public class CommandSyntaxException extends Exception implements net.kyori.adventure.util.ComponentMessageThrowable { // Paper +public class CommandSyntaxException extends Exception implements net.kyori.adventure.util.ComponentMessageThrowable { // Paper - Brigadier API
public static final int CONTEXT_AMOUNT = 10; public static final int CONTEXT_AMOUNT = 10;
public static boolean ENABLE_COMMAND_STACK_TRACES = true; public static boolean ENABLE_COMMAND_STACK_TRACES = true;
public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions(); public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions();
@ -39,27 +39,27 @@ index 3370731ee064d2693b972a0765c13dd4fd69f66a..614eba6cc55d1eb7755cac35c671cb6f
return cursor; return cursor;
} }
+ +
+ // Paper start + // Paper start - Brigadier API
+ @Override + @Override
+ public @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component componentMessage() { + public @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component componentMessage() {
+ return io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(this.message); + return io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(this.message);
+ } + }
+ // Paper end + // Paper end - Brigadier API
} }
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 da6250df1c5f3385b683cffde47754bca4606f5e..3384501f83d445f45aa8233e98c7597daa67b8ef 100644 index da6250df1c5f3385b683cffde47754bca4606f5e..d8142624f9f3a5909e7cc5665f1629a1a67dd302 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
@@ -34,6 +34,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { @@ -34,6 +34,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
private final RedirectModifier<S> modifier; private final RedirectModifier<S> modifier;
private final boolean forks; private final boolean forks;
private Command<S> command; private Command<S> command;
+ public LiteralCommandNode<CommandSourceStack> clientNode = null; // Paper + public LiteralCommandNode<CommandSourceStack> clientNode; // Paper - Brigadier API
// CraftBukkit start // CraftBukkit start
public void removeCommand(String name) { public void removeCommand(String name) {
this.children.remove(name); this.children.remove(name);
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 5cca4fcdc97d803460e95c534022186a5aad526f..c772fa3b7a1276b0b41c45c6e0f5584b9c3a90cd 100644 index 5cca4fcdc97d803460e95c534022186a5aad526f..8e0ea79a41136b697f5e58b5cd71f6a9bc3cab73 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -45,7 +45,7 @@ import net.minecraft.world.phys.Vec2; @@ -45,7 +45,7 @@ import net.minecraft.world.phys.Vec2;
@ -67,7 +67,7 @@ index 5cca4fcdc97d803460e95c534022186a5aad526f..c772fa3b7a1276b0b41c45c6e0f5584b
import com.mojang.brigadier.tree.CommandNode; // CraftBukkit import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
-public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider { -public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
+public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper +public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper - Brigadier API
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player")); public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity")); public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
@ -75,7 +75,7 @@ index 5cca4fcdc97d803460e95c534022186a5aad526f..c772fa3b7a1276b0b41c45c6e0f5584b
return this.textName; return this.textName;
} }
+ // Paper start + // Paper start - Brigadier API
+ @Override + @Override
+ public org.bukkit.entity.Entity getBukkitEntity() { + public org.bukkit.entity.Entity getBukkitEntity() {
+ return getEntity() != null ? getEntity().getBukkitEntity() : null; + return getEntity() != null ? getEntity().getBukkitEntity() : null;
@ -93,28 +93,28 @@ index 5cca4fcdc97d803460e95c534022186a5aad526f..c772fa3b7a1276b0b41c45c6e0f5584b
+ Vec2 rot = getRotation(); + Vec2 rot = getRotation();
+ return world != null && pos != null ? new org.bukkit.Location(world, pos.x, pos.y, pos.z, rot != null ? rot.y : 0, rot != null ? rot.x : 0) : null; + return world != null && pos != null ? new org.bukkit.Location(world, pos.x, pos.y, pos.z, rot != null ? rot.y : 0, rot != null ? rot.x : 0) : null;
+ } + }
+ // Paper end + // Paper end - Brigadier API
+ +
@Override @Override
public boolean hasPermission(int level) { public boolean hasPermission(int level) {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 2a88cf008c98284954108f2362f46ac14c84200a..b27256d251e5db5781197319f79f89cc7638c80b 100644 index 2b722091920116ded43ff54c413d4dd47da65ed4..867f22bdeed5f1c3f063a5815a3477d143057152 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -494,6 +494,7 @@ public class Commands { @@ -494,6 +494,7 @@ public class Commands {
bukkit.add(node.getName()); bukkit.add(node.getName());
} }
// Paper start - Async command map building // Paper start - Perf: Async command map building
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper + new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API
net.minecraft.server.MinecraftServer.getServer().execute(() -> { net.minecraft.server.MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode); runSync(player, bukkit, rootcommandnode);
}); });
@@ -501,6 +502,7 @@ public class Commands { @@ -501,6 +502,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) { private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building // Paper end - Perf: Async command map building
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper + new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event); event.getPlayer().getServer().getPluginManager().callEvent(event);
@ -122,16 +122,16 @@ index 2a88cf008c98284954108f2362f46ac14c84200a..b27256d251e5db5781197319f79f89cc
while (iterator.hasNext()) { while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next(); CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
+ // Paper start + // Paper start - Brigadier API
+ if (commandnode2.clientNode != null) { + if (commandnode2.clientNode != null) {
+ commandnode2 = commandnode2.clientNode; + commandnode2 = commandnode2.clientNode;
+ } + }
+ // Paper end + // Paper end - Brigadier API
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
if (commandnode2.canUse(source)) { if (commandnode2.canUse(source)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 564cc26f8201bd864f5f58c740c9de942d384394..833fb2f340065a72903620f974e6ac71cc86f3f9 100644 index 2ee2e497f716f54dc8cd3d9b906d7bc2b7106448..715e80bbb683da9c13d57b6b0bca70342e67c294 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -740,8 +740,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -740,8 +740,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -143,14 +143,14 @@ index 0000000000000000000000000000000000000000..413dfa52760db393ad6a8b5341200ee7
+import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier; +import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
index 4303f2b4e55191f8a53170435c6d1263782d1c8d..a65d07cb3d2dae85225921498d1721dc3c6a6bf3 100644 index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b01994877a01b 100644
--- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java --- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
+++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
@@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ @@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
this.inventory = entity.getInventory(); this.inventory = entity.getInventory();
if (this.testClearGrid() || entity.isCreative()) { if (this.testClearGrid() || entity.isCreative()) {
this.stackedContents.clear(); this.stackedContents.clear();
+ this.stackedContents.initialize(recipe.value()); // Paper - better exact choice recipes + this.stackedContents.initialize(recipe.value()); // Paper - Improve exact choice recipe ingredients
entity.getInventory().fillStackedContents(this.stackedContents); entity.getInventory().fillStackedContents(this.stackedContents);
this.menu.fillCraftSlotsStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents);
if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) { if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) {
@ -159,7 +159,7 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..a65d07cb3d2dae85225921498d1721dc
for(int m : intList) { for(int m : intList) {
- int n = StackedContents.fromStackingIndex(m).getMaxStackSize(); - int n = StackedContents.fromStackingIndex(m).getMaxStackSize();
+ int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper + int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper - Improve exact choice recipe ingredients
if (n < l) { if (n < l) {
l = n; l = n;
} }
@ -168,7 +168,7 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..a65d07cb3d2dae85225921498d1721dc
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) { public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
Slot slot2 = this.menu.getSlot(slot); Slot slot2 = this.menu.getSlot(slot);
- ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next()); - ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next());
+ // Paper start + // Paper start - Improve exact choice recipe ingredients
+ final int itemId = inputs.next(); + final int itemId = inputs.next();
+ ItemStack itemStack = null; + ItemStack itemStack = null;
+ boolean isExact = false; + boolean isExact = false;
@ -179,11 +179,11 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..a65d07cb3d2dae85225921498d1721dc
+ if (itemStack == null) { + if (itemStack == null) {
+ itemStack = StackedContents.fromStackingIndex(itemId); + itemStack = StackedContents.fromStackingIndex(itemId);
+ } + }
+ // Paper end + // Paper end - Improve exact choice recipe ingredients
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
for(int i = 0; i < amount; ++i) { for(int i = 0; i < amount; ++i) {
- this.moveItemToGrid(slot2, itemStack); - this.moveItemToGrid(slot2, itemStack);
+ this.moveItemToGrid(slot2, itemStack, isExact); // Paper + this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients
} }
} }
@ -191,30 +191,30 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..a65d07cb3d2dae85225921498d1721dc
return i; return i;
} }
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Improve exact choice recipe ingredients
protected void moveItemToGrid(Slot slot, ItemStack stack) { protected void moveItemToGrid(Slot slot, ItemStack stack) {
- int i = this.inventory.findSlotMatchingUnusedItem(stack); - int i = this.inventory.findSlotMatchingUnusedItem(stack);
+ // Paper start + // Paper start - Improve exact choice recipe ingredients
+ this.moveItemToGrid(slot, stack, false); + this.moveItemToGrid(slot, stack, false);
+ } + }
+ protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) { + protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) {
+ int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack); + int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack);
+ // Paper end + // Paper end - Improve exact choice recipe ingredients
if (i != -1) { if (i != -1) {
ItemStack itemStack = this.inventory.getItem(i); ItemStack itemStack = this.inventory.getItem(i);
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e21d015ebc 100644 index 5cc5f67284ad01c9154876252450552ed37f24bf..9c7b05fec22a8b84c29d7210f1104030a20cc7aa 100644
--- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java --- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java
+++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java +++ b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
@@ -21,8 +21,10 @@ import net.minecraft.world.item.crafting.RecipeHolder; @@ -21,8 +21,10 @@ import net.minecraft.world.item.crafting.RecipeHolder;
public class StackedContents { public class StackedContents {
private static final int EMPTY = 0; private static final int EMPTY = 0;
public final Int2IntMap contents = new Int2IntOpenHashMap(); public final Int2IntMap contents = new Int2IntOpenHashMap();
+ @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper + @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper - Improve exact choice recipe ingredients
public void accountSimpleStack(ItemStack stack) { public void accountSimpleStack(ItemStack stack) {
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - max of 64 due to accountStack method below + if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - Improve exact choice recipe ingredients; max of 64 due to accountStack method below
if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) { if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) {
this.accountStack(stack); this.accountStack(stack);
} }
@ -222,7 +222,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
int i = getStackingIndex(stack); int i = getStackingIndex(stack);
int j = Math.min(maxCount, stack.getCount()); int j = Math.min(maxCount, stack.getCount());
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - if an exact ingredient, don't include it + if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - Improve exact choice recipe ingredients; if an exact ingredient, don't include it
this.put(i, j); this.put(i, j);
} }
@ -230,7 +230,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId)); return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
} }
+ // Paper start + // Paper start - Improve exact choice recipe ingredients
+ public void initialize(final Recipe<?> recipe) { + public void initialize(final Recipe<?> recipe) {
+ this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe); + this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe);
+ } + }
@ -245,7 +245,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
+ public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) { + public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) {
+ return extrasMap.getById(itemId).copy(); + return extrasMap.getById(itemId).copy();
+ } + }
+ // Paper end + // Paper end - Improve exact choice recipe ingredients
+ +
public void clear() { public void clear() {
this.contents.clear(); this.contents.clear();
@ -255,7 +255,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
for(int i = 0; i < this.ingredients.size(); ++i) { for(int i = 0; i < this.ingredients.size(); ++i) {
- IntList intList = this.ingredients.get(i).getStackingIds(); - IntList intList = this.ingredients.get(i).getStackingIds();
+ IntList intList = this.getStackingIds(this.ingredients.get(i)); // Paper + IntList intList = this.getStackingIds(this.ingredients.get(i)); // Paper - Improve exact choice recipe ingredients
for(int j = 0; j < this.itemCount; ++j) { for(int j = 0; j < this.itemCount; ++j) {
if (intList.contains(this.items[j])) { if (intList.contains(this.items[j])) {
@ -264,7 +264,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
for(Ingredient ingredient : this.ingredients) { for(Ingredient ingredient : this.ingredients) {
- intCollection.addAll(ingredient.getStackingIds()); - intCollection.addAll(ingredient.getStackingIds());
+ intCollection.addAll(this.getStackingIds(ingredient)); // Paper + intCollection.addAll(this.getStackingIds(ingredient)); // Paper - Improve exact choice recipe ingredients
} }
IntIterator intIterator = intCollection.iterator(); IntIterator intIterator = intCollection.iterator();
@ -273,7 +273,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
int j = 0; int j = 0;
- for(int k : ingredient.getStackingIds()) { - for(int k : ingredient.getStackingIds()) {
+ for(int k : this.getStackingIds(ingredient)) { // Paper + for(int k : this.getStackingIds(ingredient)) { // Paper - Improve exact choice recipe ingredients
j = Math.max(j, StackedContents.this.contents.get(k)); j = Math.max(j, StackedContents.this.contents.get(k));
} }
@ -282,7 +282,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
return i; return i;
} }
+ +
+ // Paper start - improve exact recipe choices + // Paper start - Improve exact choice recipe ingredients
+ private IntList getStackingIds(final Ingredient ingredient) { + private IntList getStackingIds(final Ingredient ingredient) {
+ if (StackedContents.this.extrasMap != null) { + if (StackedContents.this.extrasMap != null) {
+ final IntList ids = StackedContents.this.extrasMap.extraStackingIds.get(ingredient); + final IntList ids = StackedContents.this.extrasMap.extraStackingIds.get(ingredient);
@ -292,7 +292,7 @@ index 5cc5f67284ad01c9154876252450552ed37f24bf..26b236a764177ac16d53f5cbaf83d3e2
+ } + }
+ return ingredient.getStackingIds(); + return ingredient.getStackingIds();
+ } + }
+ // Paper end - improve exact recipe choices + // Paper end - Improve exact choice recipe ingredients
} }
} }
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java

View File

@ -22,14 +22,14 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 833fb2f340065a72903620f974e6ac71cc86f3f9..00fa6126ca51b6ffdb46b59f07725ffdcca9f20a 100644 index 833fb2f340065a72903620f974e6ac71cc86f3f9..748321534eab7a8c35a85b4d4ab8020bd4623654 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -291,6 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -291,6 +291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault();
private final FutureChain chatMessageChain; private final FutureChain chatMessageChain;
private boolean waitingForSwitchToConfig; private boolean waitingForSwitchToConfig;
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper + private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper - Limit client sign length
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
super(server, connection, clientData, player); // CraftBukkit super(server, connection, clientData, player); // CraftBukkit
@ -38,7 +38,7 @@ index 833fb2f340065a72903620f974e6ac71cc86f3f9..00fa6126ca51b6ffdb46b59f07725ffd
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
- List<String> list = (List) Stream.of(packet.getLines()).map(ChatFormatting::stripFormatting).collect(Collectors.toList()); - List<String> list = (List) Stream.of(packet.getLines()).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
+ // Paper start - cap line length - modified clients can send longer data than normal + // Paper start - Limit client sign length
+ String[] lines = packet.getLines(); + String[] lines = packet.getLines();
+ for (int i = 0; i < lines.length; ++i) { + for (int i = 0; i < lines.length; ++i) {
+ if (MAX_SIGN_LINE_LENGTH > 0 && lines[i].length() > MAX_SIGN_LINE_LENGTH) { + if (MAX_SIGN_LINE_LENGTH > 0 && lines[i].length() > MAX_SIGN_LINE_LENGTH) {
@ -50,7 +50,7 @@ index 833fb2f340065a72903620f974e6ac71cc86f3f9..00fa6126ca51b6ffdb46b59f07725ffd
+ } + }
+ } + }
+ List<String> list = (List) Stream.of(lines).map(ChatFormatting::stripFormatting).collect(Collectors.toList()); + List<String> list = (List) Stream.of(lines).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
+ // Paper end + // Paper end - Limit client sign length
this.filterTextPacket(list).thenAcceptAsync((list1) -> { this.filterTextPacket(list).thenAcceptAsync((list1) -> {
this.updateSignText(packet, list1); this.updateSignText(packet, list1);

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d3f57dfd5156a5df17a5a7a6e5fe51d8804fd38f..18dc5ef7892c24f4071c8c0621ac412a5d8767bd 100644 index d3f57dfd5156a5df17a5a7a6e5fe51d8804fd38f..c9dbc32561ddd39b40ed42d8cc6550a904ac158e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1157,6 +1157,7 @@ public abstract class PlayerList { @@ -1157,6 +1157,7 @@ public abstract class PlayerList {
} }
public void setUsingWhiteList(boolean whitelistEnabled) { public void setUsingWhiteList(boolean whitelistEnabled) {
+ new com.destroystokyo.paper.event.server.WhitelistToggleEvent(whitelistEnabled).callEvent(); + new com.destroystokyo.paper.event.server.WhitelistToggleEvent(whitelistEnabled).callEvent(); // Paper - WhitelistToggleEvent
this.doWhiteList = whitelistEnabled; this.doWhiteList = whitelistEnabled;
} }

View File

@ -6,24 +6,24 @@ Subject: [PATCH] Handle Oversized Tile Entities in chunks
Splits out Extra Packets if too many TE's are encountered to prevent Splits out Extra Packets if too many TE's are encountered to prevent
creating too large of a packet to sed. creating too large of a packet to sed.
Co authored by Spottedleaf Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index f47eeb70661661610ef1a96dd9da67785825c126..0711ad682206e783fd0a1e566828670321f297e2 100644 index f47eeb70661661610ef1a96dd9da67785825c126..dda7151d333144399ba5602e1b651b1f5b8f8f0d 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData { @@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData {
private final CompoundTag heightmaps; private final CompoundTag heightmaps;
private final byte[] buffer; private final byte[] buffer;
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData; private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
+ // Paper start + // Paper start - Handle oversized block entities in chunks
+ private final java.util.List<net.minecraft.network.protocol.Packet<?>> extraPackets = new java.util.ArrayList<>(); + private final java.util.List<net.minecraft.network.protocol.Packet<?>> extraPackets = new java.util.ArrayList<>();
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
+ +
+ public List<net.minecraft.network.protocol.Packet<?>> getExtraPackets() { + public List<net.minecraft.network.protocol.Packet<?>> getExtraPackets() {
+ return this.extraPackets; + return this.extraPackets;
+ } + }
+ // Paper end + // Paper end - Handle oversized block entities in chunks
public ClientboundLevelChunkPacketData(LevelChunk chunk) { public ClientboundLevelChunkPacketData(LevelChunk chunk) {
this.heightmaps = new CompoundTag(); this.heightmaps = new CompoundTag();
@ -31,10 +31,10 @@ index f47eeb70661661610ef1a96dd9da67785825c126..0711ad682206e783fd0a1e5668286703
this.buffer = new byte[calculateChunkSize(chunk)]; this.buffer = new byte[calculateChunkSize(chunk)];
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk); extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
this.blockEntitiesData = Lists.newArrayList(); this.blockEntitiesData = Lists.newArrayList();
+ int totalTileEntities = 0; // Paper + int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
+ // Paper start + // Paper start - Handle oversized block entities in chunks
+ if (++totalTileEntities > TE_LIMIT) { + if (++totalTileEntities > TE_LIMIT) {
+ var packet = entry2.getValue().getUpdatePacket(); + var packet = entry2.getValue().getUpdatePacket();
+ if (packet != null) { + if (packet != null) {
@ -42,12 +42,12 @@ index f47eeb70661661610ef1a96dd9da67785825c126..0711ad682206e783fd0a1e5668286703
+ continue; + continue;
+ } + }
+ } + }
+ // Paper end + // Paper end - Handle oversized block entities in chunks
this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue())); this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue()));
} }
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..be89e5b8c1ea7f85aef267a15986affa5fa1fd4b 100644 index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..90ec22d35edb2874417bbea590e0d3c37ad93d64 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa @@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
@ -55,10 +55,10 @@ index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..be89e5b8c1ea7f85aef267a15986affa
return this.lightData; return this.lightData;
} }
+ +
+ // Paper start - handle over-sized TE packets + // Paper start - Handle oversized block entities in chunks
+ @Override + @Override
+ public java.util.List<Packet<?>> getExtraPackets() { + public java.util.List<Packet<?>> getExtraPackets() {
+ return this.chunkData.getExtraPackets(); + return this.chunkData.getExtraPackets();
+ } + }
+ // Paper end + // Paper end - Handle oversized block entities in chunks
} }

View File

@ -10,42 +10,42 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored. or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..a7c89cdf20cb63792c76de81c1ff9f2cbbfcea84 100644 index 2eddeb8d5239bbfeefbf4d3bd363f1ad083299b6..e2b44b8ddb8afc6e1f7dddadb434c2268f284809 100644
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java --- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java +++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
@@ -57,6 +57,7 @@ public class SummonCommand { @@ -57,6 +57,7 @@ public class SummonCommand {
ServerLevel worldserver = source.getLevel(); ServerLevel worldserver = source.getLevel();
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot()); entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper + entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason
return entity1; return entity1;
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1e10d55962a7221e197723eb42434be052a7661a..43424a9d8e985f4965b4d101f7fee398e3d1f52c 100644 index 1e10d55962a7221e197723eb42434be052a7661a..cf2ae848a3860a5a27723047b02bde3aa8255d62 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1454,6 +1454,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1454,6 +1454,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true; return true;
} }
// Paper end // Paper end
+ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper + if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper - Entity#getEntitySpawnReason
if (entity.isRemoved()) { if (entity.isRemoved()) {
// Paper start // Paper start
if (DEBUG_ENTITIES) { if (DEBUG_ENTITIES) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 18dc5ef7892c24f4071c8c0621ac412a5d8767bd..c98e4469fa8940762c26a8d787bfabe4b2719fb5 100644 index c9dbc32561ddd39b40ed42d8cc6550a904ac158e..63d793ee00b14a12d0dbad15bee579a330f1eb07 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -223,6 +223,11 @@ public abstract class PlayerList { @@ -223,6 +223,11 @@ public abstract class PlayerList {
worldserver1 = worldserver; worldserver1 = worldserver;
} }
+ // Paper start + // Paper start - Entity#getEntitySpawnReason
+ if (nbttagcompound == null) { + if (nbttagcompound == null) {
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ } + }
+ // Paper end + // Paper end - Entity#getEntitySpawnReason
player.setServerLevel(worldserver1); player.setServerLevel(worldserver1);
String s1 = connection.getLoggableAddress(this.server.logIPs()); String s1 = connection.getLoggableAddress(this.server.logIPs());
@ -54,19 +54,19 @@ index 18dc5ef7892c24f4071c8c0621ac412a5d8767bd..c98e4469fa8940762c26a8d787bfabe4
ServerLevel finalWorldServer = worldserver1; ServerLevel finalWorldServer = worldserver1;
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
- return !finalWorldServer.addWithUUID(entity1) ? null : entity1; - return !finalWorldServer.addWithUUID(entity1) ? null : entity1;
+ return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper + return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason
// CraftBukkit end // CraftBukkit end
}); });
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e44d983e7b44225bdd7395488d2b246761e8e02a..e1ad7394abdbf938841150e4f7092ac70181ddb0 100644 index e44d983e7b44225bdd7395488d2b246761e8e02a..748bc33b9812791ffe4b811c405b45d07c18cdcd 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -237,6 +237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -237,6 +237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
} }
// Paper end // Paper end
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper + public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity; private CraftEntity bukkitEntity;
@ -108,19 +108,19 @@ index e44d983e7b44225bdd7395488d2b246761e8e02a..e1ad7394abdbf938841150e4f7092ac7
} catch (Throwable throwable) { } catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 713608239cc7518d05b04d3dd79c3af0c358c64e..231674f1483ad71630ac71ba92efc50f94a5659b 100644 index 713608239cc7518d05b04d3dd79c3af0c358c64e..0d04581b73a9daa91bbcb0ef0b28d601fc0e9599 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -189,6 +189,7 @@ public abstract class BaseSpawner { @@ -189,6 +189,7 @@ public abstract class BaseSpawner {
} }
entity.spawnedViaMobSpawner = true; // Paper entity.spawnedViaMobSpawner = true; // Paper
+ entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper + entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper - Entity#getEntitySpawnReason
flag = true; // Paper flag = true; // Paper
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
index faad948f089575e4988d989790cc1dd13f8a79cd..ee11a52e82091911aa3a196bcc1f7ab829626cef 100644 index faad948f089575e4988d989790cc1dd13f8a79cd..e143f42e71ac774d49b75e6d85591aa1189ee210 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
@@ -186,7 +186,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi @@ -186,7 +186,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi
@ -128,7 +128,7 @@ index faad948f089575e4988d989790cc1dd13f8a79cd..ee11a52e82091911aa3a196bcc1f7ab8
private boolean trySummonWarden(ServerLevel world) { private boolean trySummonWarden(ServerLevel world) {
- return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent(); - return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent();
+ return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper + return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper - Entity#getEntitySpawnReason
} }
@Override @Override

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Fire event on GS4 query
diff --git a/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java b/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java diff --git a/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java b/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java
index 51cb2644aa516a59e19fecb308d519dbc7e5fb11..e548aa0ca4e1e94ab628614b44fc11568ca3beff 100644 index 51cb2644aa516a59e19fecb308d519dbc7e5fb11..e6340e0c98f6b208133ebaa44cdd1133be192eca 100644
--- a/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java --- a/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java
+++ b/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java +++ b/src/main/java/net/minecraft/server/rcon/NetworkDataOutputStream.java
@@ -22,6 +22,16 @@ public class NetworkDataOutputStream { @@ -22,6 +22,16 @@ public class NetworkDataOutputStream {
this.dataOutputStream.write(0); this.dataOutputStream.write(0);
} }
+ // Paper start - unchecked exception variant to use in Stream API + // Paper start - Fire event on GS4 query
+ public void writeStringUnchecked(String string) { + public void writeStringUnchecked(String string) {
+ try { + try {
+ writeString(string); + writeString(string);
@ -20,7 +20,7 @@ index 51cb2644aa516a59e19fecb308d519dbc7e5fb11..e548aa0ca4e1e94ab628614b44fc1156
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); + com.destroystokyo.paper.util.SneakyThrow.sneaky(e);
+ } + }
+ } + }
+ // Paper end + // Paper end - Fire event on GS4 query
+ +
public void write(int value) throws IOException { public void write(int value) throws IOException {
this.dataOutputStream.write(value); this.dataOutputStream.write(value);

View File

@ -1,26 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com> From: MisterVector <whizkid3000@hotmail.com>
Date: Fri, 26 Oct 2018 21:31:00 -0700 Date: Fri, 26 Oct 2018 21:31:00 -0700
Subject: [PATCH] Implement PlayerPostRespawnEvent Subject: [PATCH] Add PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c98e4469fa8940762c26a8d787bfabe4b2719fb5..109cefef2a39aaae50ca745d907729d066aa9033 100644 index 63d793ee00b14a12d0dbad15bee579a330f1eb07..89bd3102898af0b178cbb7f8dbe041a05c5845f3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -751,9 +751,14 @@ public abstract class PlayerList { @@ -751,9 +751,14 @@ public abstract class PlayerList {
boolean flag2 = false; boolean flag2 = false;
+ // Paper start + // Paper start - Add PlayerPostRespawnEvent
+ boolean isBedSpawn = false; + boolean isBedSpawn = false;
+ boolean isRespawn = false; + boolean isRespawn = false;
+ // Paper end + // Paper end - Add PlayerPostRespawnEvent
+ +
// CraftBukkit start - fire PlayerRespawnEvent // CraftBukkit start - fire PlayerRespawnEvent
if (location == null) { if (location == null) {
- boolean isBedSpawn = false; - boolean isBedSpawn = false;
+ // boolean isBedSpawn = false; // Paper - moved up + // boolean isBedSpawn = false; // Paper - Add PlayerPostRespawnEvent; moved up
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) { if (worldserver1 != null) {
Optional optional; Optional optional;
@ -28,7 +28,7 @@ index c98e4469fa8940762c26a8d787bfabe4b2719fb5..109cefef2a39aaae50ca745d907729d0
location = respawnEvent.getRespawnLocation(); location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785 if (!flag) entityplayer.reset(); // SPIGOT-4785
+ isRespawn = true; // Paper + isRespawn = true; // Paper - Add PlayerPostRespawnEvent
} else { } else {
location.setWorld(worldserver.getWorld()); location.setWorld(worldserver.getWorld());
} }
@ -37,11 +37,11 @@ index c98e4469fa8940762c26a8d787bfabe4b2719fb5..109cefef2a39aaae50ca745d907729d0
this.save(entityplayer); this.save(entityplayer);
} }
+ +
+ // Paper start + // Paper start - Add PlayerPostRespawnEvent
+ if (isRespawn) { + if (isRespawn) {
+ cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn)); + cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn));
+ } + }
+ // Paper end + // Paper end - Add PlayerPostRespawnEvent
+ +
// CraftBukkit end // CraftBukkit end
return entityplayer1; return entityplayer1;

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick Fires event at start and end of a server tick
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 ce370cb1ed9ef67044c5ab448c52367779e5105f..cdff8dfc675328e559b7063c67dfe6300f458eb6 100644 index 1353bc4ddee1bafb76efbe6867f8821acc12a708..609b22f03c60ade8c2c1c7a0b191c2e24526aadf 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
@@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}); });
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end // Paper end
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper + new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
++this.tickCount; ++this.tickCount;
this.tickRateManager.tick(); this.tickRateManager.tick();
@ -21,11 +21,11 @@ index ce370cb1ed9ef67044c5ab448c52367779e5105f..cdff8dfc675328e559b7063c67dfe630
this.runAllTasks(); this.runAllTasks();
} }
// Paper end // Paper end
+ // Paper start + // Paper start - Server Tick Events
+ long endTime = System.nanoTime(); + long endTime = System.nanoTime();
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime; + long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent(); + new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
+ // Paper end + // Paper end - Server Tick Events
this.profiler.push("tallying"); this.profiler.push("tallying");
long j = Util.getNanos() - i; long j = Util.getNanos() - i;
int k = this.tickCount % 100; int k = this.tickCount % 100;

View File

@ -11,14 +11,14 @@ Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
public net.minecraft.world.entity.player.Inventory compartments public net.minecraft.world.entity.player.Inventory compartments
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8cc33c1b14668c085dbad1f3feabf7b602812471..91053c2b19751aa3ff219b615b595b730ffa134f 100644 index 8cc33c1b14668c085dbad1f3feabf7b602812471..5d491a5a885b00cad003538fc20720355c7f218a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -857,6 +857,46 @@ public class ServerPlayer extends Player { @@ -857,6 +857,46 @@ public class ServerPlayer extends Player {
}); });
} }
+ // Paper start - process inventory + // Paper start - PlayerDeathEvent#getItemsToKeep
+ private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) { + private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) {
+ List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep(); + List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep();
+ if (inv == null) { + if (inv == null) {
@ -56,7 +56,7 @@ index 8cc33c1b14668c085dbad1f3feabf7b602812471..91053c2b19751aa3ff219b615b595b73
+ } + }
+ } + }
+ } + }
+ // Paper end + // Paper end - PlayerDeathEvent#getItemsToKeep
+ +
@Override @Override
public void die(DamageSource damageSource) { public void die(DamageSource damageSource) {
@ -66,12 +66,12 @@ index 8cc33c1b14668c085dbad1f3feabf7b602812471..91053c2b19751aa3ff219b615b595b73
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) { if (!event.getKeepInventory()) {
- this.getInventory().clearContent(); - this.getInventory().clearContent();
+ // Paper start - replace logic + // Paper start - PlayerDeathEvent#getItemsToKeep
+ for (NonNullList<ItemStack> inv : this.getInventory().compartments) { + for (NonNullList<ItemStack> inv : this.getInventory().compartments) {
+ processKeep(event, inv); + processKeep(event, inv);
+ } + }
+ processKeep(event, null); + processKeep(event, null);
+ // Paper end + // Paper end - PlayerDeathEvent#getItemsToKeep
} }
this.setCamera(this); // Remove spectated target this.setCamera(this); // Remove spectated target

View File

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 91053c2b19751aa3ff219b615b595b730ffa134f..5aef108c5b78cfc02af5c73b9bc03004fba33ca7 100644 index 5d491a5a885b00cad003538fc20720355c7f218a..a37174c76ca01a4c9831a63548b3161257c70f87 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -978,7 +978,7 @@ public class ServerPlayer extends Player { @@ -978,7 +978,7 @@ public class ServerPlayer extends Player {
@ -16,4 +16,4 @@ index 91053c2b19751aa3ff219b615b595b730ffa134f..5aef108c5b78cfc02af5c73b9bc03004
+ if (event.shouldDropExperience()) this.dropExperience(); // Paper - tie to event + if (event.shouldDropExperience()) this.dropExperience(); // Paper - tie to event
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) { if (!event.getKeepInventory()) {
// Paper start - replace logic // Paper start - PlayerDeathEvent#getItemsToKeep

View File

@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping public net.minecraft.world.entity.LivingEntity jumping
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b10097cd28f0dc360cda9b31e8184ed3a7003780..2d1aa3acd41615b1b2c9cf5751152a56f1f18ec5 100644 index 1b3df2f8e83b6bff4bbe8d37836072be2b2e6084..0ed44bc939b256a4b91eb24812e4de10a9af01b7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -112,7 +112,7 @@ index b10097cd28f0dc360cda9b31e8184ed3a7003780..2d1aa3acd41615b1b2c9cf5751152a56
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e1ad7394abdbf938841150e4f7092ac70181ddb0..26a611b8d75513690811fbbd15dc37e6f4a50dd4 100644 index 14e2077aba3b2fcf347f7184a53ca8dda943322b..3c0725ca02f6ab9adde307aab864d856dc6e42e1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -397,6 +397,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -397,6 +397,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -148,7 +148,7 @@ index e1ad7394abdbf938841150e4f7092ac70181ddb0..26a611b8d75513690811fbbd15dc37e6
movement = this.maybeBackOffFromEdge(movement, movementType); movement = this.maybeBackOffFromEdge(movement, movementType);
Vec3 vec3d1 = this.collide(movement); Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index efef5df4cf720058c0b07ef795cfa6a567113811..d330b6d291cd2967358e892ccbc480bb3bd8022d 100644 index 08bf4e4f108ae2eb87eb3b98e2b74d7d0f1d6a7c..3da1debb3ad884d9ba2f8ebea52643e8fcb3a747 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -221,6 +221,19 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -221,6 +221,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
@ -217,19 +217,10 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894
this.availableGoals.stream().filter((wrappedGoal) -> { this.availableGoals.stream().filter((wrappedGoal) -> {
return wrappedGoal.getGoal() == goal; return wrappedGoal.getGoal() == goal;
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 7153e00a640abfeb134ff1dcb93f363b972a4233..4bbc36404b396500df0d9db380cf223b5897662e 100644 index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02ba3141eb 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -23,6 +23,14 @@ public abstract class MoveToBlockGoal extends Goal {
protected int nextStartTick;
protected int tryTicks;
private int maxStayTicks;
- protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
+ protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } @Deprecated public void setTargetPosition(BlockPos pos) { this.blockPos = pos; mob.movingTarget = pos != BlockPos.ZERO ? pos : null; } // Paper - OBFHELPER
private boolean reachedTarget;
private final int searchRange;
private final int verticalSearchRange;
@@ -23,6 +23,13 @@ public abstract class MoveToBlockGoal extends Goal {
public MoveToBlockGoal(PathfinderMob mob, double speed, int range) { public MoveToBlockGoal(PathfinderMob mob, double speed, int range) {
this(mob, speed, range, 1); this(mob, speed, range, 1);
} }
@ -237,17 +228,18 @@ index 7153e00a640abfeb134ff1dcb93f363b972a4233..4bbc36404b396500df0d9db380cf223b
+ @Override + @Override
+ public void stop() { + public void stop() {
+ super.stop(); + super.stop();
+ setTargetPosition(BlockPos.ZERO); + this.blockPos = BlockPos.ZERO;
+ this.mob.movingTarget = null;
+ } + }
+ // Paper end + // Paper end
public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) { public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) {
this.mob = mob; this.mob = mob;
@@ -114,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -114,6 +122,7 @@ public abstract class MoveToBlockGoal extends Goal {
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
this.blockPos = mutableBlockPos; this.blockPos = mutableBlockPos;
+ setTargetPosition(mutableBlockPos.immutable()); // Paper + this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper
return true; return true;
} }
} }
@ -348,7 +340,7 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6
+ +
} }
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 3fdec0ff323ac94517f1ab9a13764a8959148127..9e4ab11521b853d0db55b382413c1f49cbff9e9e 100644 index 5ce8c8b13dd380f483406af5356d347b60868606..ec35b05aeae0fb8e413653fd6495067f06144556 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
@@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -163,6 +163,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -1017,12 +1017,12 @@ index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..51f647de153255c919b1440338cf1b3e
} }
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 0711ad682206e783fd0a1e566828670321f297e2..bf6cdc08367fc26716e7904162a21e63fecab3ed 100644 index dda7151d333144399ba5602e1b651b1f5b8f8f0d..8ffb99aedaa57c1e96ddcc05143776b59c9700a3 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -33,7 +33,10 @@ public class ClientboundLevelChunkPacketData { @@ -33,7 +33,10 @@ public class ClientboundLevelChunkPacketData {
} }
// Paper end // Paper end - Handle oversized block entities in chunks
- public ClientboundLevelChunkPacketData(LevelChunk chunk) { - public ClientboundLevelChunkPacketData(LevelChunk chunk) {
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
@ -1046,7 +1046,7 @@ index 0711ad682206e783fd0a1e566828670321f297e2..bf6cdc08367fc26716e7904162a21e63
+ extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo); + extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo);
+ // Paper end + // Paper end
this.blockEntitiesData = Lists.newArrayList(); this.blockEntitiesData = Lists.newArrayList();
int totalTileEntities = 0; // Paper int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
@@ -103,9 +113,15 @@ public class ClientboundLevelChunkPacketData { @@ -103,9 +113,15 @@ public class ClientboundLevelChunkPacketData {
return byteBuf; return byteBuf;
@ -1067,7 +1067,7 @@ index 0711ad682206e783fd0a1e566828670321f297e2..bf6cdc08367fc26716e7904162a21e63
} }
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index be89e5b8c1ea7f85aef267a15986affa5fa1fd4b..43472855136f26b282d94fd241853d862a19ae17 100644 index 90ec22d35edb2874417bbea590e0d3c37ad93d64..fc230d835f9aa526a4b179d36d921f0fec348aa8 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -13,13 +13,30 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa @@ -13,13 +13,30 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
@ -1104,7 +1104,7 @@ index be89e5b8c1ea7f85aef267a15986affa5fa1fd4b..43472855136f26b282d94fd241853d86
public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2d1aa3acd41615b1b2c9cf5751152a56f1f18ec5..6d6ad6a33f3f8e4b8bc39fea00506daf7b31275c 100644 index 0ed44bc939b256a4b91eb24812e4de10a9af01b7..8eff58898faea024787e56cf98c8498c46db16d4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -572,7 +572,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -572,7 +572,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -1155,7 +1155,7 @@ index 5de5209e04d631bd6a50e28e8d3abebf148252c1..19b3f4fa7678a038bf25efc2a8b46dda
DebugPackets.sendPoiPacketsForChunk(world, chunkPos); DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
} }
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 9e4ab11521b853d0db55b382413c1f49cbff9e9e..8782c443d6288cb1cadc181e7f2923cbcd3061d2 100644 index 322f2ef70273d52bf6daced17aec09f7d34c9200..a58df7552766abb0c923402bfa40e5d72d972e83 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
@@ -178,6 +178,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -178,6 +178,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1491,7 +1491,7 @@ index 9a2bf744abd8916d492e901be889223591bac3fd..1dd415c96d17eff8e7555c33d3c52e57
int getSerializedSize(); int getSerializedSize();
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 982fb3ef071d6a66f16744717e8e146bef6d9e8c..02beedb84a8bec001270116c6ce496db012e6b8a 100644 index 7862caa0f787634cec14af81fe1f39803a43f115..0341d9e951366b77e7eeac7cdaa950af62c88aab 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
@@ -71,7 +71,7 @@ import org.slf4j.Logger; @@ -71,7 +71,7 @@ import org.slf4j.Logger;
@ -1571,7 +1571,7 @@ index 01fa200bc6911388ee3b0e700e82ad681e02fe4a..217fd2af254f7206cf4c1d7d7ad08384
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index bcd782f9b13c71f1a5bce4836463d0b57e5ada72..357b82e110b789b7a12735a844a9c7e720b4f479 100644 index d4518b9c1338226a9a814d2512aaddbb76a42da8..729c3c273e2393674f30af1cfb0ab0dcf0fb3e20 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -421,11 +421,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -421,11 +421,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -10,13 +10,13 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day. world and the world age for the start day.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fff540886166a60b967cf14e93776e36dcbe1308..070dddc5597cf623e2a29e731739383fd98b94d1 100644 index 587205f8b5f6a9aedd5d54b940dcc89b3b9c0be8..56e176b2c79e45f2d68bf6b0e201bf65a96faa6c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -249,6 +249,7 @@ public class ServerPlayer extends Player { @@ -249,6 +249,7 @@ public class ServerPlayer extends Player {
public boolean wonGame; public boolean wonGame;
private int containerUpdateDelay; // Paper private int containerUpdateDelay; // Paper
public long loginTime; // Paper public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed
+ public int patrolSpawnDelay; // Paper - Pillager patrol spawn settings and per player options + public int patrolSpawnDelay; // Paper - Pillager patrol spawn settings and per player options
// Paper start - cancellable death event // Paper start - cancellable death event
public boolean queueHealthUpdatePacket = false; public boolean queueHealthUpdatePacket = false;

View File

@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups. massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 109cefef2a39aaae50ca745d907729d066aa9033..d4ae0a201838dbc9c73f7c1a8a67072b344b71bc 100644 index 89bd3102898af0b178cbb7f8dbe041a05c5845f3..aae54a44334ca4050b4bf939bdded7ac09d0a242 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -820,6 +820,7 @@ public abstract class PlayerList { @@ -820,6 +820,7 @@ public abstract class PlayerList {
@ -26,11 +26,11 @@ index 109cefef2a39aaae50ca745d907729d066aa9033..d4ae0a201838dbc9c73f7c1a8a67072b
// CraftBukkit end // CraftBukkit end
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7f08a5a9c853c1f54e1d3b142c52cfa5dfb8c091..04635faeb265852df7ec3ea9b04c8ae24c2fcd58 100644 index 7ca9b581e8719d47bdba2368fc9402ae8eb302c4..1e9819ea185b98a73992bde8c40150d4747ed436 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -240,6 +240,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -240,6 +240,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
+ public boolean collisionLoadChunks = false; // Paper + public boolean collisionLoadChunks = false; // Paper

View File

@ -13,7 +13,7 @@ By skipping this, we avoid potential for a large spike on server start.
public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9fcd1a7c1532c6343707665d96b1d147ed4d424f..e8470f0cc918ae20caa9aa4de7a81edf31f2f556 100644 index 5397b7544470741d75fe3df350cd85ca87acd077..ed2d3b514087f8c2aeec64362ed677fe4494b339 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -385,7 +385,7 @@ public class ServerPlayer extends Player { @@ -385,7 +385,7 @@ public class ServerPlayer extends Player {
@ -35,14 +35,14 @@ index 9fcd1a7c1532c6343707665d96b1d147ed4d424f..e8470f0cc918ae20caa9aa4de7a81edf
this.gameMode.setLevel((ServerLevel) world); this.gameMode.setLevel((ServerLevel) world);
} }
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d4ae0a201838dbc9c73f7c1a8a67072b344b71bc..02cb0a3d2331002a64ceb32027b9112cb7a81808 100644 index aae54a44334ca4050b4bf939bdded7ac09d0a242..89632b9848fddaaea12f149b50cb9e0b71a951b0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -226,6 +226,7 @@ public abstract class PlayerList { @@ -226,6 +226,7 @@ public abstract class PlayerList {
// Paper start // Paper start - Entity#getEntitySpawnReason
if (nbttagcompound == null) { if (nbttagcompound == null) {
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn + player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
} }
// Paper end // Paper end - Entity#getEntitySpawnReason
player.setServerLevel(worldserver1); player.setServerLevel(worldserver1);

View File

@ -10,7 +10,7 @@ Co-authored-by: Wyatt Childers <wchilders@nearce.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ffdd5b7417bb748ee5e8ad4d126bf3489c5d32ed..538ba950d194ec823443d1bdaf38a32eddf85df7 100644 index 85b0c15e8600b2b62db24c22dfab4680b08ca492..e0aed65461c75b28799a87a0ef266707ce63ca17 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -194,7 +194,7 @@ public abstract class PlayerList { @@ -194,7 +194,7 @@ public abstract class PlayerList {
@ -76,7 +76,7 @@ index ffdd5b7417bb748ee5e8ad4d126bf3489c5d32ed..538ba950d194ec823443d1bdaf38a32e
worldserver1 = worldserver; worldserver1 = worldserver;
} }
@@ -226,6 +254,10 @@ public abstract class PlayerList { @@ -226,6 +254,10 @@ public abstract class PlayerList {
// Paper start // Paper start - Entity#getEntitySpawnReason
if (nbttagcompound == null) { if (nbttagcompound == null) {
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ // Paper start - reset to main world spawn if first spawn or invalid world + // Paper start - reset to main world spawn if first spawn or invalid world
@ -85,9 +85,9 @@ index ffdd5b7417bb748ee5e8ad4d126bf3489c5d32ed..538ba950d194ec823443d1bdaf38a32e
+ // Paper end - reset to main world spawn if first spawn or invalid world + // Paper end - reset to main world spawn if first spawn or invalid world
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
} }
// Paper end // Paper end - Entity#getEntitySpawnReason
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 04635faeb265852df7ec3ea9b04c8ae24c2fcd58..b2dc3729a8312179d219bd93a755729c86f4dece 100644 index 1e9819ea185b98a73992bde8c40150d4747ed436..2374500ba0518415b7c680bc2ac05222761493ba 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2337,27 +2337,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2337,27 +2337,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -5,13 +5,13 @@ 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2fa60d96da53ca954dc1421745fafaeb2e806ed0..05fe4828af59e3cd894c9979ecb08ad0e1c6b2d3 100644 index d4bf6c909939c23586acaa7338141aac880217b0..87b010d5b0ce405e64092638108e4d64ad15339b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3510,7 +3510,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3510,7 +3510,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - suppress super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
- if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) { - if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
+ if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen + if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen
this.dismountVehicle(entity); this.dismountVehicle(entity);

View File

@ -10,15 +10,15 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor. still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 43bdada020a5a28cbe9eb18ec24529be633a49f3..a50c8728f6ece2ab1f08cacb64cf98790b8a6871 100644 index 3751ed19b63c3ddf76aa0f28454b6d4976d0d6b4..43188d6720a20f0809b4eabe9be49a8e88d1f9bb 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -806,6 +806,7 @@ public abstract class PlayerList { @@ -806,6 +806,7 @@ public abstract class PlayerList {
// Paper start // Paper start - Add PlayerPostRespawnEvent
boolean isBedSpawn = false; boolean isBedSpawn = false;
boolean isRespawn = false; boolean isRespawn = false;
+ boolean isLocAltered = false; // Paper - Fix SPIGOT-5989 + boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end // Paper end - Add PlayerPostRespawnEvent
// CraftBukkit start - fire PlayerRespawnEvent // CraftBukkit start - fire PlayerRespawnEvent
@@ -816,7 +817,7 @@ public abstract class PlayerList { @@ -816,7 +817,7 @@ public abstract class PlayerList {
@ -42,7 +42,7 @@ index 43bdada020a5a28cbe9eb18ec24529be633a49f3..a50c8728f6ece2ab1f08cacb64cf9879
+ } + }
+ // Paper end - Fix SPIGOT-5989 + // Paper end - Fix SPIGOT-5989
if (!flag) entityplayer.reset(); // SPIGOT-4785 if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper isRespawn = true; // Paper - Add PlayerPostRespawnEvent
} else { } else {
@@ -899,8 +905,14 @@ public abstract class PlayerList { @@ -899,8 +905,14 @@ public abstract class PlayerList {
} }

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Cache burn durations
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 939a192dd66d5fb8da5beada7c22eeca5a7589cd..5c65be04ac88f1308eae6a8cde36d5f7e8aad879 100644 index 9801b777bc6ab7de91d82b29a142459292ee8605..8f7029e602300f68b3c8411caa2d9e0b1e8be62e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.recipeType = recipeType; // Paper this.recipeType = recipeType; // Paper - cook speed multiplier API
} }
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations + private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d5e002dd0d17f3c5087ace3440d5bf348cd40d5a..ba02b3004de6efe2d1f69cda0ba759c9f0192767 100644 index 67584166891bf3e6a9b446d62d340bab265391ff..30a2b5f0d81552b1a78743516a7506f0a24bdc5e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2639,7 +2639,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2639,7 +2639,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -19,7 +19,7 @@ index d5e002dd0d17f3c5087ace3440d5bf348cd40d5a..ba02b3004de6efe2d1f69cda0ba759c9
} else { } else {
if (this.player.getHealth() > 0.0F) { if (this.player.getHealth() > 0.0F) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index abfa9d1a12caca37b4af203887689bd9c43a7d0f..a0f1d9ca16551adef2cacb16576b91810eefa292 100644 index 6d9fcedd75f998c80734e03b88d0fc0214b762ec..90a5bbe75ab164abc97e882cc33a081b4a785c9c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -781,6 +781,12 @@ public abstract class PlayerList { @@ -781,6 +781,12 @@ public abstract class PlayerList {
@ -37,12 +37,12 @@ index abfa9d1a12caca37b4af203887689bd9c43a7d0f..a0f1d9ca16551adef2cacb16576b9181
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -822,6 +828,7 @@ public abstract class PlayerList { @@ -822,6 +828,7 @@ public abstract class PlayerList {
// Paper start // Paper start - Add PlayerPostRespawnEvent
boolean isBedSpawn = false; boolean isBedSpawn = false;
+ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent + boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
boolean isRespawn = false; boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989 boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end // Paper end - Add PlayerPostRespawnEvent
@@ -842,6 +849,7 @@ public abstract class PlayerList { @@ -842,6 +849,7 @@ public abstract class PlayerList {
if (optional.isPresent()) { if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition); BlockState iblockdata = worldserver1.getBlockState(blockposition);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Send empty commands if tab completion is disabled
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 2de557a5ed91e2036a7f558cfca8b174cd534959..565685d0f41311bc2281d11ee9d751bf4d4c93a3 100644 index f844f7ae935b55d254c422b702a8ca2a81119baa..7802e72152628d1e853e5494ec1061fe01fefa5f 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -456,7 +456,12 @@ public class Commands { @@ -456,7 +456,12 @@ public class Commands {
@ -21,4 +21,4 @@ index 2de557a5ed91e2036a7f558cfca8b174cd534959..565685d0f41311bc2281d11ee9d751bf
+ // Paper end - Send empty commands if tab completion is disabled + // Paper end - Send empty commands if tab completion is disabled
// CraftBukkit start // CraftBukkit start
// Register Vanilla commands into builtRoot as before // Register Vanilla commands into builtRoot as before
// Paper start - Async command map building // Paper start - Perf: Async command map building

View File

@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92
public boolean shouldDisconnect() { public boolean shouldDisconnect() {
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 448bc8800860f0632a70998375efa5133024c06b..2d330b40cc604c8883a33e56322e419eff9e39cb 100644 index 5e279fb7e3b902905532cb10dce4df336ee52e67..b72dc50201601203eabfc7866e5843c496b54de7 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
@@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2236,7 +2236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -209,7 +209,7 @@ index 825b8f541fe3f5e4cb53f465232c19398b8e66ab..3049377685ee4fe75f0c4b68eab39a91
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 05a94d320e4591d77a99c09975aab4dc30ff9a1e..29f1a054c31d00fe7ba4c5d171c47efa9275f32d 100644 index dff0603ca577a04992ef2bff4b73ad87d66eee84..69f3278b55d6e3778aa9bad6be10870964db5bf9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -293,7 +293,7 @@ index 05a94d320e4591d77a99c09975aab4dc30ff9a1e..29f1a054c31d00fe7ba4c5d171c47efa
return; return;
} }
} }
// Paper end // Paper end - Book size limits
// CraftBukkit start // CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) { if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
- this.disconnect("Book edited too quickly!"); - this.disconnect("Book edited too quickly!");
@ -437,7 +437,7 @@ index 05a94d320e4591d77a99c09975aab4dc30ff9a1e..29f1a054c31d00fe7ba4c5d171c47efa
} }
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 62a005826cd4a26927cde13cfb3551c1f187bfbe..3ae5efb964f3c791b58d4d336881cf189169f7f3 100644 index 777b2566767104103e3c6313a602e45730e5c4d9..a7f3963d2e1a9a6d3a5060be6c6694fc518b4f0f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -684,7 +684,7 @@ public abstract class PlayerList { @@ -684,7 +684,7 @@ public abstract class PlayerList {

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 29f1a054c31d00fe7ba4c5d171c47efa9275f32d..60be2ae945514aaec70a2350df2044df53ed3224 100644 index 69f3278b55d6e3778aa9bad6be10870964db5bf9..1502961f7be651e608759f13be8e143c0df12ab5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper end // Paper end - Book size limits
// CraftBukkit start // CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) { if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
- this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause - this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause

View File

@ -33,7 +33,7 @@ index 5e5199b50847958f7abc6d8e42cfb6806df8421f..af62781cc96354c87aa63d4f03f9e25b
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) { public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool) {
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 565da027ca7c395f9b965505cbe9e85e62367834..de9102f943fe90122b2fe7f94228b4248244374a 100644 index c34b34a6be594c502d1cb59703ace8ad8dd96915..4342bc4535ea812fef3fab56917e5de15947c42d 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
@@ -415,7 +415,7 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -415,7 +415,7 @@ public class PistonBaseBlock extends DirectionalBlock {
@ -46,10 +46,10 @@ index 565da027ca7c395f9b965505cbe9e85e62367834..de9102f943fe90122b2fe7f94228b424
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1)); world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition3, GameEvent.Context.of(iblockdata1));
if (!iblockdata1.is(BlockTags.FIRE)) { if (!iblockdata1.is(BlockTags.FIRE)) {
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index f7527ed1d47901e52df4e3fffbdcd838782c90db..482616c7cbe12f7a23ec99378e24a87dedc2a8ae 100644 index 0aeb9faa1ce22359361741a591aa3d465d955970..a98ab20814cc29a25e9d29adfbb7e70d46768df2 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -296,7 +296,7 @@ public abstract class FlowingFluid extends Fluid { @@ -295,7 +295,7 @@ public abstract class FlowingFluid extends Fluid {
((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState); ((LiquidBlockContainer) state.getBlock()).placeLiquid(world, pos, state, fluidState);
} else { } else {
if (!state.isAir()) { if (!state.isAir()) {
@ -58,7 +58,7 @@ index f7527ed1d47901e52df4e3fffbdcd838782c90db..482616c7cbe12f7a23ec99378e24a87d
} }
world.setBlock(pos, fluidState.createLegacyBlock(), 3); world.setBlock(pos, fluidState.createLegacyBlock(), 3);
@@ -304,6 +304,7 @@ public abstract class FlowingFluid extends Fluid { @@ -303,6 +303,7 @@ public abstract class FlowingFluid extends Fluid {
} }

View File

@ -2179,7 +2179,7 @@ index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id; this.data3d = id;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f35bd06e3ae16922dfde76abda5b6f938f5b50f7..cb18d1a0ad8c06336d4bfe53b5231fdb9164ae60 100644 index 37132a52849c7618fe863b6f5349ee6154cf42ad..7cf66e10efede0cb55239e1a1b3862d85a917f3e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -469,7 +469,7 @@ public class ServerPlayer extends Player { @@ -469,7 +469,7 @@ public class ServerPlayer extends Player {
@ -2201,7 +2201,7 @@ index f35bd06e3ae16922dfde76abda5b6f938f5b50f7..cb18d1a0ad8c06336d4bfe53b5231fdb
} }
} }
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 91fa10899f7f10dc056b4668c1f9758a8de09b9b..81303bc614b47fdd6db90ad1fbdaf9fed65b6cf3 100644 index 1f14b904807d4b593b608c8dc7a97bd8c320eceb..0da976438be3de7b82e8b1e3ce06d01c00dc33f0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -909,7 +909,7 @@ public abstract class PlayerList { @@ -909,7 +909,7 @@ public abstract class PlayerList {
@ -2214,7 +2214,7 @@ index 91fa10899f7f10dc056b4668c1f9758a8de09b9b..81303bc614b47fdd6db90ad1fbdaf9fe
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
} }
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9b9c09f57905d52721e9ab911dbb4df67d235ea7..e19204ff0d29d522ae653805429dc76f628f2ebc 100644 index 71ea121661874c11147bea0f9a4a147583f312fc..b6146726e767fa0401da3d7f5bbbf95b7c7a17d9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1217,9 +1217,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -1217,9 +1217,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -2440,7 +2440,7 @@ index 9b9c09f57905d52721e9ab911dbb4df67d235ea7..e19204ff0d29d522ae653805429dc76f
} }
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index d46b3b346540cc78cb93f3ce8bc8adc89b3d9b3d..ab708b256183fc54fe8e13f341d8a38acf611739 100644 index e29d1801f15c4c5680b683783e97a7aae3da753e..1e42372f038757b48990643aa2f118be415e0463 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -353,7 +353,7 @@ public class ArmorStand extends LivingEntity { @@ -353,7 +353,7 @@ public class ArmorStand extends LivingEntity {
@ -2600,7 +2600,7 @@ index a25497eec004add7408a63b1a0f09e3fa443b324..9f892de55ab03367daed4c30cc44c9dd
// Paper start // Paper start
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 fb86d06e8e420410e3cf9d918abd3369fa2f033e..0c2654986b9a5c7f210ba387851997ecec1ebb00 100644 index 2d2ef8455ea650baa1db74135c9321d97d10d12e..b023626467fc1f507d979653098bf30b18bd47c3 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
@@ -300,6 +300,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -300,6 +300,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -3018,7 +3018,7 @@ index af62781cc96354c87aa63d4f03f9e25b81959081..6c4fd56956982eee743b4dea4e8b9258
public boolean propagatesSkylightDown(BlockState state, BlockGetter world, BlockPos pos) { public boolean propagatesSkylightDown(BlockState state, BlockGetter world, BlockPos pos) {
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 fb46c66d916931fd80a99c59030ca05e12d29953..d91a82428a435a65bc55ad466ccebe91e0d905e0 100644 index 10e8532ed21895f98808c86fa2ae5a2e41d3965f..5b5a472e446e21f46e5f92c3e1fd79498a1aa4a6 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
@@ -882,6 +882,10 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -882,6 +882,10 @@ public abstract class BlockBehaviour implements FeatureElement {
@ -3126,7 +3126,7 @@ index fb46c66d916931fd80a99c59030ca05e12d29953..d91a82428a435a65bc55ad466ccebe91
public Block getBlock() { public Block getBlock() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java 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 12edaf88cca54540c617239ac31b2263dfa0ecd7..b39fea80fcb83873b7e7085eaaf935e712f0ede7 100644 index 4a781375a4a18011259edcb4e24550748a05dfa0..6d340a9b64ae900dfe84eeeaf7a39f7e7a139198 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -26,6 +26,22 @@ public class LevelChunkSection { @@ -26,6 +26,22 @@ public class LevelChunkSection {
@ -3185,10 +3185,10 @@ index 12edaf88cca54540c617239ac31b2263dfa0ecd7..b39fea80fcb83873b7e7085eaaf935e7
// Paper end // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 482616c7cbe12f7a23ec99378e24a87dedc2a8ae..441a6fc9d62e90bbd31569160c4f248c7d0b32de 100644 index a98ab20814cc29a25e9d29adfbb7e70d46768df2..6d8ff6c06af5545634f255ed17dc1e489ece2548 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -241,6 +241,17 @@ public abstract class FlowingFluid extends Fluid { @@ -240,6 +240,17 @@ public abstract class FlowingFluid extends Fluid {
} }
private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) { private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) {

View File

@ -10,7 +10,7 @@ when if this was fixed on the client, that wouldn't be needed.
Mojira Issue: https://bugs.mojang.com/browse/MC-235045 Mojira Issue: https://bugs.mojang.com/browse/MC-235045
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 79732086bc4cdbca8364d78eb60d68c758055966..e65d7980b7ebed60786bc31e2f8156fda3b59556 100644 index de7d11baf17d1b6c3d5fb3402d38052f3a28c246..21c9b903e26f93b8d4e97f3e0d98e3b2e45857f9 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -447,4 +447,20 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -447,4 +447,20 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@ -35,7 +35,7 @@ index 79732086bc4cdbca8364d78eb60d68c758055966..e65d7980b7ebed60786bc31e2f8156fd
+ // Paper end - tell clients to ask server for suggestions for EntityArguments + // Paper end - tell clients to ask server for suggestions for EntityArguments
} }
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 2bad211edde8b494cae726915a332217ae232855..cb1898f6daa79a0ac379a5caa7283a9155a70a15 100644 index e20f4e896b8c059b2d614e74d0c38e418936db6c..4cec7e5b1086064650af50cc9b89da274c74bfd0 100644
--- a/src/main/java/net/minecraft/commands/Commands.java --- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -532,6 +532,7 @@ public class Commands { @@ -532,6 +532,7 @@ public class Commands {
@ -45,7 +45,7 @@ index 2bad211edde8b494cae726915a332217ae232855..cb1898f6daa79a0ac379a5caa7283a91
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments + boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
while (iterator.hasNext()) { while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next(); CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
// Paper start // Paper start - Brigadier API
@@ -558,6 +559,12 @@ public class Commands { @@ -558,6 +559,12 @@ public class Commands {
if (requiredargumentbuilder.getSuggestionsProvider() != null) { if (requiredargumentbuilder.getSuggestionsProvider() != null) {

View File

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess. being ticked themselvess.
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 8f338bc3f6418eae5c25078d8938d449b1d688c6..9a1c27bc7bee1f915675b82717dd82f6dd0f3ee6 100644 index ffd0e4326c0c4ddd18b0f09f9f3037b1eefd546f..c3ce869eb8c53ba01f41840d050502ce94771253 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
@@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -28,7 +28,7 @@ index 8f338bc3f6418eae5c25078d8938d449b1d688c6..9a1c27bc7bee1f915675b82717dd82f6
// CraftBukkit start // CraftBukkit start
// Run tasks that are waiting on processing // Run tasks that are waiting on processing
@@ -1665,6 +1666,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1665,6 +1666,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end // Paper end - Perf: Optimize time updates
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
+ this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked + this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
@ -45,7 +45,7 @@ index 8f338bc3f6418eae5c25078d8938d449b1d688c6..9a1c27bc7bee1f915675b82717dd82f6
this.profiler.popPush("connection"); this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
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 aaa31bdb80754d100f4f751ad4a8b4f8957cbaa3..5327445d9cced0b4e3875587d747f4f6a6cfbb07 100644 index eff4f3100b018bc6475a9307bfe9853cd69abd2f..9c826cfb4f2e9336ae42d1b4ec1fbf2327021164 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
@@ -874,6 +874,11 @@ public final class CraftServer implements Server { @@ -874,6 +874,11 @@ public final class CraftServer implements Server {

View File

@ -7,7 +7,7 @@ Minecraft's prediction system does not handle block entities, so if we are manua
block breaking we need to set it after the prediction is finished. This fixes block entities not showing when cancelling the BlockBreakEvent. block breaking we need to set it after the prediction is finished. This fixes block entities not showing when cancelling the BlockBreakEvent.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 313c989a0148bbcbeb756f88c0480887ef91a5be..4b0c44dff5c532a5ed7304bf4438aec2d7959fdb 100644 index cfd09698025262f262489c4d024dc8b0013b542d..fc19c68c19d443be654a5600f633d3a77f7069c1 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -62,6 +62,8 @@ public class ServerPlayerGameMode { @@ -62,6 +62,8 @@ public class ServerPlayerGameMode {
@ -57,13 +57,13 @@ index 313c989a0148bbcbeb756f88c0480887ef91a5be..4b0c44dff5c532a5ed7304bf4438aec2
} }
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e610c0209c65a7f8c645f3a626c662a78bd7382c..1db6455f72ce9b91b04d0b5ba76d0a1d29b98110 100644 index 5fa21ba5d9d3dffe525d0f11486bf82b71629c8a..18b365a1809b56e2a061cf32a274e43f76d3e02d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1778,8 +1778,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1778,8 +1778,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return; return;
} }
// Paper end - Don't allow digging in unloaded chunks // Paper end - Don't allow digging into unloaded chunks
+ // Paper start - Send block entities after destroy prediction + // Paper start - Send block entities after destroy prediction
+ this.player.gameMode.capturedBlockEntity = false; + this.player.gameMode.capturedBlockEntity = false;
+ this.player.gameMode.captureSentBlockEntities = true; + this.player.gameMode.captureSentBlockEntities = true;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerFailMoveEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5d1a1b2abc62f15251d954e90e8e51dac184e8dd..894eec92eaa993c0cb5335f780195e204a64ef2d 100644 index 6db3b1258ce197e7d65ca8681464961635e72310..48016464d51f7f7322c1394b4e93693f798af7e6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1313,8 +1313,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1313,8 +1313,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -34,7 +34,7 @@ index 5d1a1b2abc62f15251d954e90e8e51dac184e8dd..894eec92eaa993c0cb5335f780195e20
+ } + }
+ // Paper end - Add fail move event + // Paper end - Add fail move event
} }
// Paper end // Paper end - Prevent moving into unloaded chunks
@@ -1389,9 +1395,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1389,9 +1395,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Deep clone unhandled nbt tags
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b7c0c9a40dac3e828f880ef928ca34206a898cb9..2a79d94abf911c9c973e84f81283e8e64fbef2b8 100644 index 8af7ef1c12a7826e607b15f1376311e9d38e7f31..4e7f5bfcdb8af7a9237dee3c8ebf9cde6f1248a4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@ -20,7 +20,7 @@ index b7c0c9a40dac3e828f880ef928ca34206a898cb9..2a79d94abf911c9c973e84f81283e8e6
@@ -346,8 +346,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -346,8 +346,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys); this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
} }
// Paper end // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
- this.unhandledTags.putAll(meta.unhandledTags); - this.unhandledTags.putAll(meta.unhandledTags);
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw()); - this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
+ // Paper start - Deep clone unhandled nbt tags + // Paper start - Deep clone unhandled nbt tags