A bunch more 637

This commit is contained in:
Shane Freeder 2024-10-23 21:10:14 +01:00
parent cbf64163ba
commit 6456b5dea8
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
42 changed files with 128 additions and 128 deletions

View File

@ -5,16 +5,17 @@ Subject: [PATCH] Option to prevent data components copy in smithing recipes
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
index fa003ce16020eaab554bfd833ace779c8cefc617..d432b91b4051036d8b339a6418cdbce5c371bc1b 100644
index fa003ce16020eaab554bfd833ace779c8cefc617..017748b26590364d846a5cddaa3490b2293ad276 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
@@ -30,8 +30,14 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@@ -30,8 +30,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
final ItemStack result;
@Nullable
private PlacementInfo placementInfo;
+ final boolean copyDataComponents; // Paper - Option to prevent data components copy
public SmithingTransformRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition, ItemStack result) {
+ // Paper start - Option to prevent data components copy
+ this(template, base, addition, result, true);
+ }
+ public SmithingTransformRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition, ItemStack result, boolean copyDataComponents) {
@ -23,7 +24,7 @@ index fa003ce16020eaab554bfd833ace779c8cefc617..d432b91b4051036d8b339a6418cdbce5
this.template = template;
this.base = base;
this.addition = addition;
@@ -41,7 +47,9 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@@ -41,7 +48,9 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) {
ItemStack itemstack = input.base().transmuteCopy(this.result.getItem(), this.result.getCount());
@ -33,7 +34,7 @@ index fa003ce16020eaab554bfd833ace779c8cefc617..d432b91b4051036d8b339a6418cdbce5
return itemstack;
}
@@ -84,7 +92,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@@ -84,7 +93,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public Recipe toBukkitRecipe(NamespacedKey id) {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);

View File

@ -5,19 +5,10 @@ Subject: [PATCH] Fix issues with mob conversion
diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
index 6f6454bcec7e0d1cefbf818fc2fc6eb90adeec83..6d176ab1eee654411918e0ee64306d280c7ae816 100644
index 6f6454bcec7e0d1cefbf818fc2fc6eb90adeec83..3972e2ed0554e2550519e994888e068df0a151e5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
@@ -16,6 +16,8 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityTransformEvent;
public class Skeleton extends AbstractSkeleton {
@@ -94,12 +96,19 @@ public class Skeleton extends AbstractSkeleton {
@@ -94,12 +94,19 @@ public class Skeleton extends AbstractSkeleton {
}
protected void doFreezeConversion() {
@ -28,7 +19,7 @@ index 6f6454bcec7e0d1cefbf818fc2fc6eb90adeec83..6d176ab1eee654411918e0ee64306d28
}
- }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
+ }, EntityTransformEvent.TransformReason.FROZEN, CreatureSpawnEvent.SpawnReason.FROZEN);// CraftBukkit - add spawn and transform reasons
+ }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN);// CraftBukkit - add spawn and transform reasons
+
+ // Paper start - Fix issues with mob conversion; reset conversion time to prevent event spam
+ if (stray == null) {

View File

@ -257,11 +257,11 @@ index 0000000000000000000000000000000000000000..d3b39d88a72ca25057fd8574d32f28db
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 58ea6a1f95a09c22125a8262b1b221004ebce0e4..ea6533c1ac218aa075da3401807a06fcb7892321 100644
index 485c6044d603f15878f9413a644a538dab68db3e..6eb69ebe688c1c52d5a5986dfc63cdd42e66687e 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -152,6 +152,16 @@ public final class NaturalSpawner {
world.getProfiler().pop();
@@ -174,6 +174,16 @@ public final class NaturalSpawner {
gameprofilerfiller.pop();
}
+ // Paper start - Add mobcaps commands
@ -278,10 +278,10 @@ index 58ea6a1f95a09c22125a8262b1b221004ebce0e4..ea6533c1ac218aa075da3401807a06fc
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 36a1b2704debdb8a2f247180d263a1a95bcba24b..b638ccf0e46eeb375a59a42d6f29edd3f084fa17 100644
index 35e5a3dc58f93b85f93ec5301cc9b5c7505503bc..f69504676d2f48f3778f489ec1e08e2b3dec85cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2331,6 +2331,11 @@ public final class CraftServer implements Server {
@@ -2335,6 +2335,11 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {
@ -294,10 +294,10 @@ index 36a1b2704debdb8a2f247180d263a1a95bcba24b..b638ccf0e46eeb375a59a42d6f29edd3
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index bf4be21f24af1e569267be6413dbee533c153fc5..838ffddba99964748dfe95d68ca93b578bc3292b 100644
index 890d3b648b1b991e351538088c06ed93686e35f5..0e5b673cee93525c1ba87d5b5e48def351ce8db8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1718,9 +1718,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1728,9 +1728,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Manually inline methods in BlockPosition
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 73d7b5148e3a92c085b08303589827a6f0ae8d07..12ff8886bb53ca15db745989c25b9bd2f45335e4 100644
index eea8bea0f40db8d36c59e628babf788fa920df94..0d51fb4be8b49e3b57c3c55aff6bcf13d5c78ddd 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -570,9 +570,9 @@ public class BlockPos extends Vec3i {
@@ -576,9 +576,9 @@ public class BlockPos extends Vec3i {
}
public BlockPos.MutableBlockPos set(int x, int y, int z) {
@ -21,7 +21,7 @@ index 73d7b5148e3a92c085b08303589827a6f0ae8d07..12ff8886bb53ca15db745989c25b9bd2
return this;
}
@@ -637,19 +637,19 @@ public class BlockPos extends Vec3i {
@@ -643,19 +643,19 @@ public class BlockPos extends Vec3i {
@Override
public BlockPos.MutableBlockPos setX(int i) {
@ -45,7 +45,7 @@ index 73d7b5148e3a92c085b08303589827a6f0ae8d07..12ff8886bb53ca15db745989c25b9bd2
}
diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java
index df4c9b275752ad97a4efe9380ae0d511ee760695..02367ef1371dde94ff6c4cd40bd32e800d6ccaaf 100644
index 7d5f99cac756c54e5922bf85d5d359edcc21f1e8..2f2bcc1b9b32e58bf70ae6c171177ceb333ed6cd 100644
--- a/src/main/java/net/minecraft/core/Vec3i.java
+++ b/src/main/java/net/minecraft/core/Vec3i.java
@@ -16,9 +16,9 @@ public class Vec3i implements Comparable<Vec3i> {

View File

@ -10,7 +10,7 @@ chunks did get inlined, but the standard CPS.getChunkAt
method was not inlined.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 20a14b4163807b806bf2ce5a88d3c35098bed929..b4111bcc6a676dc42b233761aa667708669c2ab8 100644
index 560777a99b58c4f82cc0e8fb087de04a564163b5..8269bf24f5e17f9e3936659aa0cbc9d4f95fb665 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -352,7 +352,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

View File

@ -8,7 +8,7 @@ Lighting is purged on update anyways, so let's not add more
into the conversion process
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index 9aa9ab894080a5819fc45698771afd034906d36a..f0f5e9bb5ac65250f0a151f9f90b58468335a8c2 100644
index 909acbf5b8c6edcb4529647c11464d911d6f8c15..7d5e2e6e96ea9017334dddade54a9dcb37518642 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -47,6 +47,7 @@ public class ChunkStorage implements AutoCloseable {

View File

@ -11,10 +11,10 @@ easy win. The remaining problems with this function
are mostly with the block getting itself.
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index c3760e0c8ac0b3ea200f4e1c237e250137a78caf..c978f3b2d42f512e982f289e76c2422e41b7eec6 100644
index 8e58efd0d8010a3499a1eb1add9fa976aa2b0a3e..cc9ae2122b563d7b583c7335d0a8ce227f9b1af4 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -79,7 +79,8 @@ public interface BlockGetter extends LevelHeightAccessor {
@@ -80,7 +80,8 @@ public interface BlockGetter extends LevelHeightAccessor {
return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo()));
}
// Paper end - Prevent raytrace from loading chunks

View File

@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d91279f3bd009e1542e73354aadd6a16c80965e2..071e9ef3680c5dc492c6142ccd05f6788ebc3035 100644
index 8121f7f5fb4dadb1c929b3d81121e3649981bfac..7f18146c0dea654c62b3e01e6848fd1c05f87946 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1461,7 +1461,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1520,7 +1520,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity;
private final int range;
SectionPos lastSectionPos;

View File

@ -7,10 +7,10 @@ Apparently the abstract block iteration was taking about
75% of the method call.
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index 529f9f57249bd1ffa2698da76ffa9d4a284088db..d59e33e7326489c6d55d316d0130f22235f4c63c 100644
index a87f8345aa5520a867a8dd769b43526b20b8c16a..c3dba0c2c94f3804338f86621dc42405e380a6b3 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -152,19 +152,28 @@ public class FarmBlock extends Block {
@@ -154,19 +154,28 @@ public class FarmBlock extends Block {
}
private static boolean isNearWater(LevelReader world, BlockPos pos) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dba04a8de93b9afe8b51e473de9e1d485c93987e..a473993ea48afd05a884e3ffcbdd15abe74580d2 100644
index cf2b5de61eae020513c50e0903637c55b711fd1b..0fbd077c1d3dddc97c8c99effa936470562b02a4 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2247,6 +2247,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2328,6 +2328,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 926c0a5f4eaaa8fb650905216d2303fb476d3fa5..1e806fd16ca5f90bdb4f71dea008d7936eb82562 100644
index 020aed78c0eb1fdb9fd0d633bf2fe45bb9eb7532..7b858178ce7d0e33fec17311f1710bead5f0837d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -748,6 +748,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -752,6 +752,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// CraftBukkit end

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Ensure valid vehicle status
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6648af4d8d795637fae444dc85803b399592fd7d..25ca370c0b19eca529fc2c980c50e899013f0897 100644
index d2fbbdbb451d6c54d847b4ba125397ad41c4f7b4..f72ab5e4e743cb0758ebca28e81f97c143c91b42 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -574,7 +574,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@@ -698,7 +698,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
}
- if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger()) {
+ if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger() && !entity.isRemoved()) { // Paper - Ensure valid vehicle status
// CraftBukkit end
CompoundTag nbttagcompound1 = new CompoundTag();
CompoundTag nbttagcompound2 = new CompoundTag();
CompoundTag nbttagcompound3 = new CompoundTag();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 460744ec3a1abe9a2d9d16c2ec521c52c7f8db95..98d1c097fdbbc8080624f365634e0812a5eea5ac 100644
index 3d1a49d865e17a61ff74c6fe0efbd908447ee730..8d0014b0db5ab42321150938fef98458fee84b17 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -468,6 +468,11 @@ public class EndDragonFight {
@@ -469,6 +469,11 @@ public class EndDragonFight {
}
}

View File

@ -10,7 +10,7 @@ chunk bans via the large amount of NBT created by unstacking the items.
Fixes GH-5140 and GH-4748.
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
index b231f90317fe7df9133674b12d47873520b481cb..edaf7f1692ae059581f3abc24bb228874e6d114b 100644
index 4d4d413b8527e1a109276928611b8c857ad6f6aa..c2bded5094097f5615a2ddb0718942486ede93b5 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
@@ -72,9 +72,10 @@ public class LootTable {

View File

@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f21bf6c8bbf30c59f1588c2105dbd7f80c07a0f1..e34260c80d19869c9bec5ba67f7ce7db9d13a1f1 100644
index 92c743a354e95c8e12fc21673ee172aed07fe1fb..b54dcebbd5d2f920efcf91ff2de485493dd2f487 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1844,6 +1844,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1914,6 +1914,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
@ -19,7 +19,7 @@ index f21bf6c8bbf30c59f1588c2105dbd7f80c07a0f1..e34260c80d19869c9bec5ba67f7ce7db
}
public void absMoveTo(double x, double y, double z) {
@@ -1886,6 +1887,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1956,6 +1957,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setXRot(pitch);
this.setOldPosAndRot();
this.reapplyPosition();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] prevent unintended light block manipulation
diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java
index 01722473a4861533dba0ab6edf3982c0278c41e1..2b3c395529a15c9f07a4c0cff7f82199298bcb6d 100644
index 6c3ca57a29d3c5ad1add1cf2f707b930dfc422ea..71a1a152dca41ba9100bd38efd6758a42bab9f5d 100644
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
@@ -49,6 +49,14 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
@@ -50,6 +50,14 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
builder.add(LEVEL, WATERLOGGED);
}

View File

@ -13,10 +13,10 @@ the material type of the block at that location.
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 48bee70ba4188a4a55beb6584224b0f23784dd88..cbb777f499a4e8a447153c04d09c0c71321c663c 100644
index 46a831f86b512f4228be8ccee40fb0f7bf0d6df6..3de01d92e1c97e287a1f0d1f8de81b4f530b4a84 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -387,7 +387,7 @@ public abstract class BlockEntity {
@@ -388,7 +388,7 @@ public abstract class BlockEntity {
// Paper end
if (this.level == null) return null;
org.bukkit.block.Block block = this.level.getWorld().getBlockAt(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
@ -56,7 +56,7 @@ index 80bd6e8a6dadb74356a9fa9aa394efbd31c49c37..fe7e3e0628783d8d1be9635b689da8a9
// Paper start
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c850bdb75f 100644
index 1a8dcde39a252a45046866349b848d79e1b13260..56453454cbd4b9e9270fc833f8ab38d5fa7a3763 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -22,6 +22,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
@ -67,7 +67,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
import net.minecraft.world.level.block.entity.BrewingStandBlockEntity;
import net.minecraft.world.level.block.entity.BrushableBlockEntity;
import net.minecraft.world.level.block.entity.CalibratedSculkSensorBlockEntity;
@@ -87,9 +88,9 @@ public final class CraftBlockStates {
@@ -88,9 +89,9 @@ public final class CraftBlockStates {
private static class BlockEntityStateFactory<T extends BlockEntity, B extends CraftBlockEntityState<T>> extends BlockStateFactory<B> {
private final BiFunction<World, T, B> blockStateConstructor;
@ -79,7 +79,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
super(blockStateType);
this.blockStateConstructor = blockStateConstructor;
this.tileEntityConstructor = tileEntityConstructor;
@@ -106,7 +107,7 @@ public final class CraftBlockStates {
@@ -107,7 +108,7 @@ public final class CraftBlockStates {
}
private T createTileEntity(BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData) {
@ -88,7 +88,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
}
private B createBlockState(World world, T tileEntity) {
@@ -118,228 +119,65 @@ public final class CraftBlockStates {
@@ -119,233 +120,66 @@ public final class CraftBlockStates {
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
@Override
public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
@ -130,6 +130,8 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
- Material.MANGROVE_WALL_SIGN,
- Material.OAK_SIGN,
- Material.OAK_WALL_SIGN,
- Material.PALE_OAK_SIGN,
- Material.PALE_OAK_WALL_SIGN,
- Material.SPRUCE_SIGN,
- Material.SPRUCE_WALL_SIGN,
- Material.WARPED_SIGN,
@ -157,6 +159,8 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
- Material.MANGROVE_WALL_HANGING_SIGN,
- Material.OAK_HANGING_SIGN,
- Material.OAK_WALL_HANGING_SIGN,
- Material.PALE_OAK_HANGING_SIGN,
- Material.PALE_OAK_WALL_HANGING_SIGN,
- Material.SPRUCE_HANGING_SIGN,
- Material.SPRUCE_WALL_HANGING_SIGN,
- Material.WARPED_HANGING_SIGN,
@ -294,6 +298,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
- register(Material.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new, ChiseledBookShelfBlockEntity::new);
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
- register(Material.CREAKING_HEART, CraftCreakingHeart.class, CraftCreakingHeart::new, CreakingHeartBlockEntity::new);
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
- register(Material.DECORATED_POT, CraftDecoratedPot.class, CraftDecoratedPot::new, DecoratedPotBlockEntity::new);
- register(Material.DISPENSER, CraftDispenser.class, CraftDispenser::new, DispenserBlockEntity::new);
@ -340,6 +345,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
+ register(BlockEntityType.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new);
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
+ register(BlockEntityType.CREAKING_HEART, CraftCreakingHeart.class, CraftCreakingHeart::new);
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
+ register(BlockEntityType.DECORATED_POT, CraftDecoratedPot.class, CraftDecoratedPot::new);
+ register(BlockEntityType.DISPENSER, CraftDispenser.class, CraftDispenser::new);
@ -370,7 +376,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
}
private static void register(Material blockType, BlockStateFactory<?> factory) {
@@ -347,30 +185,33 @@ public final class CraftBlockStates {
@@ -353,30 +187,33 @@ public final class CraftBlockStates {
}
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
@ -419,7 +425,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
Preconditions.checkNotNull(material, "material is null");
return CraftBlockStates.getFactory(material).blockStateType;
@@ -386,6 +227,13 @@ public final class CraftBlockStates {
@@ -392,6 +229,13 @@ public final class CraftBlockStates {
return null;
}
@ -433,7 +439,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
public static BlockState getBlockState(Block block) {
// Paper start
return CraftBlockStates.getBlockState(block, true);
@@ -453,7 +301,7 @@ public final class CraftBlockStates {
@@ -459,7 +303,7 @@ public final class CraftBlockStates {
if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) {
factory = CraftBlockStates.DEFAULT_FACTORY;
} else {
@ -442,7 +448,7 @@ index 83ac5fc6cbbd249b5865ab203b150f53f01c9f05..b7ff7af2513204b151340538d50a65c8
}
return factory.createBlockState(world, blockPosition, blockData, tileEntity);
}
@@ -472,6 +320,14 @@ public final class CraftBlockStates {
@@ -478,6 +322,14 @@ public final class CraftBlockStates {
return new CraftBlockState(CraftBlock.at(world, pos), flag);
}

View File

@ -19,7 +19,7 @@ index 49028463ba47e760281545c2f7597e3db8d6c453..7620c72a4c243cbeea245203ce03a97c
}
final Object val = config.get(key);
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 5adc1952504b26772116b55a5144b7704136edfa..c5dd3aac54aa5936da4bd9f54f0e76ecf8141d27 100644
index fd2dd6d25b8d6f3066c60a7f30a58a72cb418b85..575fa665ff9c8f52056a0e7305540ec5c3da4785 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -436,7 +436,14 @@ public abstract class ChunkGenerator {

View File

@ -40,10 +40,10 @@ index 0000000000000000000000000000000000000000..68098dfe716e93aafcca4d8d5b5a81d8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index adbd61c41cc30afa89c6ee3544c562b351304a01..585d3e51b4af87327fc2bc64a49f09732a8c61ab 100644
index e30a5ad17d7ba8bcec8911a72281830c419b0288..3c3be48b29fcd38c5dea1bfca8d8690850aa948e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -196,6 +196,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -195,6 +195,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] don't attempt to teleport dead entities
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e34260c80d19869c9bec5ba67f7ce7db9d13a1f1..35c0591f9d981f1cf7da4d1dea108a8bb3e46c7a 100644
index b54dcebbd5d2f920efcf91ff2de485493dd2f487..e311601d8e39e7ea632bc4805260da6d7d6d6776 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -705,7 +705,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -713,7 +713,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit start
public void postTick() {
// No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 4132b5dfbc6a7693f0bb923a8b14ded571560030..ee7bb1a01bf027eb7b28e3795950a17e5f686815 100644
index f7e14d9668c74e20bc327b05cf84c8203e4e590b..4db8ac288e59c5f14b260686e55a7d48e2f2791d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2773,17 +2773,29 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2865,17 +2865,29 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
}
@ -31,7 +31,7 @@ index 4132b5dfbc6a7693f0bb923a8b14ded571560030..ee7bb1a01bf027eb7b28e3795950a17e
+ }
+ // Paper end - Prevent excessive velocity through repeated crits
this.setDeltaMovement(vec3d.x, (double) f, vec3d.z);
this.setDeltaMovement(vec3d.x, Math.max((double) f, vec3d.y), vec3d.z);
if (this.isSprinting()) {
float f1 = this.getYRot() * 0.017453292F;
-

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 4cf88f6d815d60cfbf8e4ecf9d96d0cfadd0620b..42d7ecfab6f72517904451d9df3f0404b176fdb2 100644
index 0fbe4ea495a8101f6bc1b9830ce3f47af2aa5be4..60e523f4de1cbafc2c58a5d568fe3989b7b07c34 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -1002,16 +1002,7 @@ public class Util {
@@ -1082,16 +1082,7 @@ public class Util {
}
public void openUri(URI uri) {

View File

@ -13,10 +13,10 @@ Co-authored-by: Noah van der Aa <ndvdaa@gmail.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
index 1e7235413fae39dc530eb843f1846f74bb5268b6..635fc086d832c641f840cf36d18cdc0fcc3beef3 100644
index 437be546cf03b6af0856adabfeaf67bc33ff75d6..c4473c2a778116d48bc3e4796afd901f455070e6 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -50,9 +50,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
@@ -50,9 +50,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements CaveVines {
return to.setValue(BERRIES, from.getValue(BERRIES));
}
@ -37,7 +37,7 @@ index 1e7235413fae39dc530eb843f1846f74bb5268b6..635fc086d832c641f840cf36d18cdc0f
@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
index 73595922dcff8e7a8595fcf033ab238bc4096630..112d2feba5f75a2a873b595617780515945c10e4 100644
index 79ebc37a779bf6cba66a34a7604f819e95fd86a2..1ada5ed825501666addacf527a513ab7bd4a3a58 100644
--- a/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 {
@ -52,7 +52,7 @@ index 73595922dcff8e7a8595fcf033ab238bc4096630..112d2feba5f75a2a873b595617780515
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
index 164a855d99cf36205bd9fce04640109f20a2b96c..cf05da1c86e3018db11dc079bf50317b6639e5cc 100644
index c527f2d8f594d711d047a2a149efe37caaeb0308..9b424d7661fedf8ee1eb9f3167c62e563f04d4d1 100644
--- a/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
@ -76,10 +76,10 @@ index 164a855d99cf36205bd9fce04640109f20a2b96c..cf05da1c86e3018db11dc079bf50317b
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
index fd7f7d58cd159f663f8f474d9c73841c795d2990..b98e17d21d43610fb7a7ce1641c518598ff48cb0 100644
index 10e2b80b0b6010982258548b5084b9591177b558..6b18db68c8b95480992199126c6063ea728d2314 100644
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
@@ -114,7 +114,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
@@ -123,7 +123,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (!isHanging(state)) {
@ -89,10 +89,10 @@ index fd7f7d58cd159f663f8f474d9c73841c795d2990..b98e17d21d43610fb7a7ce1641c51859
}
} else {
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 c9ed129db2cadd0a33d69993961f43088725c3cb..d06e3892cf42723f8e3f621b5497c5348fa1a715 100644
index 972d8833127090c01d620cab10b3eca3d3601710..ea6135edc76c06b7cd55930b620dfb05f939e4f6 100644
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
@@ -123,7 +123,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@@ -132,7 +132,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
float f = CropBlock.getGrowthSpeed(this, world, pos);

View File

@ -5,7 +5,7 @@ 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
index fdb6898519acfb27baf25d8bbad2013956c1361f..3c6edc5ea44b7ec15d8fc7a2dca95a11a0d6108a 100644
index c0deabf9d86d086fbd8cbaac5a02badf5c01c870..30af4cbb17148c247a46c0346419d6c838dbc9d2 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -1,6 +1,7 @@
@ -16,7 +16,7 @@ index fdb6898519acfb27baf25d8bbad2013956c1361f..3c6edc5ea44b7ec15d8fc7a2dca95a11
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.component.DataComponents;
@@ -154,6 +155,13 @@ public class ItemFrame extends HangingEntity {
@@ -166,6 +167,13 @@ public class ItemFrame extends HangingEntity {
return true;
}
// CraftBukkit end
@ -27,23 +27,26 @@ index fdb6898519acfb27baf25d8bbad2013956c1361f..3c6edc5ea44b7ec15d8fc7a2dca95a11
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false);
+ }
+ // Paper end - Add PlayerItemFrameChangeEvent
this.dropItem(source.getEntity(), false);
this.dropItem(world, source.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -394,11 +402,24 @@ public class ItemFrame extends HangingEntity {
}
}
- this.setItem(itemstack);
+ // 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);
+ if (!event.callEvent()) {
+ return InteractionResult.FAIL;
+ }
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
+ // Paper end - Add PlayerItemFrameChangeEvent
this.gameEvent(GameEvent.BLOCK_CHANGE, player);
itemstack.consume(1, player);
@@ -403,7 +411,13 @@ public class ItemFrame extends HangingEntity {
if (worldmap != null && worldmap.isTrackedCountOverLimit(256)) {
return InteractionResult.FAIL;
} else {
- this.setItem(itemstack);
+ // 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);
+ if (!event.callEvent()) {
+ return InteractionResult.FAIL;
+ }
+ this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
+ // Paper end - Add PlayerItemFrameChangeEvent
this.gameEvent(GameEvent.BLOCK_CHANGE, player);
itemstack.consume(1, player);
return InteractionResult.SUCCESS;
@@ -412,6 +426,13 @@ public class ItemFrame extends HangingEntity {
return InteractionResult.PASS;
}
} else {
+ // Paper start - Add PlayerItemFrameChangeEvent

View File

@ -24,7 +24,7 @@ to corrupted data. This is also something that Anti-Xray is currently
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
index f80cde264393f3606bc0c54ba2fd6a467f4bcb5a..c5e1040c239874dcf20b79472bf690ee7f0a9e5f 100644
index ac673cb38755852eef37e915f157f6a702117306..98dbeaf8bde15940e5b5d5d1f13fd4bb32f0a10d 100644
--- a/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> {

View File

@ -6,20 +6,20 @@ 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
index f1d5c2d423dc015cc7720a4544370895f3cc644b..d6eab2a0fdbafc35efa7ed5b404357391565f4f3 100644
index b2d85abb6c9c725955d972cd6895440849213fdf..887a17a0833064eb5701222e5fb6f5ccf9511588 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -338,14 +338,17 @@ public class CraftChunk implements Chunk {
PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>>[] biome = (includeBiome || includeBiomeTempRain) ? new PalettedContainer[cs.length] : null;
Registry<net.minecraft.world.level.biome.Biome> iregistry = this.worldServer.registryAccess().registryOrThrow(Registries.BIOME);
- Codec<PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
Registry<net.minecraft.world.level.biome.Biome> iregistry = this.worldServer.registryAccess().lookupOrThrow(Registries.BIOME);
- Codec<PalettedContainerRO<Holder<net.minecraft.world.level.biome.Biome>>> biomeCodec = PalettedContainer.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS));
for (int i = 0; i < cs.length; i++) {
- CompoundTag data = new CompoundTag();
- data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).getOrThrow());
- sectionBlockIDs[i] = ChunkSerializer.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).getOrThrow(ChunkSerializer.ChunkReadException::new);
- data.put("block_states", SerializableChunkData.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).getOrThrow());
- sectionBlockIDs[i] = SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, data.getCompound("block_states")).getOrThrow(SerializableChunkData.ChunkReadException::new);
- sectionEmpty[i] = cs[i].hasOnlyAir();
+ // Paper start - Fix ChunkSnapshot#isSectionEmpty(int); and remove codec usage
+ sectionEmpty[i] = cs[i].hasOnlyAir(); // fix sectionEmpty array not being filled
@ -37,7 +37,7 @@ index f1d5c2d423dc015cc7720a4544370895f3cc644b..d6eab2a0fdbafc35efa7ed5b40435739
if (biome != null) {
- data.put("biomes", biomeCodec.encodeStart(NbtOps.INSTANCE, cs[i].getBiomes()).getOrThrow());
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).getOrThrow(ChunkSerializer.ChunkReadException::new);
- biome[i] = biomeCodec.parse(NbtOps.INSTANCE, data.getCompound("biomes")).getOrThrow(SerializableChunkData.ChunkReadException::new);
+ 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,36 +5,35 @@ 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
index 0c20a334be4b1c4cf7999826f8d9bff5e36bc2b8..6d58a30a588ec98bc343ab0ab82be82d9cf0618c 100644
index 7fa1aea7942a1bc4d9779a9f8ab020ccd5566923..94072a9b65f69dfc3337907f8573081989467662 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -46,6 +46,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -46,12 +46,14 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
private final NonNullList<ItemStack> items;
public final int[] cookingProgress;
public final int[] cookingTime;
private final RecipeManager.CachedCheck<SingleRecipeInput, CampfireCookingRecipe> quickCheck;
+ public final boolean[] stopCooking; // Paper - Add more Campfire API
public CampfireBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.CAMPFIRE, pos, state);
@@ -53,6 +54,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
this.items = NonNullList.withSize(4, ItemStack.EMPTY);
this.cookingProgress = new int[4];
this.cookingTime = new int[4];
this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
+ this.stopCooking = new boolean[4]; // Paper - Add more Campfire API
}
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
@@ -63,7 +65,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
public static void cookTick(ServerLevel world, BlockPos pos, BlockState state, CampfireBlockEntity blockEntity, RecipeManager.CachedCheck<SingleRecipeInput, CampfireCookingRecipe> recipeMatchGetter) {
@@ -62,7 +64,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (!itemstack.isEmpty()) {
flag = true;
+ if (!campfire.stopCooking[i]) { // Paper - Add more Campfire API
int j = campfire.cookingProgress[i]++;
+ if (!blockEntity.stopCooking[i]) { // Paper - Add more Campfire API
int j = blockEntity.cookingProgress[i]++;
+ } // Paper - Add more Campfire API
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
if (blockEntity.cookingProgress[i] >= blockEntity.cookingTime[i]) {
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(itemstack);
@@ -176,6 +180,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -175,6 +179,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
}
@ -51,8 +50,8 @@ index 0c20a334be4b1c4cf7999826f8d9bff5e36bc2b8..6d58a30a588ec98bc343ab0ab82be82d
}
@Override
@@ -184,6 +198,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true, registryLookup);
@@ -183,6 +197,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true, registries);
nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime);
+ // Paper start - Add more Campfire API

View File

@ -5,10 +5,10 @@ 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
index 0d98dcfeab1455931219e498072f7129016f6678..56ce703a3b33e0530eb86389f8290d109d321589 100644
index e311601d8e39e7ea632bc4805260da6d7d6d6776..1497c3b79e6dc9ecc270c0fd2003e606f967a56e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3353,6 +3353,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3480,6 +3480,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void restoreFrom(Entity original) {
@ -22,14 +22,14 @@ index 0d98dcfeab1455931219e498072f7129016f6678..56ce703a3b33e0530eb86389f8290d10
CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag());
nbttagcompound.remove("Dimension");
@@ -3441,8 +3448,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity2.restoreFrom(this);
this.removeAfterChangingDimensions();
// CraftBukkit start - Forward the CraftEntity to the new entity
- this.getBukkitEntity().setHandle(entity2);
- entity2.bukkitEntity = this.getBukkitEntity();
+ // this.getBukkitEntity().setHandle(entity2); // Paper - forward CraftEntity in teleport command; moved to Entity#restoreFrom
+ // entity2.bukkitEntity = this.getBukkitEntity();
// CraftBukkit end
}
@@ -3615,8 +3622,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity.restoreFrom(this);
this.removeAfterChangingDimensions();
// CraftBukkit start - Forward the CraftEntity to the new entity
- this.getBukkitEntity().setHandle(entity);
- entity.bukkitEntity = this.getBukkitEntity();
+ //this.getBukkitEntity().setHandle(entity);
+ //entity.bukkitEntity = this.getBukkitEntity(); // Paper - forward CraftEntity in teleport command; moved to Entity#restoreFrom
// CraftBukkit end
entity.teleportSetPosition(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
if (this.inWorld) world.addDuringTeleport(entity); // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned