[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-18 22:00:40 +01:00
parent f61ebdce91
commit 106c67a811
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
338 changed files with 379 additions and 384 deletions

View File

@ -585,6 +585,47 @@ index fa0bf7db880063427ba12df1df1c72240fff93e9..63e6b07e3b159c74d9ef17be20b5ab43
public CraftCod(CraftServer server, net.minecraft.world.entity.animal.Cod entity) { public CraftCod(CraftServer server, net.minecraft.world.entity.animal.Cod entity) {
super(server, entity); super(server, entity);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
index af432f9a1d255a56c31c3b97aeb4457d17f37e3e..f93f8f6509b12eb9b1e07c829278bb0822dd7988 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
@@ -18,4 +18,36 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin {
public String toString() {
return "CraftDolphin";
}
+
+ // Paper start - Missing Dolphin API
+ @Override
+ public int getMoistness() {
+ return this.getHandle().getMoistnessLevel();
+ }
+
+ @Override
+ public void setMoistness(int moistness) {
+ this.getHandle().setMoisntessLevel(moistness);
+ }
+
+ @Override
+ public void setHasFish(boolean hasFish) {
+ this.getHandle().setGotFish(hasFish);
+ }
+
+ @Override
+ public boolean hasFish() {
+ return this.getHandle().gotFish();
+ }
+
+ @Override
+ public org.bukkit.Location getTreasureLocation() {
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos());
+ }
+
+ @Override
+ public void setTreasureLocation(org.bukkit.Location location) {
+ this.getHandle().setTreasurePos(io.papermc.paper.util.MCUtil.toBlockPosition(location));
+ }
+ // Paper end - Missing Dolphin API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
index 21dc209e6f98b6306833b41e2763e746047d5a94..983b9d6ddb58eff297e96e5c8b28ec427efa267d 100644 index 21dc209e6f98b6306833b41e2763e746047d5a94..983b9d6ddb58eff297e96e5c8b28ec427efa267d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build Fixes warnings on build
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 7be16ce8c8582d8587c4d1cb4c099fa6fe5f1324..22dfe70df68b35e313f94b17a87e4121392b17b4 100644 index 7be16ce8c8582d8587c4d1cb4c099fa6fe5f1324..646afa849148cdd5bc9812a1ebd9cb5d15c39311 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
@@ -955,17 +955,7 @@ public class Util { @@ -955,17 +955,7 @@ public class Util {
@ -25,7 +25,7 @@ index 7be16ce8c8582d8587c4d1cb4c099fa6fe5f1324..22dfe70df68b35e313f94b17a87e4121
- Util.LOGGER.error("Couldn't open url '{}'", url, var3); - Util.LOGGER.error("Couldn't open url '{}'", url, var3);
- } - }
- -
+ throw new IllegalStateException("This method is not useful on dedicated servers."); // Paper + throw new IllegalStateException("This method is not useful on dedicated servers."); // Paper - Fix warnings on build by removing client-only code
} }
public void openUri(URI uri) { public void openUri(URI uri) {

View File

@ -7,14 +7,14 @@ Subject: [PATCH] Fix removing recipes from RecipeIterator
public net.minecraft.world.item.crafting.RecipeManager byName public net.minecraft.world.item.crafting.RecipeManager byName
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
index 65b12eaab871019def074bf17257772ff7f09806..692d9abd715988c96934888b492b93efa64ecce4 100644 index 65b12eaab871019def074bf17257772ff7f09806..5217e9f7e78e5d4d5751bba51554ff46666b77dd 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
@@ -13,6 +13,7 @@ import org.bukkit.inventory.Recipe; @@ -13,6 +13,7 @@ import org.bukkit.inventory.Recipe;
public class RecipeIterator implements Iterator<Recipe> { public class RecipeIterator implements Iterator<Recipe> {
private final Iterator<Map.Entry<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, RecipeHolder<?>>>> recipes; private final Iterator<Map.Entry<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, RecipeHolder<?>>>> recipes;
private Iterator<RecipeHolder<?>> current; private Iterator<RecipeHolder<?>> current;
+ private Recipe currentRecipe; // Paper - fix removing recipes + private Recipe currentRecipe; // Paper - fix removing recipes from RecipeIterator
public RecipeIterator() { public RecipeIterator() {
this.recipes = MinecraftServer.getServer().getRecipeManager().recipes.entrySet().iterator(); this.recipes = MinecraftServer.getServer().getRecipeManager().recipes.entrySet().iterator();
@ -23,28 +23,28 @@ index 65b12eaab871019def074bf17257772ff7f09806..692d9abd715988c96934888b492b93ef
if (this.current == null || !this.current.hasNext()) { if (this.current == null || !this.current.hasNext()) {
this.current = this.recipes.next().getValue().values().iterator(); this.current = this.recipes.next().getValue().values().iterator();
- return this.next(); - return this.next();
+ // Paper start - fix removing recipes + // Paper start - fix removing recipes from RecipeIterator
+ this.currentRecipe = this.next(); + this.currentRecipe = this.next();
+ return this.currentRecipe; + return this.currentRecipe;
+ // Paper end + // Paper end - fix removing recipes from RecipeIterator
} }
- return this.current.next().toBukkitRecipe(); - return this.current.next().toBukkitRecipe();
+ // Paper start - fix removing recipes + // Paper start - fix removing recipes from RecipeIterator
+ this.currentRecipe = this.current.next().toBukkitRecipe(); + this.currentRecipe = this.current.next().toBukkitRecipe();
+ return this.currentRecipe; + return this.currentRecipe;
+ // Paper end + // Paper end - fix removing recipes from RecipeIterator
} }
@Override @Override
public void remove() { public void remove() {
Preconditions.checkState(this.current != null, "next() not yet called"); Preconditions.checkState(this.current != null, "next() not yet called");
+ +
+ // Paper start - fix removing recipes + // Paper start - fix removing recipes from RecipeIterator
+ if (this.currentRecipe instanceof org.bukkit.Keyed keyed) { + if (this.currentRecipe instanceof org.bukkit.Keyed keyed) {
+ MinecraftServer.getServer().getRecipeManager().byName.remove(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(keyed.getKey())); + MinecraftServer.getServer().getRecipeManager().byName.remove(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(keyed.getKey()));
+ } + }
+ // Paper end + // Paper end - fix removing recipes from RecipeIterator
this.current.remove(); this.current.remove();
} }
} }

View File

@ -18,7 +18,7 @@ index f9e15908143f4453c2a5817b412e8a13554553f0..06498788c169133bd563c5a87192b718
@Override @Override
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index e0802f1cb73a80b08482832c2b269ac8485d5c1a..8d2870c780c4c253f6570c7ef73f6e7c2ccc46ad 100644 index e0802f1cb73a80b08482832c2b269ac8485d5c1a..945a0317e9e49a159a1f42882a0a267a2141e86d 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -335,7 +335,10 @@ public class ServerEntity { @@ -335,7 +335,10 @@ public class ServerEntity {
@ -29,12 +29,12 @@ index e0802f1cb73a80b08482832c2b269ac8485d5c1a..8d2870c780c4c253f6570c7ef73f6e7c
+ // Paper start - prevent oversized data + // Paper start - prevent oversized data
+ final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false); + final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
+ list.add(Pair.of(enumitemslot, sanitized)); + list.add(Pair.of(enumitemslot, sanitized));
+ // Paper end + // Paper end - prevent oversized data
} }
} }
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 ffc999a3a398bc73fffa7a68805baa1da7504750..3de3e938195c79c65b7e11438ca92585aaccf529 100644 index ffc999a3a398bc73fffa7a68805baa1da7504750..d1210e8cd501f0f3be92189d129f1d354ddb00cb 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
@@ -3188,7 +3188,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3188,7 +3188,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -45,7 +45,7 @@ index ffc999a3a398bc73fffa7a68805baa1da7504750..3de3e938195c79c65b7e11438ca92585
+ // Paper start - prevent oversized data + // Paper start - prevent oversized data
+ ItemStack toSend = sanitizeItemStack(itemstack1, true); + ItemStack toSend = sanitizeItemStack(itemstack1, true);
+ list.add(Pair.of(enumitemslot, toSend)); + list.add(Pair.of(enumitemslot, toSend));
+ // Paper end + // Paper end - prevent oversized data
switch (enumitemslot.getType()) { switch (enumitemslot.getType()) {
case HAND: case HAND:
this.setLastHandItem(enumitemslot, itemstack1); this.setLastHandItem(enumitemslot, itemstack1);
@ -79,7 +79,7 @@ index ffc999a3a398bc73fffa7a68805baa1da7504750..3de3e938195c79c65b7e11438ca92585
+ } + }
+ return copy; + return copy;
+ } + }
+ // Paper end + // Paper end - prevent oversized data
+ +
private ItemStack getLastArmorItem(EquipmentSlot slot) { private ItemStack getLastArmorItem(EquipmentSlot slot) {
return (ItemStack) this.lastArmorItemStacks.get(slot.getIndex()); return (ItemStack) this.lastArmorItemStacks.get(slot.getIndex());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Hide unnecessary itemmeta from clients
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 8d2870c780c4c253f6570c7ef73f6e7c2ccc46ad..0cbb5dd17c5b37ad90ce11a31b64470722026d06 100644 index 945a0317e9e49a159a1f42882a0a267a2141e86d..e9fd9590e90e58fd4c31985a704a4511b2663096 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -337,7 +337,7 @@ public class ServerEntity { @@ -337,7 +337,7 @@ public class ServerEntity {
@ -13,12 +13,12 @@ index 8d2870c780c4c253f6570c7ef73f6e7c2ccc46ad..0cbb5dd17c5b37ad90ce11a31b644707
// Paper start - prevent oversized data // Paper start - prevent oversized data
final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false); final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
- list.add(Pair.of(enumitemslot, sanitized)); - list.add(Pair.of(enumitemslot, sanitized));
+ list.add(Pair.of(enumitemslot, ((LivingEntity) this.entity).stripMeta(sanitized, false))); // Paper - remove unnecessary item meta + list.add(Pair.of(enumitemslot, ((LivingEntity) this.entity).stripMeta(sanitized, false))); // Paper - Hide unnecessary item meta
// Paper end // Paper end - prevent oversized data
} }
} }
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 648530ce3183362ed71cbd2de534471da65ab787..1e519cdd673a4d4beb53ae84822e7b85c25a5e97 100644 index 648530ce3183362ed71cbd2de534471da65ab787..bfbbb0f6e73e9d59e73944b77e08802132f2a739 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
@@ -2566,8 +2566,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2566,8 +2566,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -27,13 +27,13 @@ index 648530ce3183362ed71cbd2de534471da65ab787..1e519cdd673a4d4beb53ae84822e7b85
// SPIGOT-7136 - Allays // SPIGOT-7136 - Allays
- if (entity instanceof Allay) { - if (entity instanceof Allay) {
- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList()))); - ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
+ if (entity instanceof Allay allay) { // Paper + if (entity instanceof Allay allay) { // Paper - Hide unnecessary item meta
+ ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, allay.stripMeta(allay.getItemBySlot(slot), true))).collect(Collectors.toList()))); // Paper - remove unnecessary item meta + ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, allay.stripMeta(allay.getItemBySlot(slot), true))).collect(Collectors.toList()))); // Paper - Hide unnecessary item meta
ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote();
} }
} }
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 3de3e938195c79c65b7e11438ca92585aaccf529..cf91a4b9d2aab2ed32d7d53e5d3bd97838b7a8a4 100644 index d1210e8cd501f0f3be92189d129f1d354ddb00cb..1a16dc3ac00c2756f1ea7154c38345393f3d5a96 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
@@ -3190,7 +3190,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3190,7 +3190,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -41,15 +41,15 @@ index 3de3e938195c79c65b7e11438ca92585aaccf529..cf91a4b9d2aab2ed32d7d53e5d3bd978
// Paper start - prevent oversized data // Paper start - prevent oversized data
ItemStack toSend = sanitizeItemStack(itemstack1, true); ItemStack toSend = sanitizeItemStack(itemstack1, true);
- list.add(Pair.of(enumitemslot, toSend)); - list.add(Pair.of(enumitemslot, toSend));
+ list.add(Pair.of(enumitemslot, stripMeta(toSend, toSend == itemstack1))); // Paper - hide unnecessary item meta + list.add(Pair.of(enumitemslot, stripMeta(toSend, toSend == itemstack1))); // Paper - Hide unnecessary item meta
// Paper end // Paper end - prevent oversized data
switch (enumitemslot.getType()) { switch (enumitemslot.getType()) {
case HAND: case HAND:
@@ -3204,6 +3204,77 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3204,6 +3204,77 @@ public abstract class LivingEntity extends Entity implements Attackable {
((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list)); ((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
} }
+ // Paper start - hide unnecessary item meta + // Paper start - Hide unnecessary item meta
+ public ItemStack stripMeta(final ItemStack itemStack, final boolean copyItemStack) { + public ItemStack stripMeta(final ItemStack itemStack, final boolean copyItemStack) {
+ if (itemStack.isEmpty() || (!itemStack.hasTag() && itemStack.getCount() < 2)) { + if (itemStack.isEmpty() || (!itemStack.hasTag() && itemStack.getCount() < 2)) {
+ return itemStack; + return itemStack;
@ -118,7 +118,7 @@ index 3de3e938195c79c65b7e11438ca92585aaccf529..cf91a4b9d2aab2ed32d7d53e5d3bd978
+ +
+ return copy; + return copy;
+ } + }
+ // Paper end + // Paper end - Hide unnecessary item meta
+ +
// Paper start - prevent oversized data // Paper start - prevent oversized data
public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) { public static ItemStack sanitizeItemStack(final ItemStack itemStack, final boolean copyItemStack) {

View File

@ -13,45 +13,46 @@ Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
index 95f897b9ef73c880aff1cfe35fe490683badfd44..54916c80720f219bf747250a2ff9a875f180c7a2 100644 index 95f897b9ef73c880aff1cfe35fe490683badfd44..788d8a04398482fdfd0fe89e519b2a6c57410ec3 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java --- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -51,9 +51,17 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl @@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
return to.setValue(BERRIES, from.getValue(BERRIES)); return to.setValue(BERRIES, from.getValue(BERRIES));
} }
+ // Paper start - Fix Spigot growth modifiers
+ @Override + @Override
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) { + protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F); + final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);
+ return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value); + return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value);
+ } + }
+ // Paper end + // Paper end - Fix Spigot growth modifiers
+ +
@Override @Override
protected BlockState getGrowIntoState(BlockState state, RandomSource random) { protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
- return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F)); - return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F));
+ // Paper start + // Paper start - Fix Spigot growth modifiers
+ return this.getGrowIntoState(state, random, null); + return this.getGrowIntoState(state, random, null);
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 76c12b34aac276fc9375135dac1c2018fdd7d756..9550ce8588c6aa3ba4cbbbb86912eae2b452eb01 100644 index 76c12b34aac276fc9375135dac1c2018fdd7d756..a0b48e5270e2523fa7c7237d5cfef5a13a45a430 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java --- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -91,6 +91,10 @@ public class CropBlock extends BushBlock implements BonemealableBlock { @@ -91,6 +91,10 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
modifier = world.spigotConfig.carrotModifier; modifier = world.spigotConfig.carrotModifier;
} else if (this == Blocks.POTATOES) { } else if (this == Blocks.POTATOES) {
modifier = world.spigotConfig.potatoModifier; modifier = world.spigotConfig.potatoModifier;
+ // Paper start + // Paper start - Fix Spigot growth modifiers
+ } else if (this == Blocks.TORCHFLOWER_CROP) { + } else if (this == Blocks.TORCHFLOWER_CROP) {
+ modifier = world.spigotConfig.torchFlowerModifier; + modifier = world.spigotConfig.torchFlowerModifier;
+ // Paper end + // Paper end - Fix Spigot growth modifiers
} else { } else {
modifier = world.spigotConfig.wheatModifier; modifier = world.spigotConfig.wheatModifier;
} }
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
index b74e61064926a7c7fb03286651ea52c150f86107..4ebdc4918131a15a1c91b45e8ceb1392bca20a81 100644 index b74e61064926a7c7fb03286651ea52c150f86107..30300ef3ec839dfa944c992ab50db4d3859bb02e 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java --- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java +++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -60,12 +60,18 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements @@ -60,12 +60,18 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@ -59,23 +60,23 @@ index b74e61064926a7c7fb03286651ea52c150f86107..4ebdc4918131a15a1c91b45e8ceb1392
if (this.canGrowInto(world.getBlockState(blockposition1))) { if (this.canGrowInto(world.getBlockState(blockposition1))) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random)); // CraftBukkit - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random)); // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper - Fix Spigot growth modifiers
} }
} }
} }
+ // Paper start + // Paper start - Fix Spigot growth modifiers
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) { + protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ return this.getGrowIntoState(state, random); + return this.getGrowIntoState(state, random);
+ } + }
+ // Paper end + // Paper end - Fix Spigot growth modifiers
+ +
protected BlockState getGrowIntoState(BlockState state, RandomSource random) { protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
index 3c0b0732cdea6c98c58c9639be3a6971575df85b..7ee8832820dd3f0c97fc68cab40d23f58ed21c31 100644 index 3c0b0732cdea6c98c58c9639be3a6971575df85b..d5257272ac8b0cf36e9f92e32a4a4ae6782f770c 100644
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java --- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java +++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
@@ -100,7 +100,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl @@ -100,7 +100,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
@ -83,12 +84,12 @@ index 3c0b0732cdea6c98c58c9639be3a6971575df85b..7ee8832820dd3f0c97fc68cab40d23f5
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (!isHanging(state)) { if (!isHanging(state)) {
- if (random.nextInt(7) == 0) { - if (random.nextInt(7) == 0) {
+ if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper + if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper - Fix Spigot growth modifiers
this.advanceTree(world, pos, state, random); this.advanceTree(world, pos, state, random);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
index c80a3ee02f3af146926a3611779fd0af298a8ac1..ba94ff948ccaddc16d3452306722759c115bb90a 100644 index c80a3ee02f3af146926a3611779fd0af298a8ac1..73d9ad9e24727a81c5ff1645316aee003600c0cc 100644
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
@@ -119,7 +119,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @@ -119,7 +119,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@ -96,7 +97,7 @@ index c80a3ee02f3af146926a3611779fd0af298a8ac1..ba94ff948ccaddc16d3452306722759c
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
float f = CropBlock.getGrowthSpeed(this, world, pos); float f = CropBlock.getGrowthSpeed(this, world, pos);
- boolean bl = random.nextInt((int)(25.0F / f) + 1) == 0; - boolean bl = random.nextInt((int)(25.0F / f) + 1) == 0;
+ boolean bl = random.nextFloat() < (world.spigotConfig.pitcherPlantModifier / (100.0F * (Math.floor(25.0F / f) + 1))); // Paper + boolean bl = random.nextFloat() < (world.spigotConfig.pitcherPlantModifier / (100.0F * (Math.floor(25.0F / f) + 1))); // Paper - Fix Spigot growth modifiers
if (bl) { if (bl) {
this.grow(world, state, pos, 1); this.grow(world, state, pos, 1);
} }

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Prevent ContainerOpenersCounter openCount from going negative
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
index ba06184bad7e8ae55cb2d55f6196e8f990d2811d..3e4b3eecc788c564f81b7929bfab7d2fdb6e307d 100644 index ba06184bad7e8ae55cb2d55f6196e8f990d2811d..7eccacb978f047a4774e58b11bc3f9ab3959b049 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java --- a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
@@ -64,6 +64,7 @@ public abstract class ContainerOpenersCounter { @@ -64,6 +64,7 @@ public abstract class ContainerOpenersCounter {
public void decrementOpeners(Player player, Level world, BlockPos pos, BlockState state) { public void decrementOpeners(Player player, Level world, BlockPos pos, BlockState state) {
int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added
+ if (this.openCount == 0) return; // Paper + if (this.openCount == 0) return; // Paper - Prevent ContainerOpenersCounter openCount from going negative
int i = this.openCount--; int i = this.openCount--;
// CraftBukkit start - Call redstone event // CraftBukkit start - Call redstone event

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Add PlayerItemFrameChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index 8289ea080aa297f75cdbc8d591d6efa6a0def0ea..63ef00eb6f93a471de1e9c2355099d9dd3a71dd9 100644 index 8289ea080aa297f75cdbc8d591d6efa6a0def0ea..3ff1ae5ae705cd8d5c8529e1dcdd5ccaed908830 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -3,6 +3,7 @@ package net.minecraft.world.entity.decoration; @@ -3,6 +3,7 @@ package net.minecraft.world.entity.decoration;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;
import java.util.OptionalInt; import java.util.OptionalInt;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper +import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper - Add PlayerItemFrameChangeEvent
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -20,13 +20,13 @@ index 8289ea080aa297f75cdbc8d591d6efa6a0def0ea..63ef00eb6f93a471de1e9c2355099d9d
return true; return true;
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start - call PlayerItemFrameChangeEvent + // Paper start - Add PlayerItemFrameChangeEvent
+ if (source.getEntity() instanceof Player player) { + if (source.getEntity() instanceof Player player) {
+ var event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.REMOVE); + var event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.REMOVE);
+ if (!event.callEvent()) return true; // return true here because you aren't cancelling the damage, just the change + if (!event.callEvent()) return true; // return true here because you aren't cancelling the damage, just the change
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false); + this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false);
+ } + }
+ // Paper end + // Paper end - Add PlayerItemFrameChangeEvent
this.dropItem(source.getEntity(), false); this.dropItem(source.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity()); this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F); this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@ -35,26 +35,26 @@ index 8289ea080aa297f75cdbc8d591d6efa6a0def0ea..63ef00eb6f93a471de1e9c2355099d9d
} }
- this.setItem(itemstack); - this.setItem(itemstack);
+ // Paper start - call PlayerItemFrameChangeEvent + // Paper start - Add PlayerItemFrameChangeEvent
+ PlayerItemFrameChangeEvent event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), itemstack.asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.PLACE); + PlayerItemFrameChangeEvent event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), itemstack.asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.PLACE);
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return InteractionResult.FAIL; + return InteractionResult.FAIL;
+ } + }
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack())); + this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
+ // Paper end + // Paper end - Add PlayerItemFrameChangeEvent
this.gameEvent(GameEvent.BLOCK_CHANGE, player); this.gameEvent(GameEvent.BLOCK_CHANGE, player);
if (!player.getAbilities().instabuild) { if (!player.getAbilities().instabuild) {
itemstack.shrink(1); itemstack.shrink(1);
} }
} }
} else { } else {
+ // Paper start - call PlayerItemFrameChangeEvent + // Paper start - Add PlayerItemFrameChangeEvent
+ PlayerItemFrameChangeEvent event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.ROTATE); + PlayerItemFrameChangeEvent event = new PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), PlayerItemFrameChangeEvent.ItemFrameChangeAction.ROTATE);
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return InteractionResult.FAIL; + return InteractionResult.FAIL;
+ } + }
+ setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false, false); + setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false, false);
+ // Paper end + // Paper end - Add PlayerItemFrameChangeEvent
this.playSound(this.getRotateItemSound(), 1.0F, 1.0F); this.playSound(this.getRotateItemSound(), 1.0F, 1.0F);
this.setRotation(this.getRotation() + 1); this.setRotation(this.getRotation() + 1);
this.gameEvent(GameEvent.BLOCK_CHANGE, player); this.gameEvent(GameEvent.BLOCK_CHANGE, player);

View File

@ -24,7 +24,7 @@ to corrupted data. This is also something that Anti-Xray is currently
relying on. relying on.
diff --git a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java diff --git a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java
index 26e093243c70313b777483d9555fb1557443c9b8..7b7b614e5c3a30be89eeea2d25112fc9bcb3052c 100644 index 26e093243c70313b777483d9555fb1557443c9b8..92c360f02ef6be77c6c8eee3226947468194ec23 100644
--- a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java --- a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java
+++ b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java +++ b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java
@@ -20,7 +20,7 @@ public class HashMapPalette<T> implements Palette<T> { @@ -20,7 +20,7 @@ public class HashMapPalette<T> implements Palette<T> {
@ -32,7 +32,7 @@ index 26e093243c70313b777483d9555fb1557443c9b8..7b7b614e5c3a30be89eeea2d25112fc9
public HashMapPalette(IdMap<T> idList, int indexBits, PaletteResize<T> listener) { public HashMapPalette(IdMap<T> idList, int indexBits, PaletteResize<T> listener) {
- this(idList, indexBits, listener, CrudeIncrementalIntIdentityHashBiMap.create(1 << indexBits)); - this(idList, indexBits, listener, CrudeIncrementalIntIdentityHashBiMap.create(1 << indexBits));
+ this(idList, indexBits, listener, CrudeIncrementalIntIdentityHashBiMap.create((1 << indexBits) + 1)); // Paper - Avoid unnecessary resize operation in CrudeIncrementalIntIdentityHashBiMap + this(idList, indexBits, listener, CrudeIncrementalIntIdentityHashBiMap.create((1 << indexBits) + 1)); // Paper - Perf: Avoid unnecessary resize operation in CrudeIncrementalIntIdentityHashBiMap
} }
private HashMapPalette(IdMap<T> idList, int indexBits, PaletteResize<T> listener, CrudeIncrementalIntIdentityHashBiMap<T> map) { private HashMapPalette(IdMap<T> idList, int indexBits, PaletteResize<T> listener, CrudeIncrementalIntIdentityHashBiMap<T> map) {
@ -42,7 +42,7 @@ index 26e093243c70313b777483d9555fb1557443c9b8..7b7b614e5c3a30be89eeea2d25112fc9
if (i == -1) { if (i == -1) {
- i = this.values.add(object); - i = this.values.add(object);
- if (i >= 1 << this.bits) { - if (i >= 1 << this.bits) {
+ // Paper start - Avoid unnecessary resize operation in CrudeIncrementalIntIdentityHashBiMap and optimize + // Paper start - Perf: Avoid unnecessary resize operation in CrudeIncrementalIntIdentityHashBiMap and optimize
+ // We use size() instead of the result from add(K) + // We use size() instead of the result from add(K)
+ // This avoids adding another object unnecessarily + // This avoids adding another object unnecessarily
+ // Without this change, + 2 would be required in the constructor + // Without this change, + 2 would be required in the constructor
@ -51,7 +51,7 @@ index 26e093243c70313b777483d9555fb1557443c9b8..7b7b614e5c3a30be89eeea2d25112fc9
+ } else { + } else {
+ i = this.values.add(object); + i = this.values.add(object);
} }
+ // Paper end + // Paper end - Perf: Avoid unnecessary resize operation in CrudeIncrementalIntIdentityHashBiMap and optimize
} }
return i; return i;

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
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 8f61efe32500ebe47e13d96fd96df646adb3dd5b..36a620d44140edac72e20b83a2cee2860e09deec 100644 index 8f61efe32500ebe47e13d96fd96df646adb3dd5b..9f9492f0f5bc9c39f4c0021956e3240a466f3085 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
@@ -2459,6 +2459,88 @@ public final class CraftServer implements Server { @@ -2459,6 +2459,88 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME), world); // Paper - Anti-Xray - Add parameters return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME), world); // Paper - Anti-Xray - Add parameters
} }
+ // Paper start + // Paper start - Allow delegation to vanilla chunk gen
+ private static final List<net.minecraft.world.level.chunk.ChunkStatus> VANILLA_GEN_STATUSES = List.of( + private static final List<net.minecraft.world.level.chunk.ChunkStatus> VANILLA_GEN_STATUSES = List.of(
+ net.minecraft.world.level.chunk.ChunkStatus.EMPTY, + net.minecraft.world.level.chunk.ChunkStatus.EMPTY,
+ net.minecraft.world.level.chunk.ChunkStatus.STRUCTURE_STARTS, + net.minecraft.world.level.chunk.ChunkStatus.STRUCTURE_STARTS,
@ -92,13 +92,13 @@ index 8f61efe32500ebe47e13d96fd96df646adb3dd5b..36a620d44140edac72e20b83a2cee286
+ // hooray! + // hooray!
+ return data; + return data;
+ } + }
+ // Paper end + // Paper end - Allow delegation to vanilla chunk gen
+ +
@Override @Override
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) { public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
return new CraftBossBar(title, color, style, flags); return new CraftBossBar(title, color, style, flags);
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
index 03eb35d5c67f125c44cf46595c93d124ac7892b8..f9f5fd5087a2e335384aa18b226b1f8d8a6748ee 100644 index 03eb35d5c67f125c44cf46595c93d124ac7892b8..44a010590e830fd238cf6fdda443e28b72022e66 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java --- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
@@ -23,7 +23,7 @@ import org.bukkit.material.MaterialData; @@ -23,7 +23,7 @@ import org.bukkit.material.MaterialData;
@ -106,7 +106,7 @@ index 03eb35d5c67f125c44cf46595c93d124ac7892b8..f9f5fd5087a2e335384aa18b226b1f8d
private final int minHeight; private final int minHeight;
private final int maxHeight; private final int maxHeight;
- private final LevelChunkSection[] sections; - private final LevelChunkSection[] sections;
+ private LevelChunkSection[] sections; // Paper + private LevelChunkSection[] sections; // Paper - Allow delegation to vanilla chunk gen
private final Registry<net.minecraft.world.level.biome.Biome> biomes; private final Registry<net.minecraft.world.level.biome.Biome> biomes;
private Set<BlockPos> tiles; private Set<BlockPos> tiles;
private final Set<BlockPos> lights = new HashSet<>(); private final Set<BlockPos> lights = new HashSet<>();
@ -115,13 +115,13 @@ index 03eb35d5c67f125c44cf46595c93d124ac7892b8..f9f5fd5087a2e335384aa18b226b1f8d
} }
- Set<BlockPos> getLights() { - Set<BlockPos> getLights() {
+ public Set<BlockPos> getLights() { // Paper + public Set<BlockPos> getLights() { // Paper - Allow delegation to vanilla chunk gen
return this.lights; return this.lights;
} }
+ +
+ // Paper start + // Paper start - Allow delegation to vanilla chunk gen
+ public void setRawChunkData(LevelChunkSection[] sections) { + public void setRawChunkData(LevelChunkSection[] sections) {
+ this.sections = sections; + this.sections = sections;
+ } + }
+ // Paper end + // Paper end - Allow delegation to vanilla chunk gen
} }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) and optimize
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 6dc7e23e96aaffb912611a9dbd41459cb8489056..b6716f2b0037d12fb9956d7d1d0fab9b86cf4433 100644 index 6dc7e23e96aaffb912611a9dbd41459cb8489056..fd702027e62eb38d51fb7c46ef268e9bb94e1e92 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -291,13 +291,17 @@ public class CraftChunk implements Chunk { @@ -291,13 +291,17 @@ public class CraftChunk implements Chunk {
@ -20,14 +20,14 @@ index 6dc7e23e96aaffb912611a9dbd41459cb8489056..b6716f2b0037d12fb9956d7d1d0fab9b
- data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).get().left().get()); - data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).get().left().get());
- sectionBlockIDs[i] = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).get().left().get(); - sectionBlockIDs[i] = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).get().left().get();
+ // Paper start + // Paper start - Fix ChunkSnapshot#isSectionEmpty(int); and remove codec usage
+ sectionEmpty[i] = cs[i].hasOnlyAir(); // Paper - fix sectionEmpty array not being filled + sectionEmpty[i] = cs[i].hasOnlyAir(); // fix sectionEmpty array not being filled
+ if (!sectionEmpty[i]) { + if (!sectionEmpty[i]) {
+ sectionBlockIDs[i] = cs[i].getStates().copy(); // Paper - use copy instead of round tripping with codecs + sectionBlockIDs[i] = cs[i].getStates().copy(); // use copy instead of round tripping with codecs
+ } else { + } else {
+ sectionBlockIDs[i] = CraftChunk.emptyBlockIDs; // Paper - use cached instance for empty block sections + sectionBlockIDs[i] = CraftChunk.emptyBlockIDs; // use cached instance for empty block sections
+ } + }
+ // Paper end + // Paper end - Fix ChunkSnapshot#isSectionEmpty(int)
LevelLightEngine lightengine = this.worldServer.getLightEngine(); LevelLightEngine lightengine = this.worldServer.getLightEngine();
DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(this.x, chunk.getSectionYFromSectionIndex(i), this.z)); // SPIGOT-7498: Convert section index DataLayer skyLightArray = lightengine.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(this.x, chunk.getSectionYFromSectionIndex(i), this.z)); // SPIGOT-7498: Convert section index
@ -37,7 +37,7 @@ index 6dc7e23e96aaffb912611a9dbd41459cb8489056..b6716f2b0037d12fb9956d7d1d0fab9b
if (biome != null) { if (biome != null) {
- data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get()); - data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).get().left().get());
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get(); - biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).get().left().get();
+ biome[i] = ((PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>>) cs[i].getBiomes()).copy(); // Paper - use copy instead of round tripping with codecs + biome[i] = ((PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>>) cs[i].getBiomes()).copy(); // Paper - Perf: use copy instead of round tripping with codecs
} }
} }

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Add more Campfire API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17fff178a1d 100644 index f776289eea00bd741ad55bb9bc338dd2c05c8b39..423550424e82ed74e0b38cbafd89649539cc1012 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
public final int[] cookingProgress; public final int[] cookingProgress;
public final int[] cookingTime; public final int[] cookingTime;
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck; private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck;
+ public final boolean[] stopCooking; // Paper + public final boolean[] stopCooking; // Paper - Add more Campfire API
public CampfireBlockEntity(BlockPos pos, BlockState state) { public CampfireBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.CAMPFIRE, pos, state); super(BlockEntityType.CAMPFIRE, pos, state);
@ -20,7 +20,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17f
this.cookingProgress = new int[4]; this.cookingProgress = new int[4];
this.cookingTime = new int[4]; this.cookingTime = new int[4];
this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING); this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
+ this.stopCooking = new boolean[4]; // Paper + this.stopCooking = new boolean[4]; // Paper - Add more Campfire API
} }
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) { public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
@ -28,9 +28,9 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17f
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
flag = true; flag = true;
+ if (!campfire.stopCooking[i]) { // Paper + if (!campfire.stopCooking[i]) { // Paper - Add more Campfire API
int j = campfire.cookingProgress[i]++; int j = campfire.cookingProgress[i]++;
+ } // Paper + } // Paper - Add more Campfire API
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@ -38,7 +38,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17f
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length)); System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
} }
+ // Paper start + // Paper start - Add more Campfire API
+ if (nbt.contains("Paper.StopCooking", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_BYTE_ARRAY)) { + if (nbt.contains("Paper.StopCooking", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_BYTE_ARRAY)) {
+ byte[] abyte = nbt.getByteArray("Paper.StopCooking"); + byte[] abyte = nbt.getByteArray("Paper.StopCooking");
+ boolean[] cookingState = new boolean[4]; + boolean[] cookingState = new boolean[4];
@ -47,7 +47,7 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17f
+ } + }
+ System.arraycopy(cookingState, 0, this.stopCooking, 0, Math.min(this.stopCooking.length, abyte.length)); + System.arraycopy(cookingState, 0, this.stopCooking, 0, Math.min(this.stopCooking.length, abyte.length));
+ } + }
+ // Paper end + // Paper end - Add more Campfire API
} }
@Override @Override
@ -55,13 +55,13 @@ index f776289eea00bd741ad55bb9bc338dd2c05c8b39..18d3cb828f85e17ec27dbb5b33c6f17f
ContainerHelper.saveAllItems(nbt, this.items, true); ContainerHelper.saveAllItems(nbt, this.items, true);
nbt.putIntArray("CookingTimes", this.cookingProgress); nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime); nbt.putIntArray("CookingTotalTimes", this.cookingTime);
+ // Paper start + // Paper start - Add more Campfire API
+ byte[] cookingState = new byte[4]; + byte[] cookingState = new byte[4];
+ for (int index = 0; index < cookingState.length; index++) { + for (int index = 0; index < cookingState.length; index++) {
+ cookingState[index] = (byte) (this.stopCooking[index] ? 1 : 0); + cookingState[index] = (byte) (this.stopCooking[index] ? 1 : 0);
+ } + }
+ nbt.putByteArray("Paper.StopCooking", cookingState); + nbt.putByteArray("Paper.StopCooking", cookingState);
+ // Paper end + // Paper end - Add more Campfire API
} }
@Override @Override

View File

@ -8,7 +8,7 @@ This ensures at least a valid version of the chunk exists
on disk, even if outdated on disk, even if outdated
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 98c8b676fc5b2add44d6ddf5d32f85bc07ea22cb..84b2fd9db39e0cdf3e1cbe6444579f7ca839bc45 100644 index 98c8b676fc5b2add44d6ddf5d32f85bc07ea22cb..83966430240d375e7618e13c75676d510a222c37 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -1003,6 +1003,9 @@ public class RegionFile implements AutoCloseable { @@ -1003,6 +1003,9 @@ public class RegionFile implements AutoCloseable {
@ -41,13 +41,13 @@ index 98c8b676fc5b2add44d6ddf5d32f85bc07ea22cb..84b2fd9db39e0cdf3e1cbe6444579f7c
+ } + }
+ super.write(b, off, len); + super.write(b, off, len);
+ } + }
+ // Paper end + // Paper end - don't write garbage data to disk if writing serialization fails
+ +
public void close() throws IOException { public void close() throws IOException {
ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count); ByteBuffer bytebuffer = ByteBuffer.wrap(this.buf, 0, this.count);
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index a2794ec3d846136da64b6888d846587499a5f635..6eaeb2db0da59611501f2b1a63b5b48816a0ba48 100644 index a2794ec3d846136da64b6888d846587499a5f635..6bec4549fbcfb68a053300451e25babf8ff38e99 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -342,10 +342,17 @@ public class RegionFileStorage implements AutoCloseable { @@ -342,10 +342,17 @@ public class RegionFileStorage implements AutoCloseable {
@ -77,7 +77,7 @@ index a2794ec3d846136da64b6888d846587499a5f635..6eaeb2db0da59611501f2b1a63b5b488
- if (dataoutputstream != null) { - if (dataoutputstream != null) {
- dataoutputstream.close(); - dataoutputstream.close();
- } - }
+ // Paper - move into try block to only write if successfully serialized + // Paper - don't write garbage data to disk if writing serialization fails; move into try block to only write if successfully serialized
} }
// Paper start // Paper start
return; return;
@ -86,12 +86,12 @@ index a2794ec3d846136da64b6888d846587499a5f635..6eaeb2db0da59611501f2b1a63b5b488
} }
+ +
+ // Paper start + // Paper start - don't write garbage data to disk if writing serialization fails
+ public static final class RegionFileSizeException extends RuntimeException { + public static final class RegionFileSizeException extends RuntimeException {
+ +
+ public RegionFileSizeException(String message) { + public RegionFileSizeException(String message) {
+ super(message); + super(message);
+ } + }
+ } + }
+ // Paper end + // Paper end - don't write garbage data to disk if writing serialization fails
} }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix tripwire state inconsistency
This patch prevents updating and re-setting the tripwire when being removed in certain conditions This patch prevents updating and re-setting the tripwire when being removed in certain conditions
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b3684c21946 100644 index bbb7d1b03c78758d608e89129aacec151242831c..634a8d25fede36f848cf621bdada71eb4b32c67e 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java --- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -87,7 +87,7 @@ public class TripWireBlock extends Block { @@ -87,7 +87,7 @@ public class TripWireBlock extends Block {
@ -14,7 +14,7 @@ index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b36
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
if (!moved && !state.is(newState.getBlock())) { if (!moved && !state.is(newState.getBlock())) {
- this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true)); - this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
+ this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix state inconsistency + this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true), true); // Paper - fix tripwire state inconsistency
} }
} }
@ -22,12 +22,12 @@ index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b36
} }
private void updateSource(Level world, BlockPos pos, BlockState state) { private void updateSource(Level world, BlockPos pos, BlockState state) {
+ // Paper start - fix state inconsistency + // Paper start - fix tripwire state inconsistency
+ this.updateSource(world, pos, state, false); + this.updateSource(world, pos, state, false);
+ } + }
+ +
+ private void updateSource(Level world, BlockPos pos, BlockState state, boolean beingRemoved) { + private void updateSource(Level world, BlockPos pos, BlockState state, boolean beingRemoved) {
+ // Paper end + // Paper end - fix tripwire state inconsistency
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST}; Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
int i = aenumdirection.length; int i = aenumdirection.length;
int j = 0; int j = 0;
@ -36,12 +36,12 @@ index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b36
if (iblockdata1.is(this.hook)) { if (iblockdata1.is(this.hook)) {
if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) { if (iblockdata1.getValue(TripWireHookBlock.FACING) == enumdirection.getOpposite()) {
- TripWireHookBlock.calculateState(world, blockposition1, iblockdata1, false, true, k, state); - TripWireHookBlock.calculateState(world, blockposition1, iblockdata1, false, true, k, state);
+ TripWireHookBlock.calculateState(world, blockposition1, iblockdata1, false, true, k, state, beingRemoved); // Paper - fix state inconsistency + TripWireHookBlock.calculateState(world, blockposition1, iblockdata1, false, true, k, state, beingRemoved); // Paper - fix tripwire state inconsistency
} }
} else if (iblockdata1.is((Block) this)) { } else if (iblockdata1.is((Block) this)) {
++k; ++k;
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134cf25c282a 100644 index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..0f6ea0adb4b99d934e1a3fcb92562dffb2a45f63 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block { @@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block {
@ -50,12 +50,12 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134c
- public static void calculateState(Level world, BlockPos pos, BlockState state, boolean flag, boolean flag1, int i, @Nullable BlockState iblockdata1) { - public static void calculateState(Level world, BlockPos pos, BlockState state, boolean flag, boolean flag1, int i, @Nullable BlockState iblockdata1) {
+ public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) { + public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1) {
+ // Paper start - fix tripwire inconsistency + // Paper start - fix tripwire state inconsistency
+ calculateState(world, pos, state, beingRemoved, flag1, i, iblockdata1, false); + calculateState(world, pos, state, beingRemoved, flag1, i, iblockdata1, false);
+ } + }
+ +
+ public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1, boolean tripWireBeingRemoved) { + public static void calculateState(Level world, BlockPos pos, BlockState state, boolean beingRemoved, boolean flag1, int i, @Nullable BlockState iblockdata1, boolean tripWireBeingRemoved) {
+ // Paper end + // Paper end - fix tripwire state inconsistency
Optional<Direction> optional = state.getOptionalValue(TripWireHookBlock.FACING); Optional<Direction> optional = state.getOptionalValue(TripWireHookBlock.FACING);
if (optional.isPresent()) { if (optional.isPresent()) {
@ -64,7 +64,7 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134c
boolean flag3 = (Boolean) state.getOptionalValue(TripWireHookBlock.POWERED).orElse(false); boolean flag3 = (Boolean) state.getOptionalValue(TripWireHookBlock.POWERED).orElse(false);
Block block = state.getBlock(); Block block = state.getBlock();
- boolean flag4 = !flag; - boolean flag4 = !flag;
+ boolean flag4 = !beingRemoved; // Paper + boolean flag4 = !beingRemoved; // Paper - fix tripwire state inconsistency
boolean flag5 = false; boolean flag5 = false;
int j = 0; int j = 0;
BlockState[] aiblockdata = new BlockState[42]; BlockState[] aiblockdata = new BlockState[42];
@ -72,7 +72,7 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134c
boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED); boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);
flag5 |= flag6 && flag7; flag5 |= flag6 && flag7;
+ if (k != i || !tripWireBeingRemoved || !flag6) // Paper - don't update the tripwire again if being removed and not disarmed + if (k != i || !tripWireBeingRemoved || !flag6) // Paper - fix tripwire state inconsistency; don't update the tripwire again if being removed and not disarmed
aiblockdata[k] = iblockdata2; aiblockdata[k] = iblockdata2;
if (k == i) { if (k == i) {
world.scheduleTick(pos, block, 10); world.scheduleTick(pos, block, 10);
@ -81,7 +81,7 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..a3cef4ac925d09ad8789a59b46df134c
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
- if (!flag) { - if (!flag) {
+ if (!beingRemoved) { // Paper + if (!beingRemoved) { // Paper - fix tripwire state inconsistency
if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
if (flag1) { if (flag1) {

View File

@ -5,20 +5,20 @@ Subject: [PATCH] Forward CraftEntity in teleport command
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 519e3f0e376198fb399819f4587ccf935b93ea1a..4ffd551e6ea540cff14eaba0e95ed2c7c0bca513 100644 index 519e3f0e376198fb399819f4587ccf935b93ea1a..449601d6a8e89ae4f225407d7e00efedbe6eb6c9 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
@@ -3531,6 +3531,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -3531,6 +3531,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public void restoreFrom(Entity original) { public void restoreFrom(Entity original) {
+ // Paper start + // Paper start - Forward CraftEntity in teleport command
+ CraftEntity bukkitEntity = original.bukkitEntity; + CraftEntity bukkitEntity = original.bukkitEntity;
+ if (bukkitEntity != null) { + if (bukkitEntity != null) {
+ bukkitEntity.setHandle(this); + bukkitEntity.setHandle(this);
+ this.bukkitEntity = bukkitEntity; + this.bukkitEntity = bukkitEntity;
+ } + }
+ // Paper end + // Paper end - Forward CraftEntity in teleport command
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag()); CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
nbttagcompound.remove("Dimension"); nbttagcompound.remove("Dimension");
@ -30,7 +30,7 @@ index 519e3f0e376198fb399819f4587ccf935b93ea1a..4ffd551e6ea540cff14eaba0e95ed2c7
- this.getBukkitEntity().setHandle(entity); - this.getBukkitEntity().setHandle(entity);
- entity.bukkitEntity = this.getBukkitEntity(); - entity.bukkitEntity = this.getBukkitEntity();
- // CraftBukkit end - // CraftBukkit end
+ // // CraftBukkit start - Forward the CraftEntity to the new entity // Paper - moved to Entity#restoreFrom + // // CraftBukkit start - Forward the CraftEntity to the new entity // Paper - Forward CraftEntity in teleport command; moved to Entity#restoreFrom
+ // this.getBukkitEntity().setHandle(entity); + // this.getBukkitEntity().setHandle(entity);
+ // entity.bukkitEntity = this.getBukkitEntity(); + // entity.bukkitEntity = this.getBukkitEntity();
+ // // CraftBukkit end + // // CraftBukkit end

View File

@ -10,14 +10,14 @@ 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..82ca6267bca684a8f04ca37d40816686677a852a 100644 index 79732086bc4cdbca8364d78eb60d68c758055966..e65d7980b7ebed60786bc31e2f8156fda3b59556 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
return this.source.getBukkitSender(this); return this.source.getBukkitSender(this);
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start - override getSelectedEntities + // Paper start - tell clients to ask server for suggestions for EntityArguments
+ @Override + @Override
+ public Collection<String> getSelectedEntities() { + public Collection<String> getSelectedEntities() {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) {
@ -32,7 +32,7 @@ index 79732086bc4cdbca8364d78eb60d68c758055966..82ca6267bca684a8f04ca37d40816686
+ } + }
+ return SharedSuggestionProvider.super.getSelectedEntities(); + return SharedSuggestionProvider.super.getSelectedEntities();
+ } + }
+ // Paper end + // 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 bc0f9bf88de8f79f8e2aa2261d5a8bdc9dd1f53a..c2bd7eea15437f3526da37ce1c8642084a26406b 100644 index bc0f9bf88de8f79f8e2aa2261d5a8bdc9dd1f53a..c2bd7eea15437f3526da37ce1c8642084a26406b 100644
@ -60,7 +60,7 @@ index bc0f9bf88de8f79f8e2aa2261d5a8bdc9dd1f53a..c2bd7eea15437f3526da37ce1c864208
} }
diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..a71726cee91fb406875a4540c9fb7c0ecf757294 100644 index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..d93698fd814683d451a3c8e8bcbb9cd475c79515 100644
--- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java --- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java
@@ -128,7 +128,7 @@ public class EntityArgument implements ArgumentType<EntitySelector> { @@ -128,7 +128,7 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
@ -68,7 +68,7 @@ index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..a71726cee91fb406875a4540c9fb7c0e
stringreader.setCursor(suggestionsbuilder.getStart()); stringreader.setCursor(suggestionsbuilder.getStart());
- EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2)); - EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2));
+ EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper + EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, icompletionprovider.hasPermission(2), true); // Paper - tell clients to ask server for suggestions for EntityArguments
try { try {
argumentparserselector.parse(); argumentparserselector.parse();
@ -77,7 +77,7 @@ index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..a71726cee91fb406875a4540c9fb7c0e
return argumentparserselector.fillSuggestions(suggestionsbuilder, (suggestionsbuilder1) -> { return argumentparserselector.fillSuggestions(suggestionsbuilder, (suggestionsbuilder1) -> {
- Collection<String> collection = icompletionprovider.getOnlinePlayerNames(); - Collection<String> collection = icompletionprovider.getOnlinePlayerNames();
+ // Paper start + // Paper start - tell clients to ask server for suggestions for EntityArguments
+ final Collection<String> collection; + final Collection<String> collection;
+ if (icompletionprovider instanceof CommandSourceStack commandSourceStack && commandSourceStack.getEntity() instanceof ServerPlayer sourcePlayer) { + if (icompletionprovider instanceof CommandSourceStack commandSourceStack && commandSourceStack.getEntity() instanceof ServerPlayer sourcePlayer) {
+ collection = new java.util.ArrayList<>(); + collection = new java.util.ArrayList<>();
@ -89,43 +89,43 @@ index 850db283bf12345e9e7d7e8e590dbe8135c6dce1..a71726cee91fb406875a4540c9fb7c0e
+ } else { + } else {
+ collection = icompletionprovider.getOnlinePlayerNames(); + collection = icompletionprovider.getOnlinePlayerNames();
+ } + }
+ // Paper end + // Paper end - tell clients to ask server for suggestions for EntityArguments
Iterable<String> iterable = this.playersOnly ? collection : Iterables.concat(collection, icompletionprovider.getSelectedEntities()); Iterable<String> iterable = this.playersOnly ? collection : Iterables.concat(collection, icompletionprovider.getSelectedEntities());
SharedSuggestionProvider.suggest((Iterable) iterable, suggestionsbuilder1); SharedSuggestionProvider.suggest((Iterable) iterable, suggestionsbuilder1);
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
index 3d897ec6920eff6176ddac9f0442a997b9ef14fd..489b2ba7d4ef9c52a60db0c7e3fdd36226f5672d 100644 index 3d897ec6920eff6176ddac9f0442a997b9ef14fd..abaf1ea340c69c8bee80e64567b44b5ce66d5fa3 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
@@ -113,12 +113,19 @@ public class EntitySelectorParser { @@ -113,12 +113,19 @@ public class EntitySelectorParser {
private boolean hasScores; private boolean hasScores;
private boolean hasAdvancements; private boolean hasAdvancements;
private boolean usesSelectors; private boolean usesSelectors;
+ public boolean parsingEntityArgumentSuggestions; // Paper - track when parsing EntityArgument suggestions + public boolean parsingEntityArgumentSuggestions; // Paper - tell clients to ask server for suggestions for EntityArguments
public EntitySelectorParser(StringReader reader) { public EntitySelectorParser(StringReader reader) {
this(reader, true); this(reader, true);
} }
public EntitySelectorParser(StringReader reader, boolean atAllowed) { public EntitySelectorParser(StringReader reader, boolean atAllowed) {
+ // Paper start + // Paper start - tell clients to ask server for suggestions for EntityArguments
+ this(reader, atAllowed, false); + this(reader, atAllowed, false);
+ } + }
+ public EntitySelectorParser(StringReader reader, boolean atAllowed, boolean parsingEntityArgumentSuggestions) { + public EntitySelectorParser(StringReader reader, boolean atAllowed, boolean parsingEntityArgumentSuggestions) {
+ this.parsingEntityArgumentSuggestions = parsingEntityArgumentSuggestions; + this.parsingEntityArgumentSuggestions = parsingEntityArgumentSuggestions;
+ // Paper end + // Paper end - tell clients to ask server for suggestions for EntityArguments
this.distance = MinMaxBounds.Doubles.ANY; this.distance = MinMaxBounds.Doubles.ANY;
this.level = MinMaxBounds.Ints.ANY; this.level = MinMaxBounds.Ints.ANY;
this.rotX = WrappedMinMaxBounds.ANY; this.rotX = WrappedMinMaxBounds.ANY;
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
index 7863833c9a761a2b9364ff572ec909ec5a4538c3..0b36bd0a02082e8ec0ebef537656547ee3f1d748 100644 index 7863833c9a761a2b9364ff572ec909ec5a4538c3..36e26929306c04af7a44012fd7fc9902027e9ea2 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java
@@ -69,6 +69,19 @@ public class EntitySelectorOptions { @@ -69,6 +69,19 @@ public class EntitySelectorOptions {
public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> { public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> {
return Component.translatableEscape("argument.entity.options.type.invalid", entity); return Component.translatableEscape("argument.entity.options.type.invalid", entity);
}); });
+ // Paper start + // Paper start - tell clients to ask server for suggestions for EntityArguments
+ public static final DynamicCommandExceptionType ERROR_ENTITY_TAG_INVALID = new DynamicCommandExceptionType((object) -> { + public static final DynamicCommandExceptionType ERROR_ENTITY_TAG_INVALID = new DynamicCommandExceptionType((object) -> {
+ return io.papermc.paper.adventure.PaperAdventure + return io.papermc.paper.adventure.PaperAdventure
+ .asVanilla(net.kyori.adventure.text.Component + .asVanilla(net.kyori.adventure.text.Component
@ -137,7 +137,7 @@ index 7863833c9a761a2b9364ff572ec909ec5a4538c3..0b36bd0a02082e8ec0ebef537656547e
+ ) + )
+ ); + );
+ }); + });
+ // Paper end + // Paper end - tell clients to ask server for suggestions for EntityArguments
private static void register(String id, EntitySelectorOptions.Modifier handler, Predicate<EntitySelectorParser> condition, Component description) { private static void register(String id, EntitySelectorOptions.Modifier handler, Predicate<EntitySelectorParser> condition, Component description) {
OPTIONS.put(id, new EntitySelectorOptions.Option(handler, condition, description)); OPTIONS.put(id, new EntitySelectorOptions.Option(handler, condition, description));
@ -145,12 +145,12 @@ index 7863833c9a761a2b9364ff572ec909ec5a4538c3..0b36bd0a02082e8ec0ebef537656547e
if (reader.isTag()) { if (reader.isTag()) {
TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader()));
+ // Paper start - throw error if invalid entity tag (only on suggestions to keep cmd success behavior) + // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior)
+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { + if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) {
+ reader.getReader().setCursor(i); + reader.getReader().setCursor(i);
+ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); + throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey);
+ } + }
+ // Paper end + // Paper end - tell clients to ask server for suggestions for EntityArguments
reader.addPredicate((entity) -> { reader.addPredicate((entity) -> {
return entity.getType().is(tagKey) != bl; return entity.getType().is(tagKey) != bl;
}); });

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max block light for monster spawning
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
index 036d79baf372f4900681fee366bcd91c99474e5f..127a344f35e194fc7b1a0783c75291fab929fe19 100644 index 036d79baf372f4900681fee366bcd91c99474e5f..fbca4d6bc84e8be359b989ef089469838f896910 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { @@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
@ -13,7 +13,7 @@ index 036d79baf372f4900681fee366bcd91c99474e5f..127a344f35e194fc7b1a0783c75291fa
} else { } else {
DimensionType dimensionType = world.dimensionType(); DimensionType dimensionType = world.dimensionType();
- int i = dimensionType.monsterSpawnBlockLightLimit(); - int i = dimensionType.monsterSpawnBlockLightLimit();
+ int i = world.getLevel().paperConfig().entities.spawning.monsterSpawnMaxLightLevel.or(dimensionType.monsterSpawnBlockLightLimit()); // Paper + int i = world.getLevel().paperConfig().entities.spawning.monsterSpawnMaxLightLevel.or(dimensionType.monsterSpawnBlockLightLimit()); // Paper - Configurable max block light for monster spawning
if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) { if (i < 15 && world.getBrightness(LightLayer.BLOCK, pos) > i) {
return false; return false;
} else { } else {

View File

@ -27,7 +27,7 @@ Co-authored-by: Zach Brown <zach@zachbr.io>
Co-authored-by: Madeline Miller <mnmiller1@me.com> Co-authored-by: Madeline Miller <mnmiller1@me.com>
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 cda90023ad662e8875365eac98ec69f476dcb42d..b9025fcc6a4db9533cdc42034c9e77323d0785fa 100644 index cda90023ad662e8875365eac98ec69f476dcb42d..470495903a9f0f8b925ddc4fb3d8213c556fccd9 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
@@ -159,15 +159,15 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -159,15 +159,15 @@ public class PistonBaseBlock extends DirectionalBlock {
@ -43,7 +43,7 @@ index cda90023ad662e8875365eac98ec69f476dcb42d..b9025fcc6a4db9533cdc42034c9e7732
- return; - return;
- } - }
- } - }
+ // if (!this.isSticky) { // Paper - Move further down + // if (!this.isSticky) { // Paper - Fix sticky pistons and BlockPistonRetractEvent; Move further down
+ // org.bukkit.block.Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); + // org.bukkit.block.Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+ // BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection)); + // BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
+ // world.getCraftServer().getPluginManager().callEvent(event); + // world.getCraftServer().getPluginManager().callEvent(event);
@ -59,13 +59,13 @@ index cda90023ad662e8875365eac98ec69f476dcb42d..b9025fcc6a4db9533cdc42034c9e7732
BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
+ // Paper start - Move empty piston retract call to fix multiple event fires + // Paper start - Fix sticky pistons and BlockPistonRetractEvent; Move empty piston retract call to fix multiple event fires
+ if (!this.isSticky) { + if (!this.isSticky) {
+ if (!new BlockPistonRetractEvent(CraftBlock.at(world, pos), java.util.Collections.emptyList(), CraftBlock.notchToBlockFace(enumdirection)).callEvent()) { + if (!new BlockPistonRetractEvent(CraftBlock.at(world, pos), java.util.Collections.emptyList(), CraftBlock.notchToBlockFace(enumdirection)).callEvent()) {
+ return false; + return false;
+ } + }
+ } + }
+ // Paper end + // Paper end - Fix sticky pistons and BlockPistonRetractEvent
world.setBlock(pos, iblockdata2, 20); world.setBlock(pos, iblockdata2, 20);
world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - diff on change
world.blockUpdated(pos, iblockdata2.getBlock()); world.blockUpdated(pos, iblockdata2.getBlock());
@ -73,13 +73,13 @@ index cda90023ad662e8875365eac98ec69f476dcb42d..b9025fcc6a4db9533cdc42034c9e7732
if (type == 1 && !iblockdata3.isAir() && PistonBaseBlock.isPushable(iblockdata3, world, blockposition1, enumdirection.getOpposite(), false, enumdirection) && (iblockdata3.getPistonPushReaction() == PushReaction.NORMAL || iblockdata3.is(Blocks.PISTON) || iblockdata3.is(Blocks.STICKY_PISTON))) { if (type == 1 && !iblockdata3.isAir() && PistonBaseBlock.isPushable(iblockdata3, world, blockposition1, enumdirection.getOpposite(), false, enumdirection) && (iblockdata3.getPistonPushReaction() == PushReaction.NORMAL || iblockdata3.is(Blocks.PISTON) || iblockdata3.is(Blocks.STICKY_PISTON))) {
this.moveBlocks(world, pos, enumdirection, false); this.moveBlocks(world, pos, enumdirection, false);
} else { } else {
+ // Paper start - fire BlockPistonRetractEvent for sticky pistons retracting nothing (air) + // Paper start - Fix sticky pistons and BlockPistonRetractEvent; fire BlockPistonRetractEvent for sticky pistons retracting nothing (air)
+ if (type == TRIGGER_CONTRACT && iblockdata2.isAir()) { + if (type == TRIGGER_CONTRACT && iblockdata2.isAir()) {
+ if (!new BlockPistonRetractEvent(CraftBlock.at(world, pos), java.util.Collections.emptyList(), CraftBlock.notchToBlockFace(enumdirection)).callEvent()) { + if (!new BlockPistonRetractEvent(CraftBlock.at(world, pos), java.util.Collections.emptyList(), CraftBlock.notchToBlockFace(enumdirection)).callEvent()) {
+ return false; + return false;
+ } + }
+ } + }
+ // Paper end + // Paper end - Fix sticky pistons and BlockPistonRetractEvent
world.removeBlock(pos.relative(enumdirection), false); world.removeBlock(pos.relative(enumdirection), false);
} }
} }

View File

@ -7,7 +7,7 @@ Fixes bees incorrectly being aged up due to upstream's
resetting the ticks inside hive on a failed release resetting the ticks inside hive on a failed release
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 8c4fba5369e5e25f144291c43e086b7417b013aa..dfd364ac4b7551a13c4c6c100b5e62c0dfb10595 100644 index 8c4fba5369e5e25f144291c43e086b7417b013aa..3ba04d615fae9748c144b3dc7e7442be2e5a659f 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
@@ -328,7 +328,7 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -328,7 +328,7 @@ public class BeehiveBlockEntity extends BlockEntity {
@ -15,7 +15,7 @@ index 8c4fba5369e5e25f144291c43e086b7417b013aa..dfd364ac4b7551a13c4c6c100b5e62c0
for (Iterator iterator = bees.iterator(); iterator.hasNext(); ++tileentitybeehive_hivebee.ticksInHive) { for (Iterator iterator = bees.iterator(); iterator.hasNext(); ++tileentitybeehive_hivebee.ticksInHive) {
tileentitybeehive_hivebee = (BeehiveBlockEntity.BeeData) iterator.next(); tileentitybeehive_hivebee = (BeehiveBlockEntity.BeeData) iterator.next();
- if (tileentitybeehive_hivebee.ticksInHive > tileentitybeehive_hivebee.minOccupationTicks) { - if (tileentitybeehive_hivebee.ticksInHive > tileentitybeehive_hivebee.minOccupationTicks) {
+ if (tileentitybeehive_hivebee.exitTickCounter > tileentitybeehive_hivebee.minOccupationTicks) { // Paper - use exitTickCounter + if (tileentitybeehive_hivebee.exitTickCounter > tileentitybeehive_hivebee.minOccupationTicks) { // Paper - Fix bees aging inside hives; use exitTickCounter
BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus = tileentitybeehive_hivebee.entityData.getBoolean("HasNectar") ? BeehiveBlockEntity.BeeReleaseStatus.HONEY_DELIVERED : BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED; BeehiveBlockEntity.BeeReleaseStatus tileentitybeehive_releasestatus = tileentitybeehive_hivebee.entityData.getBoolean("HasNectar") ? BeehiveBlockEntity.BeeReleaseStatus.HONEY_DELIVERED : BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED;
if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, flowerPos)) { if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, flowerPos)) {
@ -24,11 +24,11 @@ index 8c4fba5369e5e25f144291c43e086b7417b013aa..dfd364ac4b7551a13c4c6c100b5e62c0
// CraftBukkit start // CraftBukkit start
} else { } else {
- tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable - tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable
+ tileentitybeehive_hivebee.exitTickCounter = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable // Paper - use exitTickCounter to keep actual bee life + tileentitybeehive_hivebee.exitTickCounter = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable // Paper - Fix bees aging inside hives; use exitTickCounter to keep actual bee life
// CraftBukkit end // CraftBukkit end
} }
} }
+ tileentitybeehive_hivebee.exitTickCounter++; // Paper + tileentitybeehive_hivebee.exitTickCounter++; // Paper - Fix bees aging inside hives
} }
if (flag) { if (flag) {
@ -36,14 +36,14 @@ index 8c4fba5369e5e25f144291c43e086b7417b013aa..dfd364ac4b7551a13c4c6c100b5e62c0
final CompoundTag entityData; final CompoundTag entityData;
int ticksInHive; int ticksInHive;
+ int exitTickCounter; // Paper - separate counter for checking if bee should exit to reduce exit attempts + int exitTickCounter; // Paper - Fix bees aging inside hives; separate counter for checking if bee should exit to reduce exit attempts
final int minOccupationTicks; final int minOccupationTicks;
BeeData(CompoundTag entityData, int ticksInHive, int minOccupationTicks) { BeeData(CompoundTag entityData, int ticksInHive, int minOccupationTicks) {
BeehiveBlockEntity.removeIgnoredBeeTags(entityData); BeehiveBlockEntity.removeIgnoredBeeTags(entityData);
this.entityData = entityData; this.entityData = entityData;
this.ticksInHive = ticksInHive; this.ticksInHive = ticksInHive;
+ this.exitTickCounter = ticksInHive; // Paper + this.exitTickCounter = ticksInHive; // Paper - Fix bees aging inside hives
this.minOccupationTicks = minOccupationTicks; this.minOccupationTicks = minOccupationTicks;
} }
} }

View File

@ -39,7 +39,7 @@ index 8f0d1e9e8a191a2049f3ad2d9b4ffdbd15c45d9f..1038bdb761c4b413cb92e08aa7ef634b
} }
} }
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 bce494bb7bc1ce20809ac7d355f04aa7aad78308..7a984f531d3ebb6e055f07227b2ef8247fb3a842 100644 index bce494bb7bc1ce20809ac7d355f04aa7aad78308..6ab0c3116a4238a4c5369cc33452fed594149ea4 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
@@ -2340,9 +2340,23 @@ public abstract class Player extends LivingEntity { @@ -2340,9 +2340,23 @@ public abstract class Player extends LivingEntity {
@ -49,7 +49,7 @@ index bce494bb7bc1ce20809ac7d355f04aa7aad78308..7a984f531d3ebb6e055f07227b2ef824
- return name.length() > 16 ? false : name.chars().filter((i) -> { - return name.length() > 16 ? false : name.chars().filter((i) -> {
- return i <= 32 || i >= 127; - return i <= 32 || i >= 127;
- }).findAny().isEmpty(); - }).findAny().isEmpty();
+ // Paper start + // Paper start - username validation overriding
+ if (name == null || name.isEmpty() || name.length() > 16) { + if (name == null || name.isEmpty() || name.length() > 16) {
+ return false; + return false;
+ } + }
@ -65,7 +65,7 @@ index bce494bb7bc1ce20809ac7d355f04aa7aad78308..7a984f531d3ebb6e055f07227b2ef824
+ } + }
+ +
+ return true; + return true;
+ // Paper end + // Paper end - username validation overriding
} }
public static float getPickRange(boolean creative) { public static float getPickRange(boolean creative) {

View File

@ -5,17 +5,17 @@ Subject: [PATCH] Make water animal spawn height configurable
diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
index 27624b080e025d943b9c99627568f7dd66165548..827912174ee08cd19249797d351887149b25c880 100644 index 27624b080e025d943b9c99627568f7dd66165548..9b897cf53f4bb5d366e6ac88dbed93c59d8fe541 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -73,6 +73,10 @@ public abstract class WaterAnimal extends PathfinderMob { @@ -73,6 +73,10 @@ public abstract class WaterAnimal extends PathfinderMob {
public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) {
int i = world.getSeaLevel(); int i = world.getSeaLevel();
int j = i - 13; int j = i - 13;
+ // Paper start + // Paper start - Make water animal spawn height configurable
+ i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i); + i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i);
+ j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j); + j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j);
+ // Paper end + // Paper end - Make water animal spawn height configurable
return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER); return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER);
} }
} }

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo
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 6873036e7d24a2b8e85ab7ae270eec63bd7e7b5b..ac4d96345c985284a1306055b164a74a483cb444 100644 index 6873036e7d24a2b8e85ab7ae270eec63bd7e7b5b..70adb35d0f267666e44c61ac0578a12f107f65b7 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
@@ -596,7 +596,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -596,7 +596,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -13,12 +13,12 @@ index 6873036e7d24a2b8e85ab7ae270eec63bd7e7b5b..ac4d96345c985284a1306055b164a74a
LevelStem worlddimension = (LevelStem) dimensions.get(dimensionKey); LevelStem worlddimension = (LevelStem) dimensions.get(dimensionKey);
- org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value()); - org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value());
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value(), worlddimension.generator(), this.registryAccess()); // Paper + org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value(), worlddimension.generator(), this.registryAccess()); // Paper - Expose vanilla BiomeProvider from WorldInfo
if (biomeProvider == null && gen != null) { if (biomeProvider == null && gen != null) {
biomeProvider = gen.getDefaultBiomeProvider(worldInfo); biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
} }
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 36a620d44140edac72e20b83a2cee2860e09deec..e2308ca7bd457ada1e5c0535d10e97affef65612 100644 index 9f9492f0f5bc9c39f4c0021956e3240a466f3085..6e1ebb33413018d0cd2275eb76a7bdfbf8542da1 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
@@ -1258,7 +1258,7 @@ public final class CraftServer implements Server { @@ -1258,7 +1258,7 @@ public final class CraftServer implements Server {
@ -26,7 +26,7 @@ index 36a620d44140edac72e20b83a2cee2860e09deec..e2308ca7bd457ada1e5c0535d10e97af
LevelStem worlddimension = iregistry.get(actualDimension); LevelStem worlddimension = iregistry.get(actualDimension);
- WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value()); - WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value());
+ WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value(), worlddimension.generator(), this.getHandle().getServer().registryAccess()); // Paper + WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value(), worlddimension.generator(), this.getHandle().getServer().registryAccess()); // Paper - Expose vanilla BiomeProvider from WorldInfo
if (biomeProvider == null && generator != null) { if (biomeProvider == null && generator != null) {
biomeProvider = generator.getDefaultBiomeProvider(worldInfo); biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
} }

View File

@ -5,31 +5,31 @@ Subject: [PATCH] Multiple Entries with Scoreboards
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
index e52644010dc2cf41bbf508b16b8ec2f0003e9d0b..b25f0e0a4ea12de2606d273e7c1ee534002c8d5a 100644 index e52644010dc2cf41bbf508b16b8ec2f0003e9d0b..f06ee212528d5670fb83720c2b543f864b64e873 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi @@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName)); return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName));
} }
+ // Paper start + // Paper start - Multiple Entries with Scoreboards
+ public static ClientboundSetPlayerTeamPacket createMultiplePlayerPacket(PlayerTeam team, Collection<String> players, ClientboundSetPlayerTeamPacket.Action operation) { + public static ClientboundSetPlayerTeamPacket createMultiplePlayerPacket(PlayerTeam team, Collection<String> players, ClientboundSetPlayerTeamPacket.Action operation) {
+ return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players); + return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players);
+ } + }
+ // Paper end + // Paper end - Multiple Entries with Scoreboards
+ +
public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) { public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) {
this.name = buf.readUtf(); this.name = buf.readUtf();
this.method = buf.readByte(); this.method = buf.readByte();
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
index c4904b358fc2f493e6a9572a84b8110a927da208..5cc8173e845bf8d3414ac3347d25e1f6d0c65ce9 100644 index c4904b358fc2f493e6a9572a84b8110a927da208..76d67d01388ecc1af6b43212e018edc678e84d72 100644
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java --- a/src/main/java/net/minecraft/server/ServerScoreboard.java
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java +++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
@@ -104,6 +104,25 @@ public class ServerScoreboard extends Scoreboard { @@ -104,6 +104,25 @@ public class ServerScoreboard extends Scoreboard {
} }
} }
+ // Paper start + // Paper start - Multiple Entries with Scoreboards
+ public boolean addPlayersToTeam(java.util.Collection<String> players, PlayerTeam team) { + public boolean addPlayersToTeam(java.util.Collection<String> players, PlayerTeam team) {
+ boolean anyAdded = false; + boolean anyAdded = false;
+ for (String playerName : players) { + for (String playerName : players) {
@ -46,7 +46,7 @@ index c4904b358fc2f493e6a9572a84b8110a927da208..5cc8173e845bf8d3414ac3347d25e1f6
+ return false; + return false;
+ } + }
+ } + }
+ // Paper end + // Paper end - Multiple Entries with Scoreboards
+ +
@Override @Override
public void removePlayerFromTeam(String scoreHolderName, PlayerTeam team) { public void removePlayerFromTeam(String scoreHolderName, PlayerTeam team) {
@ -55,7 +55,7 @@ index c4904b358fc2f493e6a9572a84b8110a927da208..5cc8173e845bf8d3414ac3347d25e1f6
this.setDirty(); this.setDirty();
} }
+ // Paper start + // Paper start - Multiple Entries with Scoreboards
+ public void removePlayersFromTeam(java.util.Collection<String> players, PlayerTeam team) { + public void removePlayersFromTeam(java.util.Collection<String> players, PlayerTeam team) {
+ for (String playerName : players) { + for (String playerName : players) {
+ super.removePlayerFromTeam(playerName, team); + super.removePlayerFromTeam(playerName, team);
@ -64,20 +64,20 @@ index c4904b358fc2f493e6a9572a84b8110a927da208..5cc8173e845bf8d3414ac3347d25e1f6
+ this.broadcastAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.REMOVE)); + this.broadcastAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.REMOVE));
+ this.setDirty(); + this.setDirty();
+ } + }
+ // Paper end + // Paper end - Multiple Entries with Scoreboards
+ +
@Override @Override
public void onObjectiveAdded(Objective objective) { public void onObjectiveAdded(Objective objective) {
super.onObjectiveAdded(objective); super.onObjectiveAdded(objective);
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
index 27219bf2f16aed64c78623d44c3cc84aa9f47065..fd86c1d43cccd036f60cb270b56fd33f95707720 100644 index 27219bf2f16aed64c78623d44c3cc84aa9f47065..2b335c750ce5f9ccc2651a8701497ca9b8f46704 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
@@ -229,6 +229,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -229,6 +229,21 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
scoreboard.board.addPlayerToTeam(entry, this.team); scoreboard.board.addPlayerToTeam(entry, this.team);
} }
+ // Paper start + // Paper start - Multiple Entries with Scoreboards
+ @Override + @Override
+ public void addEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException { + public void addEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException {
+ this.addEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList()); + this.addEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList());
@ -90,7 +90,7 @@ index 27219bf2f16aed64c78623d44c3cc84aa9f47065..fd86c1d43cccd036f60cb270b56fd33f
+ +
+ ((net.minecraft.server.ServerScoreboard) scoreboard.board).addPlayersToTeam(entries, this.team); + ((net.minecraft.server.ServerScoreboard) scoreboard.board).addPlayersToTeam(entries, this.team);
+ } + }
+ // Paper end + // Paper end - Multiple Entries with Scoreboards
+ +
@Override @Override
public boolean removePlayer(OfflinePlayer player) { public boolean removePlayer(OfflinePlayer player) {
@ -99,7 +99,7 @@ index 27219bf2f16aed64c78623d44c3cc84aa9f47065..fd86c1d43cccd036f60cb270b56fd33f
return true; return true;
} }
+ // Paper start + // Paper start - Multiple Entries with Scoreboards
+ @Override + @Override
+ public boolean removeEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException { + public boolean removeEntities(java.util.Collection<org.bukkit.entity.Entity> entities) throws IllegalStateException, IllegalArgumentException {
+ return this.removeEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList()); + return this.removeEntries(entities.stream().map(entity -> ((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandle().getScoreboardName()).toList());
@ -119,7 +119,7 @@ index 27219bf2f16aed64c78623d44c3cc84aa9f47065..fd86c1d43cccd036f60cb270b56fd33f
+ +
+ return false; + return false;
+ } + }
+ // Paper end + // Paper end - Multiple Entries with Scoreboards
+ +
@Override @Override
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException { public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {

View File

@ -5,14 +5,14 @@ Subject: [PATCH] Reset placed block on exception
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index e68b7a1b03783e4f9de24c5ae8773fc359bd2d37..e581dc10f3c805f7f8b6e4c842092609e7e1a0f8 100644 index e68b7a1b03783e4f9de24c5ae8773fc359bd2d37..daf093518f1daf598c858cfaf48357255a1fb0cf 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java --- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -80,6 +80,7 @@ public class BlockItem extends Item { @@ -80,6 +80,7 @@ public class BlockItem extends Item {
if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) { if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) {
blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
} }
+ final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper + final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper - Reset placed block on exception
// CraftBukkit end // CraftBukkit end
if (iblockdata == null) { if (iblockdata == null) {
@ -20,7 +20,7 @@ index e68b7a1b03783e4f9de24c5ae8773fc359bd2d37..e581dc10f3c805f7f8b6e4c842092609
if (iblockdata1.is(iblockdata.getBlock())) { if (iblockdata1.is(iblockdata.getBlock())) {
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1); iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
+ // Paper start - reset block on exception + // Paper start - Reset placed block on exception
+ try { + try {
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1); this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
+ } catch (Exception e) { + } catch (Exception e) {
@ -32,7 +32,7 @@ index e68b7a1b03783e4f9de24c5ae8773fc359bd2d37..e581dc10f3c805f7f8b6e4c842092609
+ } + }
+ throw e; // Rethrow exception if not placed by a player + throw e; // Rethrow exception if not placed by a player
+ } + }
+ // Paper end + // Paper end - Reset placed block on exception
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack); iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
// CraftBukkit start // CraftBukkit start
if (blockstate != null) { if (blockstate != null) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable height for slime spawn
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 37724831ba9db2d0fb2e7756816e0355bc760815..cd964e5cded6a74cb9dcf27b4134f944764062cd 100644 index 37724831ba9db2d0fb2e7756816e0355bc760815..0ce75b221241b412fe7d8873bdc4a49370b6410b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -336,7 +336,11 @@ public class Slime extends Mob implements Enemy { @@ -336,7 +336,11 @@ public class Slime extends Mob implements Enemy {
@ -17,7 +17,7 @@ index 37724831ba9db2d0fb2e7756816e0355bc760815..cd964e5cded6a74cb9dcf27b4134f944
+ final double maxHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.maximum; + final double maxHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.maximum;
+ final double minHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.minimum; + final double minHeightSwamp = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.surfaceBiome.minimum;
+ if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) { + if (world.getBiome(pos).is(BiomeTags.ALLOWS_SURFACE_SLIME_SPAWNS) && pos.getY() > minHeightSwamp && pos.getY() < maxHeightSwamp && random.nextFloat() < 0.5F && random.nextFloat() < world.getMoonBrightness() && world.getMaxLocalRawBrightness(pos) <= random.nextInt(8)) {
+ // Paper end + // Paper end - Replace rules for Height in Swamp Biome
return checkMobSpawnRules(type, world, spawnReason, pos, random); return checkMobSpawnRules(type, world, spawnReason, pos, random);
} }
@ -29,7 +29,7 @@ index 37724831ba9db2d0fb2e7756816e0355bc760815..cd964e5cded6a74cb9dcf27b4134f944
+ // Paper start - Replace rules for Height in Slime Chunks + // Paper start - Replace rules for Height in Slime Chunks
+ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; + final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum;
+ if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { + if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) {
+ // Paper end + // Paper end - Replace rules for Height in Swamp Biome
return checkMobSpawnRules(type, world, spawnReason, pos, random); return checkMobSpawnRules(type, world, spawnReason, pos, random);
} }
} }

View File

@ -9,7 +9,7 @@ so this resets it after each call to
Zombie#getExperienceReward Zombie#getExperienceReward
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 b31f6b267693c409d58eee688a3b79a1cf14e391..753defa8f8b48d004a2a53b2fc322fd9c083d95e 100644 index b31f6b267693c409d58eee688a3b79a1cf14e391..ab41bd0f1810207a83ed506d6d1aa0289508d09a 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
@@ -175,11 +175,16 @@ public class Zombie extends Monster { @@ -175,11 +175,16 @@ public class Zombie extends Monster {
@ -22,11 +22,11 @@ index b31f6b267693c409d58eee688a3b79a1cf14e391..753defa8f8b48d004a2a53b2fc322fd9
} }
- return super.getExperienceReward(); - return super.getExperienceReward();
+ // Paper start - only change the XP reward for the calculations in the super method + // Paper start - store previous value to reset after calculating XP reward
+ int reward = super.getExperienceReward(); + int reward = super.getExperienceReward();
+ this.xpReward = previousReward; + this.xpReward = previousReward;
+ return reward; + return reward;
+ // Paper end + // Paper end - store previous value to reset after calculating XP reward
} }
@Override @Override

View File

@ -5,20 +5,20 @@ Subject: [PATCH] Multi Block Change API Implementation
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
index f96d61bdeb556665d6e6e5023f9d77fd82204e89..e3f355c85eb7cc8c1683e3009502c10a5ed32daa 100644 index f96d61bdeb556665d6e6e5023f9d77fd82204e89..ccdc2345465313991f065e1176b58fb7d5e8722f 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
@@ -59,6 +59,14 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa @@ -59,6 +59,14 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa
} }
+ // Paper start + // Paper start - Multi Block Change API
+ public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges) { + public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges) {
+ this.sectionPos = sectionPos; + this.sectionPos = sectionPos;
+ this.positions = blockChanges.keySet().toShortArray(); + this.positions = blockChanges.keySet().toShortArray();
+ this.states = blockChanges.values().toArray(new BlockState[0]); + this.states = blockChanges.values().toArray(new BlockState[0]);
+ } + }
+ // Paper end + // Paper end - Multi Block Change API
+ +
@Override @Override
public void write(FriendlyByteBuf buf) { public void write(FriendlyByteBuf buf) {

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Fix NotePlayEvent
public org.bukkit.craftbukkit.block.data.CraftBlockData toNMS(Ljava/lang/Enum;Ljava/lang/Class;)Ljava/lang/Enum; public org.bukkit.craftbukkit.block.data.CraftBlockData toNMS(Ljava/lang/Enum;Ljava/lang/Class;)Ljava/lang/Enum;
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
index 43fbdca9422b679c210bc556e2d48ad37babbe8b..f32334f9e0f13a227bef8ffb135dda82b2ec39f2 100644 index 43fbdca9422b679c210bc556e2d48ad37babbe8b..92a24cf02f15f3ab893eb9a793770d9819e4f600 100644
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java --- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
@@ -93,11 +93,12 @@ public class NoteBlock extends Block { @@ -93,11 +93,12 @@ public class NoteBlock extends Block {
@ -23,7 +23,7 @@ index 43fbdca9422b679c210bc556e2d48ad37babbe8b..f32334f9e0f13a227bef8ffb135dda82
+ // return; + // return;
+ // } + // }
// CraftBukkit end // CraftBukkit end
+ // Paper - TODO any way to cancel the game event? + // Paper - move NotePlayEvent call to fix instrument/note changes; TODO any way to cancel the game event?
world.blockEvent(pos, this, 0, 0); world.blockEvent(pos, this, 0, 0);
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, pos); world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, pos);
} }
@ -34,12 +34,12 @@ index 43fbdca9422b679c210bc556e2d48ad37babbe8b..f32334f9e0f13a227bef8ffb135dda82
+ // Paper start - move NotePlayEvent call to fix instrument/note changes + // Paper start - move NotePlayEvent call to fix instrument/note changes
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, blockpropertyinstrument, state.getValue(NOTE)); + org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, blockpropertyinstrument, state.getValue(NOTE));
+ if (event.isCancelled()) return false; + if (event.isCancelled()) return false;
+ // Paper end + // Paper end - move NotePlayEvent call to fix instrument/note changes
float f; float f;
if (blockpropertyinstrument.isTunable()) { if (blockpropertyinstrument.isTunable()) {
- int k = (Integer) state.getValue(NoteBlock.NOTE); - int k = (Integer) state.getValue(NoteBlock.NOTE);
+ int k = event.getNote().getId(); // Paper + int k = event.getNote().getId(); // Paper - move NotePlayEvent call to fix instrument/note changes
f = NoteBlock.getPitchFromNote(k); f = NoteBlock.getPitchFromNote(k);
world.addParticle(ParticleTypes.NOTE, (double) pos.getX() + 0.5D, (double) pos.getY() + 1.2D, (double) pos.getZ() + 0.5D, (double) k / 24.0D, 0.0D, 0.0D); world.addParticle(ParticleTypes.NOTE, (double) pos.getX() + 0.5D, (double) pos.getY() + 1.2D, (double) pos.getZ() + 0.5D, (double) k / 24.0D, 0.0D, 0.0D);
@ -48,7 +48,7 @@ index 43fbdca9422b679c210bc556e2d48ad37babbe8b..f32334f9e0f13a227bef8ffb135dda82
holder = Holder.direct(SoundEvent.createVariableRangeEvent(minecraftkey)); holder = Holder.direct(SoundEvent.createVariableRangeEvent(minecraftkey));
} else { } else {
- holder = blockpropertyinstrument.getSoundEvent(); - holder = blockpropertyinstrument.getSoundEvent();
+ holder = org.bukkit.craftbukkit.block.data.CraftBlockData.toNMS(event.getInstrument(), NoteBlockInstrument.class).getSoundEvent(); // Paper + holder = org.bukkit.craftbukkit.block.data.CraftBlockData.toNMS(event.getInstrument(), NoteBlockInstrument.class).getSoundEvent(); // Paper - move NotePlayEvent call to fix instrument/note changes
} }
world.playSeededSound((Player) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, holder, SoundSource.RECORDS, 3.0F, f, world.random.nextLong()); world.playSeededSound((Player) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, holder, SoundSource.RECORDS, 3.0F, f, world.random.nextLong());

View File

@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Tue, 7 Dec 2021 19:34:23 -0500
Subject: [PATCH] Dolphin API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
index af432f9a1d255a56c31c3b97aeb4457d17f37e3e..f93f8f6509b12eb9b1e07c829278bb0822dd7988 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
@@ -18,4 +18,36 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin {
public String toString() {
return "CraftDolphin";
}
+
+ // Paper start - Missing Dolphin API
+ @Override
+ public int getMoistness() {
+ return this.getHandle().getMoistnessLevel();
+ }
+
+ @Override
+ public void setMoistness(int moistness) {
+ this.getHandle().setMoisntessLevel(moistness);
+ }
+
+ @Override
+ public void setHasFish(boolean hasFish) {
+ this.getHandle().setGotFish(hasFish);
+ }
+
+ @Override
+ public boolean hasFish() {
+ return this.getHandle().gotFish();
+ }
+
+ @Override
+ public org.bukkit.Location getTreasureLocation() {
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos());
+ }
+
+ @Override
+ public void setTreasureLocation(org.bukkit.Location location) {
+ this.getHandle().setTreasurePos(io.papermc.paper.util.MCUtil.toBlockPosition(location));
+ }
+ // Paper end - Missing Dolphin API
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use a CHM for StructureTemplate.Pallete cache
fixes a CME due to this collection being shared across threads fixes a CME due to this collection being shared across threads
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index 75ba5a7fe002b5834f12e3a1159c15e6166c9c28..b2139e5f7a051cdea2a7ed6e98ba8be7ce1113cc 100644 index 75ba5a7fe002b5834f12e3a1159c15e6166c9c28..be8aab51a1b92a3a0cc94976975fc3aabc46f0b4 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -852,7 +852,7 @@ public class StructureTemplate { @@ -852,7 +852,7 @@ public class StructureTemplate {
@ -14,7 +14,7 @@ index 75ba5a7fe002b5834f12e3a1159c15e6166c9c28..b2139e5f7a051cdea2a7ed6e98ba8be7
private final List<StructureTemplate.StructureBlockInfo> blocks; private final List<StructureTemplate.StructureBlockInfo> blocks;
- private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newHashMap(); - private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newHashMap();
+ private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newConcurrentMap(); // Paper + private final Map<Block, List<StructureTemplate.StructureBlockInfo>> cache = Maps.newConcurrentMap(); // Paper - Fix CME due to this collection being shared across threads
Palette(List<StructureTemplate.StructureBlockInfo> infos) { Palette(List<StructureTemplate.StructureBlockInfo> infos) {
this.blocks = infos; this.blocks = infos;

View File

@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf
+ } + }
+} +}
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 e2308ca7bd457ada1e5c0535d10e97affef65612..3aa82952cfd0415288b434a6462123504e4dab99 100644 index 6e1ebb33413018d0cd2275eb76a7bdfbf8542da1..d53abb73ab61151a14baef8ce5cdf40ff8709238 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
@@ -2110,6 +2110,13 @@ public final class CraftServer implements Server { @@ -2110,6 +2110,13 @@ public final class CraftServer implements Server {

View File

@ -20,7 +20,7 @@ seeds/salts to the frequency reducer which has a similar effect.
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com> Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 996a49e1ccf827edf28ca92e947014517b7dad6e..e9239f90e59d1429fc7a2618e0fd3b8a57633b87 100644 index 996a49e1ccf827edf28ca92e947014517b7dad6e..65db282b32dfec041579812f9b7275d8c0b99a0d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -568,7 +568,7 @@ public abstract class ChunkGenerator { @@ -568,7 +568,7 @@ public abstract class ChunkGenerator {
@ -28,19 +28,19 @@ index 996a49e1ccf827edf28ca92e947014517b7dad6e..e9239f90e59d1429fc7a2618e0fd3b8a
} }
- if (structureplacement.isStructureChunk(placementCalculator, chunkcoordintpair.x, chunkcoordintpair.z)) { - if (structureplacement.isStructureChunk(placementCalculator, chunkcoordintpair.x, chunkcoordintpair.z)) {
+ if (structureplacement.isStructureChunk(placementCalculator, chunkcoordintpair.x, chunkcoordintpair.z, structureplacement instanceof net.minecraft.world.level.chunk.ChunkGeneratorStructureState.KeyedRandomSpreadStructurePlacement keyed ? keyed.key : null)) { // Paper - add missing structure set configs + if (structureplacement.isStructureChunk(placementCalculator, chunkcoordintpair.x, chunkcoordintpair.z, structureplacement instanceof net.minecraft.world.level.chunk.ChunkGeneratorStructureState.KeyedRandomSpreadStructurePlacement keyed ? keyed.key : null)) { // Paper - Add missing structure set seed configs
if (list.size() == 1) { if (list.size() == 1) {
this.tryGenerateStructure((StructureSet.StructureSelectionEntry) list.get(0), structureAccessor, registryManager, randomstate, structureTemplateManager, placementCalculator.getLevelSeed(), chunk, chunkcoordintpair, sectionposition); this.tryGenerateStructure((StructureSet.StructureSelectionEntry) list.get(0), structureAccessor, registryManager, randomstate, structureTemplateManager, placementCalculator.getLevelSeed(), chunk, chunkcoordintpair, sectionposition);
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f34d8d3ccd 100644 index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..798e22fb4d685b5845ebf687e8004e94f13a9751 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
@@ -50,13 +50,14 @@ public class ChunkGeneratorStructureState { @@ -50,13 +50,14 @@ public class ChunkGeneratorStructureState {
private final Map<ConcentricRingsStructurePlacement, CompletableFuture<List<ChunkPos>>> ringPositions = new Object2ObjectArrayMap(); private final Map<ConcentricRingsStructurePlacement, CompletableFuture<List<ChunkPos>>> ringPositions = new Object2ObjectArrayMap();
private boolean hasGeneratedPositions; private boolean hasGeneratedPositions;
private final List<Holder<StructureSet>> possibleStructureSets; private final List<Holder<StructureSet>> possibleStructureSets;
+ public final SpigotWorldConfig conf; // Paper + public final SpigotWorldConfig conf; // Paper - Add missing structure set seed configs
public static ChunkGeneratorStructureState createForFlat(RandomState randomstate, long i, BiomeSource worldchunkmanager, Stream<Holder<StructureSet>> stream, SpigotWorldConfig conf) { // Spigot public static ChunkGeneratorStructureState createForFlat(RandomState randomstate, long i, BiomeSource worldchunkmanager, Stream<Holder<StructureSet>> stream, SpigotWorldConfig conf) { // Spigot
List<Holder<StructureSet>> list = stream.filter((holder) -> { List<Holder<StructureSet>> list = stream.filter((holder) -> {
@ -59,7 +59,7 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
- return new ChunkGeneratorStructureState(randomstate, worldchunkmanager, i, i, ChunkGeneratorStructureState.injectSpigot(list, conf)); // Spigot - return new ChunkGeneratorStructureState(randomstate, worldchunkmanager, i, i, ChunkGeneratorStructureState.injectSpigot(list, conf)); // Spigot
+ return new ChunkGeneratorStructureState(randomstate, worldchunkmanager, i, i, ChunkGeneratorStructureState.injectSpigot(list, conf), conf); // Spigot + return new ChunkGeneratorStructureState(randomstate, worldchunkmanager, i, i, ChunkGeneratorStructureState.injectSpigot(list, conf), conf); // Spigot
} }
+ // Paper start - horrible hack because spigot creates a ton of direct Holders which lose track of the identifying key + // Paper start - Add missing structure set seed configs; horrible hack because spigot creates a ton of direct Holders which lose track of the identifying key
+ public static final class KeyedRandomSpreadStructurePlacement extends RandomSpreadStructurePlacement { + public static final class KeyedRandomSpreadStructurePlacement extends RandomSpreadStructurePlacement {
+ public final net.minecraft.resources.ResourceKey<StructureSet> key; + public final net.minecraft.resources.ResourceKey<StructureSet> key;
+ public KeyedRandomSpreadStructurePlacement(net.minecraft.resources.ResourceKey<StructureSet> key, net.minecraft.core.Vec3i locateOffset, FrequencyReductionMethod frequencyReductionMethod, float frequency, int salt, java.util.Optional<StructurePlacement.ExclusionZone> exclusionZone, int spacing, int separation, net.minecraft.world.level.levelgen.structure.placement.RandomSpreadType spreadType) { + public KeyedRandomSpreadStructurePlacement(net.minecraft.resources.ResourceKey<StructureSet> key, net.minecraft.core.Vec3i locateOffset, FrequencyReductionMethod frequencyReductionMethod, float frequency, int salt, java.util.Optional<StructurePlacement.ExclusionZone> exclusionZone, int spacing, int separation, net.minecraft.world.level.levelgen.structure.placement.RandomSpreadType spreadType) {
@ -67,15 +67,15 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
+ this.key = key; + this.key = key;
+ } + }
+ } + }
+ // Paper end + // Paper end - Add missing structure set seed configs
// Spigot start // Spigot start
private static List<Holder<StructureSet>> injectSpigot(List<Holder<StructureSet>> list, SpigotWorldConfig conf) { private static List<Holder<StructureSet>> injectSpigot(List<Holder<StructureSet>> list, SpigotWorldConfig conf) {
return list.stream().map((holder) -> { return list.stream().map((holder) -> {
StructureSet structureset = holder.value(); StructureSet structureset = holder.value();
- if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig) { - if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig) {
+ final Holder<StructureSet> newHolder; // Paper + final Holder<StructureSet> newHolder; // Paper - Add missing structure set seed configs
+ if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig && holder.unwrapKey().orElseThrow().location().getNamespace().equals(net.minecraft.resources.ResourceLocation.DEFAULT_NAMESPACE)) { // Paper - check namespace cause datapacks could add structure sets with the same path + if (structureset.placement() instanceof RandomSpreadStructurePlacement randomConfig && holder.unwrapKey().orElseThrow().location().getNamespace().equals(net.minecraft.resources.ResourceLocation.DEFAULT_NAMESPACE)) { // Paper - Add missing structure set seed configs; check namespace cause datapacks could add structure sets with the same path
String name = holder.unwrapKey().orElseThrow().location().getPath(); String name = holder.unwrapKey().orElseThrow().location().getPath();
int seed = randomConfig.salt; int seed = randomConfig.salt;
@ -83,7 +83,7 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
case "villages": case "villages":
seed = conf.villageSeed; seed = conf.villageSeed;
break; break;
+ // Paper start + // Paper start - Add missing structure set seed configs
+ case "ancient_cities": + case "ancient_cities":
+ seed = conf.ancientCitySeed; + seed = conf.ancientCitySeed;
+ break; + break;
@ -93,11 +93,11 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
+ case "trial_chambers": + case "trial_chambers":
+ seed = conf.trialChambersSeed; + seed = conf.trialChambersSeed;
+ break; + break;
+ // Paper end + // Paper end - Add missing structure set seed configs
} }
- structureset = new StructureSet(structureset.structures(), new RandomSpreadStructurePlacement(randomConfig.locateOffset, randomConfig.frequencyReductionMethod, randomConfig.frequency, seed, randomConfig.exclusionZone, randomConfig.spacing(), randomConfig.separation(), randomConfig.spreadType())); - structureset = new StructureSet(structureset.structures(), new RandomSpreadStructurePlacement(randomConfig.locateOffset, randomConfig.frequencyReductionMethod, randomConfig.frequency, seed, randomConfig.exclusionZone, randomConfig.spacing(), randomConfig.separation(), randomConfig.spreadType()));
+ // Paper start + // Paper start - Add missing structure set seed configs
+ structureset = new StructureSet(structureset.structures(), new KeyedRandomSpreadStructurePlacement(holder.unwrapKey().orElseThrow(), randomConfig.locateOffset, randomConfig.frequencyReductionMethod, randomConfig.frequency, seed, randomConfig.exclusionZone, randomConfig.spacing(), randomConfig.separation(), randomConfig.spreadType())); + structureset = new StructureSet(structureset.structures(), new KeyedRandomSpreadStructurePlacement(holder.unwrapKey().orElseThrow(), randomConfig.locateOffset, randomConfig.frequencyReductionMethod, randomConfig.frequency, seed, randomConfig.exclusionZone, randomConfig.spacing(), randomConfig.separation(), randomConfig.spreadType()));
+ newHolder = Holder.direct(structureset); // I really wish we didn't have to do this here + newHolder = Holder.direct(structureset); // I really wish we didn't have to do this here
+ } else { + } else {
@ -105,7 +105,7 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
} }
- return Holder.direct(structureset); - return Holder.direct(structureset);
+ return newHolder; + return newHolder;
+ // Paper end + // Paper end - Add missing structure set seed configs
}).collect(Collectors.toUnmodifiableList()); }).collect(Collectors.toUnmodifiableList());
} }
// Spigot end // Spigot end
@ -114,13 +114,13 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
} }
- private ChunkGeneratorStructureState(RandomState noiseConfig, BiomeSource biomeSource, long structureSeed, long concentricRingSeed, List<Holder<StructureSet>> structureSets) { - private ChunkGeneratorStructureState(RandomState noiseConfig, BiomeSource biomeSource, long structureSeed, long concentricRingSeed, List<Holder<StructureSet>> structureSets) {
+ private ChunkGeneratorStructureState(RandomState noiseConfig, BiomeSource biomeSource, long structureSeed, long concentricRingSeed, List<Holder<StructureSet>> structureSets, SpigotWorldConfig conf) { // Paper + private ChunkGeneratorStructureState(RandomState noiseConfig, BiomeSource biomeSource, long structureSeed, long concentricRingSeed, List<Holder<StructureSet>> structureSets, SpigotWorldConfig conf) { // Paper - Add missing structure set seed configs
this.randomState = noiseConfig; this.randomState = noiseConfig;
this.levelSeed = structureSeed; this.levelSeed = structureSeed;
this.biomeSource = biomeSource; this.biomeSource = biomeSource;
this.concentricRingsSeed = concentricRingSeed; this.concentricRingsSeed = concentricRingSeed;
this.possibleStructureSets = structureSets; this.possibleStructureSets = structureSets;
+ this.conf = conf; // Paper + this.conf = conf; // Paper - Add missing structure set seed configs
} }
public List<Holder<StructureSet>> possibleStructureSets() { public List<Holder<StructureSet>> possibleStructureSets() {
@ -128,13 +128,13 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
HolderSet<Biome> holderset = placement.preferredBiomes(); HolderSet<Biome> holderset = placement.preferredBiomes();
RandomSource randomsource = RandomSource.create(); RandomSource randomsource = RandomSource.create();
+ // Paper start + // Paper start - Add missing structure set seed configs
+ if (this.conf.strongholdSeed != null && structureSetEntry.is(net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS)) { + if (this.conf.strongholdSeed != null && structureSetEntry.is(net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS)) {
+ randomsource.setSeed(this.conf.strongholdSeed); + randomsource.setSeed(this.conf.strongholdSeed);
+ } else { + } else {
+ // Paper end + // Paper end - Add missing structure set seed configs
randomsource.setSeed(this.concentricRingsSeed); randomsource.setSeed(this.concentricRingsSeed);
+ } // Paper + } // Paper - Add missing structure set seed configs
double d0 = randomsource.nextDouble() * 3.141592653589793D * 2.0D; double d0 = randomsource.nextDouble() * 3.141592653589793D * 2.0D;
int l = 0; int l = 0;
int i1 = 0; int i1 = 0;
@ -143,21 +143,21 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..5d3d9164a05efbecc59ace6175f449f3
for (int l = centerChunkX - chunkCount; l <= centerChunkX + chunkCount; ++l) { for (int l = centerChunkX - chunkCount; l <= centerChunkX + chunkCount; ++l) {
for (int i1 = centerChunkZ - chunkCount; i1 <= centerChunkZ + chunkCount; ++i1) { for (int i1 = centerChunkZ - chunkCount; i1 <= centerChunkZ + chunkCount; ++i1) {
- if (structureplacement.isStructureChunk(this, l, i1)) { - if (structureplacement.isStructureChunk(this, l, i1)) {
+ if (structureplacement.isStructureChunk(this, l, i1, structureplacement instanceof KeyedRandomSpreadStructurePlacement keyed ? keyed.key : null)) { // Paper - add missing structure set configs + if (structureplacement.isStructureChunk(this, l, i1, structureplacement instanceof KeyedRandomSpreadStructurePlacement keyed ? keyed.key : null)) { // Paper - Add missing structure set seed configs
return true; return true;
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java
index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795da00e682 100644 index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d762b67d2 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java --- a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java
@@ -59,10 +59,24 @@ public abstract class StructurePlacement { @@ -59,10 +59,24 @@ public abstract class StructurePlacement {
return this.exclusionZone; return this.exclusionZone;
} }
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add missing structure set seed configs
public boolean isStructureChunk(ChunkGeneratorStructureState calculator, int chunkX, int chunkZ) { public boolean isStructureChunk(ChunkGeneratorStructureState calculator, int chunkX, int chunkZ) {
+ // Paper start - add missing structure set configs + // Paper start - Add missing structure set seed configs
+ return this.isStructureChunk(calculator, chunkX, chunkZ, null); + return this.isStructureChunk(calculator, chunkX, chunkZ, null);
+ } + }
+ public boolean isStructureChunk(ChunkGeneratorStructureState calculator, int chunkX, int chunkZ, @org.jetbrains.annotations.Nullable net.minecraft.resources.ResourceKey<StructureSet> structureSetKey) { + public boolean isStructureChunk(ChunkGeneratorStructureState calculator, int chunkX, int chunkZ, @org.jetbrains.annotations.Nullable net.minecraft.resources.ResourceKey<StructureSet> structureSetKey) {
@ -169,11 +169,11 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795
+ saltOverride = calculator.conf.buriedTreasureSeed; + saltOverride = calculator.conf.buriedTreasureSeed;
+ } + }
+ } + }
+ // Paper end + // Paper end - Add missing structure set seed configs
if (!this.isPlacementChunk(calculator, chunkX, chunkZ)) { if (!this.isPlacementChunk(calculator, chunkX, chunkZ)) {
return false; return false;
- } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency)) { - } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency)) {
+ } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency, saltOverride)) { // Paper + } else if (this.frequency < 1.0F && !this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency, saltOverride)) { // Paper - Add missing structure set seed configs
return false; return false;
} else { } else {
return !this.exclusionZone.isPresent() || !this.exclusionZone.get().isPlacementForbidden(calculator, chunkX, chunkZ); return !this.exclusionZone.isPresent() || !this.exclusionZone.get().isPlacementForbidden(calculator, chunkX, chunkZ);
@ -182,35 +182,35 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795
public abstract StructurePlacementType<?> type(); public abstract StructurePlacementType<?> type();
- private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) { - private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - ignore here + private static boolean probabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
worldgenRandom.setLargeFeatureWithSalt(seed, salt, chunkX, chunkZ); worldgenRandom.setLargeFeatureWithSalt(seed, salt, chunkX, chunkZ);
return worldgenRandom.nextFloat() < frequency; return worldgenRandom.nextFloat() < frequency;
} }
- private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency) { - private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper + private static boolean legacyProbabilityReducerWithDouble(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
+ if (saltOverride == null) { // Paper + if (saltOverride == null) { // Paper - Add missing structure set seed configs
worldgenRandom.setLargeFeatureSeed(seed, chunkX, chunkZ); worldgenRandom.setLargeFeatureSeed(seed, chunkX, chunkZ);
+ // Paper start + // Paper start - Add missing structure set seed configs
+ } else { + } else {
+ worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride); + worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride);
+ } + }
+ // Paper end + // Paper end - Add missing structure set seed configs
return worldgenRandom.nextDouble() < (double)frequency; return worldgenRandom.nextDouble() < (double)frequency;
} }
- private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) { - private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper + private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
- worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, 10387320); - worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, 10387320);
+ worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride != null ? saltOverride : HIGHLY_ARBITRARY_RANDOM_SALT); // Paper + worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride != null ? saltOverride : HIGHLY_ARBITRARY_RANDOM_SALT); // Paper - Add missing structure set seed configs
return worldgenRandom.nextFloat() < frequency; return worldgenRandom.nextFloat() < frequency;
} }
- private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) { - private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) {
+ private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - ignore here + private static boolean legacyPillagerOutpostReducer(long seed, int salt, int chunkX, int chunkZ, float frequency, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here
int i = chunkX >> 4; int i = chunkX >> 4;
int j = chunkZ >> 4; int j = chunkZ >> 4;
WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L));
@ -219,7 +219,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795
@FunctionalInterface @FunctionalInterface
public interface FrequencyReducer { public interface FrequencyReducer {
- boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance); - boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance);
+ boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride); // Paper + boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride); // Paper - Add missing structure set seed configs
} }
public static enum FrequencyReductionMethod implements StringRepresentable { public static enum FrequencyReductionMethod implements StringRepresentable {
@ -229,8 +229,8 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795
- public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance) { - public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance) {
- return this.reducer.shouldGenerate(seed, salt, chunkX, chunkZ, chance); - return this.reducer.shouldGenerate(seed, salt, chunkX, chunkZ, chance);
+ public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper + public boolean shouldGenerate(long seed, int salt, int chunkX, int chunkZ, float chance, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs
+ return this.reducer.shouldGenerate(seed, salt, chunkX, chunkZ, chance, saltOverride); // Paper + return this.reducer.shouldGenerate(seed, salt, chunkX, chunkZ, chance, saltOverride); // Paper - Add missing structure set seed configs
} }
@Override @Override

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
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 999602a6c11257b05083bcc2d36b6e30b2b129f4..d41cd3075a5f59f271ddee7009a3ed26a34d3041 100644 index 999602a6c11257b05083bcc2d36b6e30b2b129f4..cf43f2e7bfc465c1c804daa5d86a6ce1808d8041 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
@@ -144,6 +144,7 @@ import org.jetbrains.annotations.NotNull; @@ -144,6 +144,7 @@ import org.jetbrains.annotations.NotNull;
@ -91,7 +91,7 @@ index 999602a6c11257b05083bcc2d36b6e30b2b129f4..d41cd3075a5f59f271ddee7009a3ed26
+ } + }
+ serverChunkCache.getLightEngine().relight(chunksToRelight, pos -> {}, relit -> {}); + serverChunkCache.getLightEngine().relight(chunksToRelight, pos -> {}, relit -> {});
+ return true; + return true;
+ // Paper end + // Paper end - implement regenerate chunk method
} }
@Override @Override

View File

@ -8,7 +8,7 @@ snow bucket didn't revert grass that became snowy because of the
placement. placement.
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 fdcec8496abda362e611b42ef054ea730f47f408..8cf7d514803fd953e068d3436bfd4e50fb4b0da0 100644 index fdcec8496abda362e611b42ef054ea730f47f408..8c839dc64b0a0271d7b19ee03a8144cf6224d4b2 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
@@ -379,7 +379,7 @@ public final class ItemStack { @@ -379,7 +379,7 @@ public final class ItemStack {
@ -16,7 +16,7 @@ index fdcec8496abda362e611b42ef054ea730f47f408..8cf7d514803fd953e068d3436bfd4e50
ServerLevel world = (ServerLevel) context.getLevel(); ServerLevel world = (ServerLevel) context.getLevel();
- if (!(item instanceof BucketItem || item instanceof SolidBucketItem)) { // if not bucket - if (!(item instanceof BucketItem || item instanceof SolidBucketItem)) { // if not bucket
+ if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets + if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - Fix cancelled powdered snow bucket placement
world.captureBlockStates = true; world.captureBlockStates = true;
// special case bonemeal // special case bonemeal
if (item == Items.BONE_MEAL) { if (item == Items.BONE_MEAL) {
@ -25,7 +25,7 @@ index fdcec8496abda362e611b42ef054ea730f47f408..8cf7d514803fd953e068d3436bfd4e50
if (blocks.size() > 1) { if (blocks.size() > 1) {
placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ()); placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, enumhand, blocks, blockposition.getX(), blockposition.getY(), blockposition.getZ());
- } else if (blocks.size() == 1) { - } else if (blocks.size() == 1) {
+ } else if (blocks.size() == 1 && item != Items.POWDER_SNOW_BUCKET) { // Paper - don't call event twice for snow buckets + } else if (blocks.size() == 1 && item != Items.POWDER_SNOW_BUCKET) { // Paper - Fix cancelled powdered snow bucket placement
placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ()); placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, enumhand, blocks.get(0), blockposition.getX(), blockposition.getY(), blockposition.getZ());
} }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit
Copies appropriate checks from CraftWorld#getSpawnLimit Copies appropriate checks from CraftWorld#getSpawnLimit
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 3aa82952cfd0415288b434a6462123504e4dab99..64224332b7e037330e87d96445a56afebb1e81a2 100644 index d53abb73ab61151a14baef8ce5cdf40ff8709238..bafdb900286c9015840aa74e8a84493bdaf8eaa2 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
@@ -2287,6 +2287,8 @@ public final class CraftServer implements Server { @@ -2287,6 +2287,8 @@ public final class CraftServer implements Server {

View File

@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4f
+ } + }
+} +}
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 64224332b7e037330e87d96445a56afebb1e81a2..a3eaa58625d96df5beb00b69b0c7c902f63865db 100644 index bafdb900286c9015840aa74e8a84493bdaf8eaa2..d96450c5b83bf785cdb24ca1c2653e642be9302d 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
@@ -2708,6 +2708,15 @@ public final class CraftServer implements Server { @@ -2708,6 +2708,15 @@ public final class CraftServer implements Server {
@ -74,8 +74,8 @@ index 64224332b7e037330e87d96445a56afebb1e81a2..a3eaa58625d96df5beb00b69b0c7c902
+ Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class); + Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class);
+ net.minecraft.core.Registry<net.minecraft.world.level.gameevent.GameEvent> gameEvents = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT; + net.minecraft.core.Registry<net.minecraft.world.level.gameevent.GameEvent> gameEvents = net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT;
+ return gameEvents.getTags().map(pair -> (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList()); + return gameEvents.getTags().map(pair -> (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList());
+ // Paper end
+ } + }
+ // Paper end
default -> throw new IllegalArgumentException(); default -> throw new IllegalArgumentException();
} }
} }

View File

@ -9,7 +9,7 @@ This might result in chunks loading far slower in the nether,
for example. for example.
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 ac4d96345c985284a1306055b164a74a483cb444..396cbd1a0a94e913475bad65faf8e871b7105895 100644 index 70adb35d0f267666e44c61ac0578a12f107f65b7..5799fd10f6dc95057f0ac9bf69931ee56ff62d90 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
@@ -1416,6 +1416,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1416,6 +1416,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -7,19 +7,19 @@ Subject: [PATCH] Configurable sculk sensor listener range
public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java
index a18589425006ccabd87b76a9827ab516040009bb..fb1c47a17c2fe3807ed54fd2b2bb17c2fe28b901 100644 index a18589425006ccabd87b76a9827ab516040009bb..c26492942c854ea311da2369b51692dbbc06e050 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CalibratedSculkSensorBlockEntity.java
@@ -19,6 +19,12 @@ public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity { @@ -19,6 +19,12 @@ public class CalibratedSculkSensorBlockEntity extends SculkSensorBlockEntity {
public VibrationSystem.User createVibrationUser() { public VibrationSystem.User createVibrationUser() {
return new CalibratedSculkSensorBlockEntity.VibrationUser(this.getBlockPos()); return new CalibratedSculkSensorBlockEntity.VibrationUser(this.getBlockPos());
} }
+ // Paper start + // Paper start - Configurable sculk sensor listener range
+ @Override + @Override
+ protected void saveRangeOverride(final net.minecraft.nbt.CompoundTag nbt) { + protected void saveRangeOverride(final net.minecraft.nbt.CompoundTag nbt) {
+ if (this.rangeOverride != null && this.rangeOverride != 16) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default + if (this.rangeOverride != null && this.rangeOverride != 16) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default
+ } + }
+ // Paper end + // Paper end - Configurable sculk sensor listener range
protected class VibrationUser extends SculkSensorBlockEntity.VibrationUser { protected class VibrationUser extends SculkSensorBlockEntity.VibrationUser {
public VibrationUser(BlockPos pos) { public VibrationUser(BlockPos pos) {
@ -27,19 +27,19 @@ index a18589425006ccabd87b76a9827ab516040009bb..fb1c47a17c2fe3807ed54fd2b2bb17c2
@Override @Override
public int getListenerRadius() { public int getListenerRadius() {
+ if (CalibratedSculkSensorBlockEntity.this.rangeOverride != null) return CalibratedSculkSensorBlockEntity.this.rangeOverride; // Paper + if (CalibratedSculkSensorBlockEntity.this.rangeOverride != null) return CalibratedSculkSensorBlockEntity.this.rangeOverride; // Paper - Configurable sculk sensor listener range
return 16; return 16;
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
index a6c226da995eecc323d69a3eff1f8d202410e069..5d3740875de337e24fdba28305f61e96d01c457f 100644 index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483fd64c5590 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
@@ -24,6 +24,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList @@ -24,6 +24,7 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
private final VibrationSystem.Listener vibrationListener; private final VibrationSystem.Listener vibrationListener;
private final VibrationSystem.User vibrationUser = this.createVibrationUser(); private final VibrationSystem.User vibrationUser = this.createVibrationUser();
public int lastVibrationFrequency; public int lastVibrationFrequency;
+ @Nullable public Integer rangeOverride = null; // Paper + @Nullable public Integer rangeOverride = null; // Paper - Configurable sculk sensor listener range
protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) { protected SculkSensorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state); super(type, pos, state);
@ -47,17 +47,17 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..5d3740875de337e24fdba28305f61e96
this.vibrationData = listener; this.vibrationData = listener;
}); });
} }
+ // Paper start + // Paper start - Configurable sculk sensor listener range
+ if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) { + if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) {
+ this.rangeOverride = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY); + this.rangeOverride = nbt.getInt(PAPER_LISTENER_RANGE_NBT_KEY);
+ } else { + } else {
+ this.rangeOverride = null; + this.rangeOverride = null;
+ } + }
+ // Paper end + // Paper end - Configurable sculk sensor listener range
} }
+ protected static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper + protected static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper - Configurable sculk sensor listener range
@Override @Override
protected void saveAdditional(CompoundTag nbt) { protected void saveAdditional(CompoundTag nbt) {
super.saveAdditional(nbt); super.saveAdditional(nbt);
@ -65,13 +65,13 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..5d3740875de337e24fdba28305f61e96
VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> {
nbt.put("listener", listenerNbt); nbt.put("listener", listenerNbt);
}); });
+ this.saveRangeOverride(nbt); // Paper + this.saveRangeOverride(nbt); // Paper - Configurable sculk sensor listener range
+ } + }
+ // Paper start + // Paper start - Configurable sculk sensor listener range
+ protected void saveRangeOverride(CompoundTag nbt) { + protected void saveRangeOverride(CompoundTag nbt) {
+ if (this.rangeOverride != null && this.rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default + if (this.rangeOverride != null && this.rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default
} }
+ // Paper end + // Paper end - Configurable sculk sensor listener range
@Override @Override
public VibrationSystem.Data getVibrationData() { public VibrationSystem.Data getVibrationData() {
@ -79,7 +79,7 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..5d3740875de337e24fdba28305f61e96
@Override @Override
public int getListenerRadius() { public int getListenerRadius() {
+ if (SculkSensorBlockEntity.this.rangeOverride != null) return SculkSensorBlockEntity.this.rangeOverride; // Paper + if (SculkSensorBlockEntity.this.rangeOverride != null) return SculkSensorBlockEntity.this.rangeOverride; // Paper - Configurable sculk sensor listener range
return 8; return 8;
} }

View File

@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior. is one level below that. Defaults to off to keep vanilla behavior.
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 396cbd1a0a94e913475bad65faf8e871b7105895..41fae37f785191fa3314fcc5724c9b31ef953816 100644 index 5799fd10f6dc95057f0ac9bf69931ee56ff62d90..27ef9e114f2951c0874e853ba866c6e27fc531cc 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
@@ -623,7 +623,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -623,7 +623,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -7,7 +7,7 @@ Some parts of legacy conversion will need the overworld
to get the legacy structure data storage to get the legacy structure data storage
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 41fae37f785191fa3314fcc5724c9b31ef953816..15828a88b8b31f4b622a1395eda5cc195d616479 100644 index 27ef9e114f2951c0874e853ba866c6e27fc531cc..db7345c936816c4bea12969853cf743c028b972c 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
@@ -635,9 +635,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -635,9 +635,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -23,7 +23,7 @@ index 41fae37f785191fa3314fcc5724c9b31ef953816..15828a88b8b31f4b622a1395eda5cc19
if (worlddata.getCustomBossEvents() != null) { if (worlddata.getCustomBossEvents() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a3eaa58625d96df5beb00b69b0c7c902f63865db..546b510e8ed683007c1dbcc1ab66374ce0944e70 100644 index d96450c5b83bf785cdb24ca1c2653e642be9302d..1225d688d18c0c660d0d229a5f6ef9ef7ab72c54 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
@@ -1288,10 +1288,11 @@ public final class CraftServer implements Server { @@ -1288,10 +1288,11 @@ public final class CraftServer implements Server {

View File

@ -9,7 +9,7 @@ This excludes hanging entities, as this fix caused problematic behavior due to t
position field. position field.
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 0cbb5dd17c5b37ad90ce11a31b64470722026d06..ff57dbd34874e020edd7074c71cfa635eab0287b 100644 index e9fd9590e90e58fd4c31985a704a4511b2663096..78145f8dc50c64b1650bfa7e3ef867ca96f29ca9 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -171,7 +171,7 @@ public class ServerEntity { @@ -171,7 +171,7 @@ public class ServerEntity {

View File

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..7ea357ac2f3a93db4ebdf24b5072be7d
+ } + }
+} +}
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 15828a88b8b31f4b622a1395eda5cc195d616479..e5dccd330cbf3301a60b65453e87a4005f954716 100644 index db7345c936816c4bea12969853cf743c028b972c..c1ef4dd08b39adf3ab8dbfe286c6378f3efbf54e 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
@@ -2213,6 +2213,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2213,6 +2213,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -172,7 +172,7 @@ index 424406d2692856cfd82b6f3b7b6228fa3bd20c2f..bc01481ac5990ad1cfd1def5a16dd0ed
@Override @Override
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 546b510e8ed683007c1dbcc1ab66374ce0944e70..ead1161020064ceea6d04857de5bdbce460fd59e 100644 index 1225d688d18c0c660d0d229a5f6ef9ef7ab72c54..21c9bfd9d9fd76e2a1b41001ea0f726d7b784309 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
@@ -304,6 +304,7 @@ public final class CraftServer implements Server { @@ -304,6 +304,7 @@ public final class CraftServer implements Server {

View File

@ -11,7 +11,7 @@ Restores the API behavior from previous versions of the server
public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V public net.minecraft.world.entity.item.FallingBlockEntity <init>(Lnet/minecraft/world/level/Level;DDDLnet/minecraft/world/level/block/state/BlockState;)V
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 d41cd3075a5f59f271ddee7009a3ed26a34d3041..3cf9aafb3ce75c0340605fa29c2a55ff237b843b 100644 index cf43f2e7bfc465c1c804daa5d86a6ce1808d8041..5e31aa4383113b586b9ce440f121cb65045bf70a 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
@@ -1453,7 +1453,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1453,7 +1453,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -7,7 +7,7 @@ Bring the vehicle move packet behavior in line with the
regular player move packet. regular player move packet.
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 554b0cd2f61005b57e1b0f68730354a8753fb0b7..33356ffc634549560adc24c40e58152e5482949d 100644 index 027bc0d89b7ade602565ed3717e87c56de7265e1..a7e02f7b294795d7cac6df3a95658cf63f2fdb38 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
@@ -465,6 +465,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -465,6 +465,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix saving in unloadWorld
Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true
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 ead1161020064ceea6d04857de5bdbce460fd59e..8802d28c71d3ebc74690ad5c53c7dd77436e1a9f 100644 index 21c9bfd9d9fd76e2a1b41001ea0f726d7b784309..7da2853b86a1e3cd7d1e3c985448727e04542f4f 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
@@ -1336,7 +1336,7 @@ public final class CraftServer implements Server { @@ -1336,7 +1336,7 @@ public final class CraftServer implements Server {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity
Bad plugins doing this would cause some obvious problems... Bad plugins doing this would cause some obvious problems...
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 2f0c5e1b4b2dfb8006447c296170e80a97b36562..cc90b96ae9709c7f3997dc1524bcf0feeb00c864 100644 index e10b08802cb170a0af8a3cfc01e730e32e6ca0f3..ca145fee91adb669665c881f150a339a773b28cb 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
@@ -2847,7 +2847,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2847,7 +2847,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Guard against invalid entity positions
Anything not finite should be blocked and logged Anything not finite should be blocked and logged
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 cc90b96ae9709c7f3997dc1524bcf0feeb00c864..ab409aae677a5ed4ca50113e88397c4543373df8 100644 index ca145fee91adb669665c881f150a339a773b28cb..64a1dc13690568baba60dddc6f66a1700f618e51 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
@@ -4539,11 +4539,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4539,11 +4539,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

View File

@ -9,7 +9,7 @@ is not a WorldGenRegion, we can bypass the deadlock entirely.
See https://bugs.mojang.com/browse/MC-246262 See https://bugs.mojang.com/browse/MC-246262
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
index b2139e5f7a051cdea2a7ed6e98ba8be7ce1113cc..0540929bd362b266295ea6770ce2fb351b614463 100644 index be8aab51a1b92a3a0cc94976975fc3aabc46f0b4..ae8a42261337bf736d0cc1bbe18da2b773417ca4 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
@@ -279,7 +279,11 @@ public class StructureTemplate { @@ -279,7 +279,11 @@ public class StructureTemplate {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
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 33356ffc634549560adc24c40e58152e5482949d..5a2f8806366e3a423e77e882dbc9068ad64ff538 100644 index a7e02f7b294795d7cac6df3a95658cf63f2fdb38..ecd3ce99d01bc2367ffadaab41f237c4f3516a28 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
@@ -3197,7 +3197,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3197,7 +3197,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -18,7 +18,7 @@ index e69a0121c8644d831cbb8bc1c95d9219d1c343da..7d33ce8d68ca55e0fd37d2d4e3c78a43
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
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 5a2f8806366e3a423e77e882dbc9068ad64ff538..9ce9390291988e3110e228e83e0754e5529de800 100644 index ecd3ce99d01bc2367ffadaab41f237c4f3516a28..93ac02c915455f688062f9ef721f2cea7f91a09d 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
@@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2761,7 +2761,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -167,7 +167,7 @@ index 2a480026c3bfb06e6556fe5b11d9712c8e02debe..dd03426943dd380cefe12afe3e63c318
this.onChanged(server); this.onChanged(server);
} }
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 3cf9aafb3ce75c0340605fa29c2a55ff237b843b..c517d8e2daac5675425783a50ae04b5d2a07e37a 100644 index 5e31aa4383113b586b9ce440f121cb65045bf70a..b504bdd02041f4fe7a7ed4ed9d8563cd9b338125 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
@@ -2038,7 +2038,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2038,7 +2038,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expand PlayerItemDamageEvent
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 8cf7d514803fd953e068d3436bfd4e50fb4b0da0..6b38e515a77df7fb06b41fbedaa1090b1cac78fb 100644 index 8c839dc64b0a0271d7b19ee03a8144cf6224d4b2..66bb955bb338e4d1689daace28ebe295b6884554 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
@@ -638,10 +638,11 @@ public final class ItemStack { @@ -638,10 +638,11 @@ public final class ItemStack {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded
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 8802d28c71d3ebc74690ad5c53c7dd77436e1a9f..170da30329f2a0d65a05c0d5c7a4170405df6aef 100644 index 7da2853b86a1e3cd7d1e3c985448727e04542f4f..b76bb0142cbe64064f7835807974414c879f57a5 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
@@ -1283,7 +1283,7 @@ public final class CraftServer implements Server { @@ -1283,7 +1283,7 @@ public final class CraftServer implements Server {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent
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 e27b19cf56b269c426cb6ddf81513497b70c676f..546777ad955d0d317d129882cfeab68935708228 100644 index 31ee19d5740d74418cb4d42d0ce78a0a7cb51e0a..e94084b1f0fb04625cb94ca07825b8f78c0c9012 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
@@ -4025,6 +4025,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -4025,6 +4025,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Do not accept invalid client settings
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 9ce9390291988e3110e228e83e0754e5529de800..aba06bae97f021d9f62441eb662539a0bbc815ef 100644 index 93ac02c915455f688062f9ef721f2cea7f91a09d..b97394a20d1308f254252adfd10eff018c594d6e 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
@@ -3321,6 +3321,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3321,6 +3321,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups
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 ab409aae677a5ed4ca50113e88397c4543373df8..e5f4388d531910c238fcd809a1c5d92267858c53 100644 index 64a1dc13690568baba60dddc6f66a1700f618e51..d5cc94219976e3832617210e0aa3b773f3eca432 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
@@ -803,6 +803,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -803,6 +803,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

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 e5dccd330cbf3301a60b65453e87a4005f954716..b9df0b37b5568758c04ee41e258395c3a2d493c1 100644 index c1ef4dd08b39adf3ab8dbfe286c6378f3efbf54e..4d4617635c9dc0d011cf8fc57ece6e2300573bad 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
@ -45,7 +45,7 @@ index e5dccd330cbf3301a60b65453e87a4005f954716..b9df0b37b5568758c04ee41e258395c3
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 170da30329f2a0d65a05c0d5c7a4170405df6aef..e549dc84ac05a8b5f4dc602689904eb92445c687 100644 index b76bb0142cbe64064f7835807974414c879f57a5..a12267638500fe5a20f46fb8e0b93c250227c273 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

@ -20,7 +20,7 @@ index c56f5173fda6b38c2dcaea196217f2f5a7d7c641..524b0f1086c01888fe0b76e180c40915
Date date = new Date(); Date date = new Date();
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 e549dc84ac05a8b5f4dc602689904eb92445c687..3aae0cce193777cd64124a87f43645207c5f6743 100644 index a12267638500fe5a20f46fb8e0b93c250227c273..69ae0f5d0a398f7e2509697e8de95a2a82ec15ef 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
@@ -1873,7 +1873,7 @@ public final class CraftServer implements Server { @@ -1873,7 +1873,7 @@ public final class CraftServer implements Server {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls
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 e5f4388d531910c238fcd809a1c5d92267858c53..549a0144e3c6ef267afeb665059bce0f6eac360e 100644 index d5cc94219976e3832617210e0aa3b773f3eca432..10d681e95b8e9cc432ed43930d76da19bfd4fc29 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
@@ -2699,6 +2699,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2699,6 +2699,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Some files were not shown because too many files have changed in this diff Show More