Dieser Commit ist enthalten in:
Jake Potrebic 2024-06-13 17:08:12 -07:00
Ursprung ba163e10bb
Commit 8731266275
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
67 geänderte Dateien mit 249 neuen und 284 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Config option for Piglins guarding chests
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index 31bb652c7ef35e7d61df2b1b60589fbb5c845bb0..96d8f0fea969fa14bae77afc60c6a64032ca4957 100644
index 3ca643747535bf7b71e5877ca47f730a2aca4ba5..d601bff8e8f62af78791ad357b51b92faf04e55f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -476,6 +476,7 @@ public class PiglinAi {

Datei anzeigen

@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 22 Dec 2020 13:52:48 -0800
Subject: [PATCH] Add EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 7f7445a2b68fd2e6e5fcd509d950a0f8d680c1fe..ebc5f2e8d59da4bec25ff156ec95fe49366be59c 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -646,14 +646,14 @@ public final class ItemStack implements DataComponentHolder {
return (Integer) this.getOrDefault(DataComponents.MAX_DAMAGE, 0);
}
- public void hurtAndBreak(int amount, ServerLevel world, @Nullable ServerPlayer player, Consumer<Item> breakCallback) {
+ public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent
if (this.isDamageableItem()) {
if (player == null || !player.hasInfiniteMaterials()) {
if (amount > 0) {
amount = EnchantmentHelper.processDurabilityChange(world, this, amount);
// CraftBukkit start
- if (player != null) {
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent
event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) {
@@ -664,6 +664,14 @@ public final class ItemStack implements DataComponentHolder {
}
amount = event.getDamage();
+ // Paper start - Add EntityDamageItemEvent
+ } else if (player != null) {
+ io.papermc.paper.event.entity.EntityDamageItemEvent event = new io.papermc.paper.event.entity.EntityDamageItemEvent(player.getBukkitLivingEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (!event.callEvent()) {
+ return;
+ }
+ amount = event.getDamage();
+ // Paper end - Add EntityDamageItemEvent
}
// CraftBukkit end
if (amount <= 0) {
@@ -671,8 +679,8 @@ public final class ItemStack implements DataComponentHolder {
}
}
- if (player != null && amount != 0) {
- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, this.getDamageValue() + amount);
+ if (player instanceof ServerPlayer serverPlayer && amount != 0) { // Paper - Add EntityDamageItemEvent
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, this.getDamageValue() + amount); // Paper - Add EntityDamageItemEvent
}
int j = this.getDamageValue() + amount;
@@ -701,7 +709,7 @@ public final class ItemStack implements DataComponentHolder {
entityplayer = null;
}
- this.hurtAndBreak(amount, worldserver, entityplayer, (item) -> {
+ this.hurtAndBreak(amount, worldserver, entity, (item) -> { // Paper - Add EntityDamageItemEvent
// CraftBukkit start - Check for item breaking
if (this.count == 1 && entity instanceof net.minecraft.world.entity.player.Player) {
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((net.minecraft.world.entity.player.Player) entity, this);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize indirect passenger iteration
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b4670fc653721283f95bb61ac57c306b224b7fb7..56de24f923571aff124ae64b737cbdf482d4b847 100644
index 64e0dafe15bbf8e0f5892337df69063982a9d82a..5223379e5c11c978fd85bd05ef9451aa2ddc2aa3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3875,20 +3875,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3891,20 +3891,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
private Stream<Entity> getIndirectPassengersStream() {
@ -43,7 +43,7 @@ index b4670fc653721283f95bb61ac57c306b224b7fb7..56de24f923571aff124ae64b737cbdf4
return () -> {
return this.getIndirectPassengersStream().iterator();
};
@@ -3901,6 +3915,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3917,6 +3931,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean hasExactlyOnePlayerPassenger() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 56408fa2603137819f47e7bd9b53b0b5f647edd6..19a7d0ab2ee5494149dfb0503b7c69784b7bee8b 100644
index 7e8a43ea1b32f444fb66e270a5f6b48bf7bcd2a0..f3f93710846ce0f6d53845e0b49331646a4e8332 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -117,7 +117,7 @@ public class ServerEntity {
@@ -116,7 +116,7 @@ public class ServerEntity {
if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
ItemStack itemstack = entityitemframe.getItem();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index ed336112581ac77196ed3e60dc8aaf50312c078b..c09851136944bd58d82b3a9d19719b0354802824 100644
index 6d0a90e9c637edff5c5ce1355a3b45f0fb7f4154..232e6216dc36aa698047fc0badf78c347414b3a5 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -306,6 +306,24 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -305,6 +305,24 @@ public class Block extends BlockBehaviour implements ItemLike {
}

Datei anzeigen

@ -5,10 +5,10 @@ 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 c6c6d54f35dd75e14a6e040d730d5ae9c1406059..a39a2b2b1a4294cb68cdbc3e67ad3e29552eeec8 100644
index 83b77e170f2945e9b40f302c4cf65efb1628c84a..d64a1c1e146d5d9aa940a37dbee16889c9bab783 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
@@ -23,8 +23,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@@ -22,8 +22,15 @@ public class SmithingTransformRecipe implements SmithingRecipe {
final Ingredient base;
final Ingredient addition;
final ItemStack result;
@ -24,9 +24,9 @@ index c6c6d54f35dd75e14a6e040d730d5ae9c1406059..a39a2b2b1a4294cb68cdbc3e67ad3e29
this.template = template;
this.base = base;
this.addition = addition;
@@ -40,7 +47,9 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public ItemStack assemble(Container inventory, HolderLookup.Provider lookup) {
ItemStack itemstack = inventory.getItem(1).transmuteCopy(this.result.getItem(), this.result.getCount());
@@ -37,7 +44,9 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider lookup) {
ItemStack itemstack = input.base().transmuteCopy(this.result.getItem(), this.result.getCount());
+ if (this.copyDataComponents) { // Paper - Option to prevent data components copy
itemstack.applyComponents(this.result.getComponentsPatch());
@ -34,7 +34,7 @@ index c6c6d54f35dd75e14a6e040d730d5ae9c1406059..a39a2b2b1a4294cb68cdbc3e67ad3e29
return itemstack;
}
@@ -79,7 +88,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
@@ -76,7 +85,7 @@ public class SmithingTransformRecipe implements SmithingRecipe {
public Recipe toBukkitRecipe(NamespacedKey id) {
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
@ -44,10 +44,10 @@ index c6c6d54f35dd75e14a6e040d730d5ae9c1406059..a39a2b2b1a4294cb68cdbc3e67ad3e29
return recipe;
}
diff --git a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
index f1207df56718ad2a62fb7d567b397ceaa668e1e7..45a7ad173b7025305ce83b51f94e2af47644b829 100644
index 4ea43872f9da72ed959dd0709f959402d01d5fe0..f6f10da21a752e927409ea16076701c4ec403a0e 100644
--- a/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
@@ -31,8 +31,15 @@ public class SmithingTrimRecipe implements SmithingRecipe {
@@ -30,8 +30,15 @@ public class SmithingTrimRecipe implements SmithingRecipe {
final Ingredient template;
final Ingredient base;
final Ingredient addition;
@ -63,7 +63,7 @@ index f1207df56718ad2a62fb7d567b397ceaa668e1e7..45a7ad173b7025305ce83b51f94e2af4
this.template = template;
this.base = base;
this.addition = addition;
@@ -58,7 +65,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
@@ -55,7 +62,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
return ItemStack.EMPTY;
}
@ -72,7 +72,7 @@ index f1207df56718ad2a62fb7d567b397ceaa668e1e7..45a7ad173b7025305ce83b51f94e2af4
itemstack1.set(DataComponents.TRIM, new ArmorTrim((Holder) optional.get(), (Holder) optional1.get()));
return itemstack1;
@@ -109,7 +116,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
@@ -106,7 +113,7 @@ public class SmithingTrimRecipe implements SmithingRecipe {
// CraftBukkit start
@Override
public Recipe toBukkitRecipe(NamespacedKey id) {

Datei anzeigen

@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 16 May 2021 09:39:46 -0700
Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5223379e5c11c978fd85bd05ef9451aa2ddc2aa3..4ef848a32c4f149e4cc2f9a8213244c163a72bea 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3365,7 +3365,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (world instanceof ServerLevel worldserver) {
if (!this.isRemoved()) {
// CraftBukkit start
- Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot());
+ Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), this.getXRot()); // Paper - use getXRot (doesn't respect DimensionTransition pitch)
// Paper start - gateway-specific teleport event
final EntityTeleportEvent teleEvent;
if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
@@ -3379,7 +3379,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return null;
}
to = teleEvent.getTo();
- teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
+ // Paper start - Call EntityPortalExitEvent
+ CraftEntity bukkitEntity = this.getBukkitEntity();
+ Vec3 velocity = teleportTarget.speed();
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(
+ bukkitEntity,
+ bukkitEntity.getLocation(), to.clone(),
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity)
+ );
+ event.callEvent();
+ if (this.isRemoved()) {
+ return null;
+ }
+
+ if (!event.isCancelled() && event.getTo() != null) {
+ to = event.getTo().clone();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
+ }
+ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause());
+ // Paper end - Call EntityPortalExitEvent
// CraftBukkit end
ServerLevel worldserver1 = teleportTarget.newLevel();
List<Entity> list = this.getPassengers();

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index eecc5704582ce7c9a45adee8057d8297eae03a86..5cb0281ea110a1ce3444f4392bccbb19ca3bbf09 100644
index 8c268f57d44d70df3210510abf7832939d41781d..efc27bb4072172f10839c181de9b5fba1f488b6f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -763,6 +763,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -764,6 +764,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
protected BlockPos findLightningTargetAround(BlockPos pos) {
@ -22,7 +22,7 @@ index eecc5704582ce7c9a45adee8057d8297eae03a86..5cb0281ea110a1ce3444f4392bccbb19
BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(blockposition1);
@@ -777,6 +782,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -778,6 +783,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!list.isEmpty()) {
return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition();
} else {
@ -31,7 +31,7 @@ index eecc5704582ce7c9a45adee8057d8297eae03a86..5cb0281ea110a1ce3444f4392bccbb19
blockposition1 = blockposition1.above(2);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e10043db80ee5dc6468c8caa16d55ad418fa3670..d83321ba1de5445b4a060fd11c5bb8b237bc8b3f 100644
index 6734f9e22e9bd1d1b385812d35a72487fe2b7b9b..e6adac1897902dfefe18bd67f903b4a524efdf59 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -712,6 +712,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 44e3e4c8326dc93292f482c136fe2d6e6b8eb0b6..68e805cb5085aa0413bb733c58690878fb670cf3 100644
index a867c9de9c2c1798d8e9014f5114b0f4e32b3261..cfd003e975573564a3fea9d4379842979711e841 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -555,6 +555,18 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -164,10 +164,10 @@ index 8ca86852319d7463f60832bc98b825b0b4325995..62ada73302c6b3ce3fb2dcc8c31a1d9c
private final DisplayInfo handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 5b71ef6231c6c44ebeabfb1fb39941806cb22b5c..7d7abae8e2978d78b97cf22c5eecf47878818f52 100644
index 2d9453498531c99f4fa566a08099b4e5a7af25fa..9d8adc5e281decd61fb3a8cfd78531b0b374e29c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -379,6 +379,11 @@ public class Commodore {
@@ -384,6 +384,11 @@ public class Commodore {
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
return;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add ItemFactory#getSpawnEgg API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 7c32802947fd5318009a02724c85206b250e7143..be31b8a286794508a1c1bfcf3da0ac64c0383c60 100644
index a96a09bb39fc35f3c4dfcd0da0ce1fe283b8377e..31a33e329ee06860f8845d201d32ee86a274a657 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -579,4 +579,19 @@ public final class CraftItemFactory implements ItemFactory {
@@ -590,4 +590,19 @@ public final class CraftItemFactory implements ItemFactory {
new net.md_5.bungee.api.chat.TextComponent(customName));
}
// Paper end - bungee hover events
@ -29,10 +29,10 @@ index 7c32802947fd5318009a02724c85206b250e7143..be31b8a286794508a1c1bfcf3da0ac64
+ // Paper end - old getSpawnEgg API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 7d7abae8e2978d78b97cf22c5eecf47878818f52..8ae3b6bb5daf4d0a4a429868d1dea700c3ee129c 100644
index 9d8adc5e281decd61fb3a8cfd78531b0b374e29c..0d5ce79dc8fb3b1677e09d663608a5cb5224de2f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -386,6 +386,15 @@ public class Commodore {
@@ -391,6 +391,15 @@ public class Commodore {
}
// Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add critical damage API
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 9b5af216d38ff4584d40586403bd92207b230dfa..533ea6cbb813c8d1dc2bb3f65fd94d4fa5dd591e 100644
index 20c3cd89deaa0aa9f9b1b60cde5644e49301d2cb..10bee9b217fae9170af9d66dac9741046be1cab6 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -255,4 +255,18 @@ public class DamageSource {
@@ -260,4 +260,18 @@ public class DamageSource {
public Holder<DamageType> typeHolder() {
return this.type;
}
@ -28,42 +28,32 @@ index 9b5af216d38ff4584d40586403bd92207b230dfa..533ea6cbb813c8d1dc2bb3f65fd94d4f
+ // Paper end - add critical damage API
}
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 56f7a753d2167504b6d91219093097323a9081c5..07afb966626d86b065e138959e9ffcac27a0d5d2 100644
index c89b7cf63d067895bbd07f43eef467ff1861f625..536a4e3c26e83f359083bde19832a962628244fa 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1274,7 +1274,7 @@ public abstract class Player extends LivingEntity {
}
f += this.getItemInHand(InteractionHand.MAIN_HAND).getItem().getAttackDamageBonus(this, f);
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting(); // Paper - Add critical damage API; diff on change
@@ -1292,6 +1292,7 @@ public abstract class Player extends LivingEntity {
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) {
@@ -1313,7 +1313,7 @@ public abstract class Player extends LivingEntity {
+ damagesource = damagesource.critical(true); // Paper start - critical damage API
f *= 1.5F;
}
Vec3 vec3d = target.getDeltaMovement();
- boolean flag5 = target.hurt(this.damageSources().playerAttack(this), f);
+ boolean flag5 = target.hurt(this.damageSources().playerAttack(this).critical(flag2), f); // Paper - add critical damage API
@@ -1352,7 +1353,7 @@ public abstract class Player extends LivingEntity {
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
if (flag5) {
if (i > 0) {
@@ -1341,7 +1341,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
- if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
+ if (entityliving.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f4)) { // Paper - add critical damage API
entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
- if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
+ if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API
entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 49dc01532f9b60b3f594abca56b7d807fe6716d5..427e889f58c86f7649fc1b661d55277599b320c0 100644
index 1f881f71d5698bc7b36bc029287ac8e873a46107..92b630475ef7032c9cae6288b2a0370562e25f57 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -392,6 +392,7 @@ public abstract class AbstractArrow extends Projectile {
}
@@ -415,6 +415,7 @@ public abstract class AbstractArrow extends Projectile {
entityliving.setLastHurtMob(entity);
}
+ if (this.isCritArrow()) damagesource = damagesource.critical(); // Paper - add critical damage API
@ -71,10 +61,10 @@ index 49dc01532f9b60b3f594abca56b7d807fe6716d5..427e889f58c86f7649fc1b661d552775
int k = entity.getRemainingFireTicks();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 3102324bfdaa82826eead1f40d24bf13553f6506..efc3808dde268f8325304f4bce8fb3bf399adafd 100644
index f99247b37a6fb04d27611051908364bcde168afa..e0c1eab089fff724e029ed8109a653403e15fc77 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1064,7 +1064,7 @@ public class CraftEventFactory {
@@ -1065,7 +1065,7 @@ public class CraftEventFactory {
return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled);
}
DamageCause damageCause = (damager.getBukkitEntity() instanceof org.bukkit.entity.TNTPrimed) ? DamageCause.BLOCK_EXPLOSION : DamageCause.ENTITY_EXPLOSION;
@ -83,7 +73,7 @@ index 3102324bfdaa82826eead1f40d24bf13553f6506..efc3808dde268f8325304f4bce8fb3bf
} else if (damager != null || source.getDirectEntity() != null) {
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
@@ -1090,7 +1090,7 @@ public class CraftEventFactory {
@@ -1091,7 +1091,7 @@ public class CraftEventFactory {
cause = DamageCause.MAGIC;
}
@ -92,7 +82,7 @@ index 3102324bfdaa82826eead1f40d24bf13553f6506..efc3808dde268f8325304f4bce8fb3bf
} else if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) {
return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.VOID, bukkitDamageSource, modifiers, modifierFunctions, cancelled);
} else if (source.is(DamageTypes.LAVA)) {
@@ -1148,13 +1148,13 @@ public class CraftEventFactory {
@@ -1149,13 +1149,13 @@ public class CraftEventFactory {
cause = DamageCause.CUSTOM;
}

Datei anzeigen

@ -5,10 +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 d99bd9f652f3cf09661e426c79693a203effb04c..5642bddc8268d70e5bb5446b65be1d8ce34feb9b 100644
index 44313973318cc330bb0288ec5b857c61d4c8f9be..cee42ae2b75c29c89e7fc5b1c77d3b45ce40e9ba 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
@@ -90,10 +90,15 @@ public class Skeleton extends AbstractSkeleton {
@@ -91,10 +91,15 @@ public class Skeleton extends AbstractSkeleton {
}
protected void doFreezeConversion() {
@ -26,7 +26,7 @@ index d99bd9f652f3cf09661e426c79693a203effb04c..5642bddc8268d70e5bb5446b65be1d8c
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 5cd316e6f8139f4258f40e28824ec2d27bad02f1..c583d883118ded5e1884c757427dc5e73c10dd27 100644
index d35214c485dfc3abdb3f2d6683c9293b3b5f035d..d5e0c493f4c348724958193795ceb987765a465f 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -258,6 +258,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5d4fa3823a6dbb6150e4b97cf3973eb254018e38..ebacae6f39fea052f4fb7c60f7164763b49f8148 100644
index 4ef848a32c4f149e4cc2f9a8213244c163a72bea..4542c6a7c48bfcb8a5acf127944e24b60dfc13e1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2105,6 +2105,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2146,6 +2146,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@ -27,10 +27,10 @@ index 5d4fa3823a6dbb6150e4b97cf3973eb254018e38..ebacae6f39fea052f4fb7c60f7164763
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0cd38bcbf1 100644
index 7310f53747e68b918f132ee0f0a142e36537902e..6f9286e65f7ac730b808ddf9b52c344f03b4d778 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1068,6 +1068,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1085,6 +1085,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// Paper end - tracked players API
@ -50,7 +50,7 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c
@Override
public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 68e805cb5085aa0413bb733c58690878fb670cf3..83730eac9887bbf9bd5284676ec9a0509ec14a04 100644
index cfd003e975573564a3fea9d4379842979711e841..1a46245fed7a5fca532df7e3febb22f5effca764 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -505,7 +505,33 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -33,10 +33,10 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..d5f7da3502575f6847f3c22ab0e94284
private RedirectModifier<S> modifier = null;
private boolean forks;
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 3728b051b9eb9e9e06bc765a9a2fae7f45daf6ff..779fee2f9b819124a01b9f8d2b7ed0d5f2accf6c 100644
index a19d132f6a71356f91b19197f02ccf312bb4b7c3..3141e033706599aae9a89a0975afb3954424df48 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -258,6 +258,13 @@ public class Commands {
@@ -256,6 +256,13 @@ public class Commands {
PublishCommand.register(this.dispatcher);
}

Datei anzeigen

@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5cb0281ea110a1ce3444f4392bccbb19ca3bbf09..e611857d9d29e8532b4ea3e0634c8f24a396a190 100644
index efc27bb4072172f10839c181de9b5fba1f488b6f..4c739717fcf53b28312e8a98f9bf0989c604d0f0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1276,9 +1276,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1274,9 +1274,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
@ -28,10 +28,10 @@ index 5cb0281ea110a1ce3444f4392bccbb19ca3bbf09..e611857d9d29e8532b4ea3e0634c8f24
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b90b525faa5bba684c783a56f136532a8195de84..5a13975fc9a472308ee74401f7b1f84f716e46eb 100644
index bc0a26cfbc5e1d21880f976c6bd4d0e30b277767..586f9bda04a74990b3eebbd2a52dcdb7273e8484 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1675,6 +1675,18 @@ public class ServerPlayer extends Player {
@@ -1718,6 +1718,18 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
this.doCloseContainer();
}
@ -51,7 +51,7 @@ index b90b525faa5bba684c783a56f136532a8195de84..5a13975fc9a472308ee74401f7b1f84f
@Override
public void doCloseContainer() {
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 07afb966626d86b065e138959e9ffcac27a0d5d2..9f3d1a5407635d740adb6722930c94781a021015 100644
index 536a4e3c26e83f359083bde19832a962628244fa..538c530ce9a2ce94dc013d8237b68b66bfcaa610 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -509,6 +509,11 @@ public abstract class Player extends LivingEntity {

Datei anzeigen

@ -17,10 +17,10 @@ Async catch modifications to critical entity state
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 40d2c7bfc8ba8b8b366f23e53cf37f331e19ccf7..795e65c7c98d50ff67953ccb1ff68dac0088116e 100644
index 83b0df341f4be1191191718e871dac6842d4a31a..c501f30418767678f9da2b54666da0d38cd594ff 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1565,6 +1565,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1578,6 +1578,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper
@ -29,10 +29,10 @@ index 40d2c7bfc8ba8b8b366f23e53cf37f331e19ccf7..795e65c7c98d50ff67953ccb1ff68dac
if (player.isRemoved()) {
LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName());
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f6febeb8f24b227520cda80efac7e43c023f1b10..a44b48bbb736e7efb04061f302bbb61015284bcb 100644
index 3bcc79b4f4d69ca7bbf1c8311869243853a19f3e..e54e41f2a94b19f9df3d087f88a2ceb6fc52d1dc 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1147,7 +1147,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1121,7 +1121,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
@ -166,7 +166,7 @@ index 219062cff8a05c765b092f1525043d9d9a1153ae..1c6e8438219f355274db4e0fa849cdd9
PersistentEntitySectionManager.LOGGER.warn("Entity {} wasn't found in section {} (destroying due to {})", new Object[]{this.entity, SectionPos.of(this.currentSectionKey), reason});
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d83321ba1de5445b4a060fd11c5bb8b237bc8b3f..7b1a4925e40550432c2e7c599c85303b173843d4 100644
index e6adac1897902dfefe18bd67f903b4a524efdf59..13d7ecd67a94b4651624df3c24d0ae6f4753a32f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1781,6 +1781,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -200,12 +200,12 @@ index d83321ba1de5445b4a060fd11c5bb8b237bc8b3f..7b1a4925e40550432c2e7c599c85303b
+ org.spigotmc.AsyncCatcher.catchOp("play sound"); // Paper
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(ResourceLocation.parse(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f4574527cb1dddb97dba1fa2dfe1c17b89728015..00cac0c83897221fd4a83dcee884db751321af2e 100644
index f37fe6724b8a85c7fd8eb3b08c7d5a412ca2263d..fe3304a40f2aaf84db825374f4b3d495d31f91ad 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -523,6 +523,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -524,6 +524,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {

Datei anzeigen

@ -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 54820a8d11bb12c516d4138fb0bf77c16f053f3f..659d8ad2e0232934a3009f79283924e4363f7f32 100644
index 0fc2e453c63b63e12f33cde28ad5afea5657ac57..3c9a9103783495c9015a8cea415620839f140f9c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2317,6 +2317,11 @@ public final class CraftServer implements Server {
@@ -2320,6 +2320,11 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {
@ -294,7 +294,7 @@ index 54820a8d11bb12c516d4138fb0bf77c16f053f3f..659d8ad2e0232934a3009f79283924e4
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7b1a4925e40550432c2e7c599c85303b173843d4..fbd5df61e5cfd67991dedb7bbba4a16ff16fa49b 100644
index 13d7ecd67a94b4651624df3c24d0ae6f4753a32f..6c5865c4c29e5470239dcabdfbb54057d05c80c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1739,9 +1739,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Sanitize ResourceLocation error logging
diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java
index 0ad6d9d417193248f6a9df67f1d1a66cef3ff122..d93b623ce973b63d4f3a77bfe459f51af7cb3c1c 100644
index 262660d115a5d5cbecfbae995955a24283e666b0..87afe84791af2d5e9f869cd4c09eed4bb5fee75b 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -231,7 +231,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
@@ -247,7 +247,7 @@ public final class ResourceLocation implements Comparable<ResourceLocation> {
private static String assertValidNamespace(String namespace, String path) {
if (!isValidNamespace(namespace)) {
@ -17,7 +17,7 @@ index 0ad6d9d417193248f6a9df67f1d1a66cef3ff122..d93b623ce973b63d4f3a77bfe459f51a
} else {
return namespace;
}
@@ -257,7 +257,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
@@ -268,7 +268,7 @@ public final class ResourceLocation implements Comparable<ResourceLocation> {
private static String assertValidPath(String namespace, String path) {
if (!isValidPath(path)) {

Datei anzeigen

@ -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 19fdd77d4830b7218b627fdf4ed755d8935c00aa..4144c872fbd89d22827ad1f586e9a8d63a39ed46 100644
index 73d7b5148e3a92c085b08303589827a6f0ae8d07..12ff8886bb53ca15db745989c25b9bd2f45335e4 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -558,9 +558,9 @@ public class BlockPos extends Vec3i {
@@ -570,9 +570,9 @@ public class BlockPos extends Vec3i {
}
public BlockPos.MutableBlockPos set(int x, int y, int z) {
@ -21,7 +21,7 @@ index 19fdd77d4830b7218b627fdf4ed755d8935c00aa..4144c872fbd89d22827ad1f586e9a8d6
return this;
}
@@ -625,19 +625,19 @@ public class BlockPos extends Vec3i {
@@ -637,19 +637,19 @@ public class BlockPos extends Vec3i {
@Override
public BlockPos.MutableBlockPos setX(int i) {

Datei anzeigen

@ -10,10 +10,10 @@ 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 fd5dc0e09c89f4e21fde5d06b0fc0d4d45e52280..1408faa8754b2492879f2dbb525aba3bfc8f0421 100644
index ed1fc466151ebebf7c3ac135c6893f4ea9a55a52..481248ef82d4257ca4cc88ab28a1a7946e22aef6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -351,6 +351,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -352,6 +352,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline

Datei anzeigen

@ -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 09a73383867d1ffadababd24428ee7a61ab98959..e605dbdb821b2d13217ac88426e50480a4e4741d 100644
index 9aa9ab894080a5819fc45698771afd034906d36a..f0f5e9bb5ac65250f0a151f9f90b58468335a8c2 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 {

Datei anzeigen

@ -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 406c78dcb97d954f16f05d379d4dbf74c61c8fd1..3532febc8e34c8436a69a4c4b472b1776f21ee48 100644
index d1247df5c51b0d377a27ea7cc5b5a2d1f1bf9b32..cf7c7813d528429a18dc25051df7fc06dc159930 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1690,7 +1690,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1529,7 +1529,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity;
private final int range;
SectionPos lastSectionPos;

Datei anzeigen

@ -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 e611857d9d29e8532b4ea3e0634c8f24a396a190..134df9ad4d5d5f85429f5e3ff6d879bc5f1fb13f 100644
index 4c739717fcf53b28312e8a98f9bf0989c604d0f0..0723e6fb396a7afa11772f460a98f68cc815bba0 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2277,6 +2277,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2245,6 +2245,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// 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

Datei anzeigen

@ -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 795e65c7c98d50ff67953ccb1ff68dac0088116e..4ac3e9cacc3c54a67da1547a319fd501ff375354 100644
index c501f30418767678f9da2b54666da0d38cd594ff..c616ebd8d5c2b2e580772f87174cb22827cc5e90 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -745,6 +745,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -748,6 +748,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
// CraftBukkit end

Datei anzeigen

@ -24,7 +24,7 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 6c30eb3750f434341ecec0bf8e9054bb331f9757..fd2a5c829899d45641a5b5d30116f4f368953c15 100644
index 2b86415e4ea197c5c44c23072c9a1cda595544a8..4d9f1fc884050993287adfa4578a87da710623fb 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -137,6 +137,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -50,7 +50,7 @@ index 6c30eb3750f434341ecec0bf8e9054bb331f9757..fd2a5c829899d45641a5b5d30116f4f3
public Connection(PacketFlow side) {
this.receiving = side;
@@ -207,6 +223,55 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -215,6 +231,55 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
if (packetlistener == null) {
throw new IllegalStateException("Received a packet before the packet listener was initialized");
} else {

Datei anzeigen

@ -5,10 +5,10 @@ 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 5a13975fc9a472308ee74401f7b1f84f716e46eb..a94b43df4a6cd6f5974015bc5fc87d37347276f1 100644
index 586f9bda04a74990b3eebbd2a52dcdb7273e8484..279c323bc2c2658fa1848d0c98f0614fbeb97e99 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -567,7 +567,7 @@ public class ServerPlayer extends Player {
@@ -576,7 +576,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 9572177323f29ea8315a3dfb943dfe10463f32ae..6c2a3813e7d63d57f07a8fa2edbb9d231221d818 100644
index ba4fcfc86b385c8f50f414d5448edc5e99d2433a..db9c812cf7267adf0bfd8be7368140e91245d640 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -382,7 +382,7 @@ public class SpigotConfig

Datei anzeigen

@ -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 83fce6746aaa3b378da6c5573ec9991d8438b071..6db7a023dd802706935c384df0b0aa430a6e29aa 100644
index b231f90317fe7df9133674b12d47873520b481cb..edaf7f1692ae059581f3abc24bb228874e6d114b 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 {

Datei anzeigen

@ -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 ebacae6f39fea052f4fb7c60f7164763b49f8148..0034e06a3caa89dfbb24a75d377d799ca0e8aed0 100644
index 4542c6a7c48bfcb8a5acf127944e24b60dfc13e1..42afa622c97cc7da666cfb3019f417c96842d318 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1813,6 +1813,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1845,6 +1845,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 ebacae6f39fea052f4fb7c60f7164763b49f8148..0034e06a3caa89dfbb24a75d377d799c
}
public void absMoveTo(double x, double y, double z) {
@@ -1851,6 +1852,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1887,6 +1888,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setXRot(pitch);
this.setOldPosAndRot();
this.reapplyPosition();

Datei anzeigen

@ -19,10 +19,10 @@ 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 a8768f1925d5824ca985be1b53694ee233273758..748caca458eb4eec6ece22d8362e36de252f07dd 100644
index 5adc1952504b26772116b55a5144b7704136edfa..c5dd3aac54aa5936da4bd9f54f0e76ecf8141d27 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -437,7 +437,14 @@ public abstract class ChunkGenerator {
@@ -436,7 +436,14 @@ public abstract class ChunkGenerator {
return (String) optional.orElseGet(placedfeature::toString);
};

Datei anzeigen

@ -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 b8043b7e778792153620923ea228c1a211c27969..bbbadf5284907531eef761a738c3adf5305bd08f 100644
index adbd61c41cc30afa89c6ee3544c562b351304a01..585d3e51b4af87327fc2bc64a49f09732a8c61ab 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -192,6 +192,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -196,6 +196,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\"");
}

Datei anzeigen

@ -5,15 +5,15 @@ 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 0034e06a3caa89dfbb24a75d377d799ca0e8aed0..7966d45adcbc239a506ab4aa2923a6df0dc36c03 100644
index 42afa622c97cc7da666cfb3019f417c96842d318..4ec6a43b7f16560de948974d60ad8ab1dcbb4696 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -730,7 +730,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -706,7 +706,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
- if (!(this instanceof ServerPlayer)) {
+ if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities
this.handleNetherPortal();
this.handlePortal();
}
}

Datei anzeigen

@ -5,15 +5,16 @@ 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 a44b48bbb736e7efb04061f302bbb61015284bcb..0fe6b9f4376d2b852f6f23e31848cd9236577bdf 100644
index e54e41f2a94b19f9df3d087f88a2ceb6fc52d1dc..65ab2a1e47d9f338dbb13062d25f6c9a3d5cc7ff 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2738,16 +2738,28 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2744,17 +2744,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;
}
+ protected long lastJumpTime = 0L; // Paper - Prevent excessive velocity through repeated crits
protected void jumpFromGround() {
@VisibleForTesting
public void jumpFromGround() {
float f = this.getJumpPower();
if (f > 1.0E-5F) {

Datei anzeigen

@ -7,24 +7,24 @@ 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 c7a21a11efba5c212958d56095217621828c1062..2cd0a4dc4f0baa08bd7f5a053303bb63733f0bab 100644
index 4cf88f6d815d60cfbf8e4ecf9d96d0cfadd0620b..42d7ecfab6f72517904451d9df3f0404b176fdb2 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -964,16 +964,7 @@ public class Util {
@@ -1002,16 +1002,7 @@ public class Util {
}
public void openUrl(URL url) {
public void openUri(URI uri) {
- try {
- Process process = AccessController.doPrivileged(
- (PrivilegedExceptionAction<Process>)(() -> Runtime.getRuntime().exec(this.getOpenUrlArguments(url)))
- (PrivilegedExceptionAction<Process>)(() -> Runtime.getRuntime().exec(this.getOpenUriArguments(uri)))
- );
- process.getInputStream().close();
- process.getErrorStream().close();
- process.getOutputStream().close();
- } catch (IOException | PrivilegedActionException var3) {
- Util.LOGGER.error("Couldn't open url '{}'", url, var3);
- Util.LOGGER.error("Couldn't open location '{}'", uri, var3);
- }
+ 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 openFile(File file) {

Datei anzeigen

@ -5,18 +5,18 @@ 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 5a0658932cc45c49c9285b1419d574dd83041732..bb22b84c32848869967a47a60f9d8a0629a59e2a 100644
index fdb6898519acfb27baf25d8bbad2013956c1361f..3c6edc5ea44b7ec15d8fc7a2dca95a11a0d6108a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -2,6 +2,7 @@ package net.minecraft.world.entity.decoration;
@@ -1,6 +1,7 @@
package net.minecraft.world.entity.decoration;
import com.mojang.logging.LogUtils;
import javax.annotation.Nullable;
+import io.papermc.paper.event.player.PlayerItemFrameChangeEvent; // Paper - Add PlayerItemFrameChangeEvent
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.component.DataComponents;
@@ -179,6 +180,13 @@ public class ItemFrame extends HangingEntity {
@@ -154,6 +155,13 @@ public class ItemFrame extends HangingEntity {
return true;
}
// CraftBukkit end
@ -30,7 +30,7 @@ index 5a0658932cc45c49c9285b1419d574dd83041732..bb22b84c32848869967a47a60f9d8a06
this.dropItem(source.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -429,11 +437,24 @@ public class ItemFrame extends HangingEntity {
@@ -394,11 +402,24 @@ public class ItemFrame extends HangingEntity {
}
}

Datei anzeigen

@ -5,10 +5,10 @@ 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
index 659d8ad2e0232934a3009f79283924e4363f7f32..a1c108bd8a11f63c0973e2d26186e18f5c3ba69e 100644
index 3c9a9103783495c9015a8cea415620839f140f9c..ad5dc323e03dfae8670ebf9fad629e76c2106af7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2502,6 +2502,90 @@ public final class CraftServer implements Server {
@@ -2510,6 +2510,90 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME));
}

Datei anzeigen

@ -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
index 01596f87ee078fceeb3f2f29bbb2500e63e9efb8..f8c2d91958d6e4a1452fcf32c16fa8b97ea271a2 100644
index f1d5c2d423dc015cc7720a4544370895f3cc644b..d6eab2a0fdbafc35efa7ed5b404357391565f4f3 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 {

Datei anzeigen

@ -5,18 +5,18 @@ 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 e858d32c7e8e228a1f0327a33054671ad105c2eb..24563a43f25d4621291b1ba6f24773cccedddbfe 100644
index 0c20a334be4b1c4cf7999826f8d9bff5e36bc2b8..6d58a30a588ec98bc343ab0ab82be82d9cf0618c 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
@@ -47,6 +47,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -46,6 +46,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
public final int[] cookingProgress;
public final int[] cookingTime;
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck;
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);
@@ -54,6 +55,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -53,6 +54,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
this.cookingProgress = new int[4];
this.cookingTime = new int[4];
this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
@ -24,7 +24,7 @@ index e858d32c7e8e228a1f0327a33054671ad105c2eb..24563a43f25d4621291b1ba6f24773cc
}
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
@@ -64,7 +66,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -63,7 +65,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (!itemstack.isEmpty()) {
flag = true;
@ -33,8 +33,8 @@ index e858d32c7e8e228a1f0327a33054671ad105c2eb..24563a43f25d4621291b1ba6f24773cc
+ } // Paper - Add more Campfire API
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@@ -177,6 +181,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(itemstack);
@@ -176,6 +180,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
}
@ -51,7 +51,7 @@ index e858d32c7e8e228a1f0327a33054671ad105c2eb..24563a43f25d4621291b1ba6f24773cc
}
@Override
@@ -185,6 +199,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -184,6 +198,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
ContainerHelper.saveAllItems(nbt, this.items, true, registryLookup);
nbt.putIntArray("CookingTimes", this.cookingProgress);
nbt.putIntArray("CookingTotalTimes", this.cookingTime);

Datei anzeigen

@ -44,7 +44,7 @@ index 12b7d50f49a2184aaf220a4a50a137b217c57124..f1237f6fd6414900ffbad0caee31aa83
public void close() throws IOException {
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
index 9748b798f55ee0cbfdce1a2b2c48700623ef17a5..c4eef3aade889c69cefd873bec2d031cc54103ea 100644
index 7d4aa3d375bde32e0d2606346202929d481acad0..36e914b26de070035f195f67c65ee1df0d10daf0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -147,10 +147,17 @@ public class RegionFileStorage implements AutoCloseable {
@ -78,9 +78,9 @@ index 9748b798f55ee0cbfdce1a2b2c48700623ef17a5..c4eef3aade889c69cefd873bec2d031c
}
// Paper start - Chunk save reattempt
return;
@@ -204,4 +208,13 @@ public class RegionFileStorage implements AutoCloseable {
}
@@ -208,4 +212,13 @@ public class RegionFileStorage implements AutoCloseable {
public RegionStorageInfo info() {
return this.info;
}
+
+ // Paper start - don't write garbage data to disk if writing serialization fails

Datei anzeigen

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 22 Dec 2020 13:52:48 -0800
Subject: [PATCH] Add EntityDamageItemEvent
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index e5fbb6dac3b1869797f2141e82993374a9f18e94..1b062edcc04af4c500f38c1664b5cee25e265f3c 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -647,7 +647,7 @@ public final class ItemStack implements DataComponentHolder {
return (Integer) this.getOrDefault(DataComponents.MAX_DAMAGE, 0);
}
- public void hurtAndBreak(int amount, RandomSource random, @Nullable ServerPlayer player, Runnable breakCallback) {
+ public void hurtAndBreak(int amount, RandomSource random, @Nullable LivingEntity player, Runnable breakCallback) { // Paper - Add EntityDamageItemEvent
if (this.isDamageableItem()) {
int j;
@@ -663,8 +663,8 @@ public final class ItemStack implements DataComponentHolder {
amount -= k;
// CraftBukkit start
- if (player != null) {
- PlayerItemDamageEvent event = new PlayerItemDamageEvent(player.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (player instanceof ServerPlayer serverPlayer) { // Paper - Add EntityDamageItemEvent
+ PlayerItemDamageEvent event = new PlayerItemDamageEvent(serverPlayer.getBukkitEntity(), CraftItemStack.asCraftMirror(this), amount); // Paper - Add EntityDamageItemEvent
event.getPlayer().getServer().getPluginManager().callEvent(event);
if (amount != event.getDamage() || event.isCancelled()) {
@@ -675,6 +675,14 @@ public final class ItemStack implements DataComponentHolder {
}
amount = event.getDamage();
+ // Paper start - Add EntityDamageItemEvent
+ } else if (player != null) {
+ io.papermc.paper.event.entity.EntityDamageItemEvent event = new io.papermc.paper.event.entity.EntityDamageItemEvent(player.getBukkitLivingEntity(), CraftItemStack.asCraftMirror(this), amount);
+ if (!event.callEvent()) {
+ return;
+ }
+ amount = event.getDamage();
+ // Paper end - Add EntityDamageItemEvent
}
// CraftBukkit end
if (amount <= 0) {
@@ -682,8 +690,8 @@ public final class ItemStack implements DataComponentHolder {
}
}
- if (player != null && amount != 0) {
- CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(player, this, this.getDamageValue() + amount);
+ if (player instanceof ServerPlayer serverPlayer && amount != 0) { // Paper - Add EntityDamageItemEvent
+ CriteriaTriggers.ITEM_DURABILITY_CHANGED.trigger(serverPlayer, this, this.getDamageValue() + amount); // Paper - Add EntityDamageItemEvent
}
j = this.getDamageValue() + amount;
@@ -716,7 +724,7 @@ public final class ItemStack implements DataComponentHolder {
entityplayer = null;
}
- this.hurtAndBreak(amount, randomsource, entityplayer, () -> {
+ this.hurtAndBreak(amount, randomsource, entity, () -> { // Paper - Add EntityDamageItemEvent
entity.broadcastBreakEvent(slot);
Item item = this.getItem();
// CraftBukkit start - Check for item breaking

Datei anzeigen

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 13 Aug 2021 15:00:06 -0700
Subject: [PATCH] Clear bucket NBT after dispense
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index dc68ade2ed576020a4a40608243059d6d9d82f19..f880f9faa1e5660853f28c0e2daf4ab6bc6a55fd 100644
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -444,8 +444,7 @@ public interface DispenseItemBehavior {
Item item = Items.BUCKET;
stack.shrink(1);
if (stack.isEmpty()) {
- stack.setItem(Items.BUCKET);
- stack.setCount(1);
+ stack = new ItemStack(item); // Paper - Clear bucket NBT after dispense
} else if (pointer.blockEntity().addItem(new ItemStack(item)) < 0) {
this.defaultDispenseItemBehavior.dispense(pointer, new ItemStack(item));
}

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 16 May 2021 09:39:46 -0700
Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 56de24f923571aff124ae64b737cbdf482d4b847..5d4fa3823a6dbb6150e4b97cf3973eb254018e38 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3312,6 +3312,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else {
// CraftBukkit start
worldserver = shapedetectorshape.world;
+ // Paper start - Call EntityPortalExitEvent
+ Vec3 position = shapedetectorshape.pos;
+ float yaw = shapedetectorshape.yRot;
+ float pitch = this.getXRot(); // Keep entity pitch as per moveTo line below
+ Vec3 velocity = shapedetectorshape.speed;
+ CraftEntity bukkitEntity = this.getBukkitEntity();
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(bukkitEntity,
+ bukkitEntity.getLocation(), new Location(worldserver.getWorld(), position.x, position.y, position.z, yaw, pitch),
+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(shapedetectorshape.speed));
+ event.callEvent();
+ if (this.isRemoved()) {
+ return null;
+ }
+
+ if (!event.isCancelled() && event.getTo() != null) {
+ worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
+ position = CraftLocation.toVec3D(event.getTo());
+ yaw = event.getTo().getYaw();
+ pitch = event.getTo().getPitch();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
+ }
+ // Paper end - Call EntityPortalExitEvent
if (worldserver == this.level) {
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
@@ -3331,8 +3353,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (entity != null) {
entity.restoreFrom(this);
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
- entity.setDeltaMovement(shapedetectorshape.speed);
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - EntityPortalExitEvent
+ entity.setDeltaMovement(velocity); // Paper - EntityPortalExitEvent
// CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
if (this.inWorld) {
worldserver.addDuringTeleport(entity);