mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-21 18:15:54 +01:00
Patch me this, patch me that
This commit is contained in:
parent
457d03534d
commit
80de05ff33
@ -440,7 +440,7 @@ index 535e0438b02fd7c10aee0d24786a6e38c6e48359..c132b4d4d871eaeadec78921a99ba706
|
||||
|
||||
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 474f330f381aa74e9f2fd0accdbaf2617ec1c557..834516cac1f3ac5f078dd4e4dfa449f39462658c 100644
|
||||
index 474f330f381aa74e9f2fd0accdbaf2617ec1c557..199abd66d2113e7bc8c478fe8e4f6657d2e12304 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -902,8 +902,15 @@ public class CraftEventFactory {
|
||||
@ -463,7 +463,7 @@ index 474f330f381aa74e9f2fd0accdbaf2617ec1c557..834516cac1f3ac5f078dd4e4dfa449f3
|
||||
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage);
|
||||
event.setKeepInventory(keepInventory);
|
||||
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||
+populateFields(victim, event); // Paper - make cancellable
|
||||
+ populateFields(victim, event); // Paper - make cancellable
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ // Paper start - make cancellable
|
||||
+ if (event.isCancelled()) {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 834516cac1f3ac5f078dd4e4dfa449f39462658c..41f23ce732b6e90828b1bbda7f4b3470cd462c4a 100644
|
||||
index 199abd66d2113e7bc8c478fe8e4f6657d2e12304..0627e3be754dbf8201f3212cf823e2f8cb77cdeb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -411,13 +411,18 @@ public class CraftEventFactory {
|
||||
|
@ -122,7 +122,7 @@ index e20565cf256aacd012a1722c5ebbf9016bc82e42..59fbfe8de2dc5ec020dd61a5e446b0b6
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 41f23ce732b6e90828b1bbda7f4b3470cd462c4a..0b9c96105bea9a0d1af17b7ecf4479d3596faa80 100644
|
||||
index 0627e3be754dbf8201f3212cf823e2f8cb77cdeb..6b094f8bdf1f25d5c2e108eb88d95aed4a41f6f3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -903,6 +903,11 @@ public class CraftEventFactory {
|
||||
|
@ -77,7 +77,7 @@ index 5a7d314ec0562e472f5dc45924a7b24841cff126..650e4a01cecc4cc08e7ff9ebcc4c3670
|
||||
public java.util.UUID getTriggerEntityId() {
|
||||
return getHandle().triggerEntityId;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0b9c96105bea9a0d1af17b7ecf4479d3596faa80..b40117e9940ab493ea4a945dbd9754a38b1159b9 100644
|
||||
index 6b094f8bdf1f25d5c2e108eb88d95aed4a41f6f3..cb708c5ce9e81005d638f03e398e7f0f2b9f7521 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -712,15 +712,29 @@ public class CraftEventFactory {
|
||||
|
@ -94,10 +94,10 @@ index 0fb0ee5b22dc96c48d68e4391fd71b03d4e799f0..97837d1baf6b929a50e5562ef466050e
|
||||
|
||||
private void setupRecipeList(ItemStack stack) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index b40117e9940ab493ea4a945dbd9754a38b1159b9..62f4fd6553ab0310e2c0dde1d917c63679365798 100644
|
||||
index cb708c5ce9e81005d638f03e398e7f0f2b9f7521..876644a1b5d119c3420e3042b576e34878797d67 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1679,6 +1679,12 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1679,6 +1679,12 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) {
|
||||
@ -110,7 +110,7 @@ index b40117e9940ab493ea4a945dbd9754a38b1159b9..62f4fd6553ab0310e2c0dde1d917c636
|
||||
PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone());
|
||||
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
event.getInventory().setItem(2, event.getResult());
|
||||
@@ -1686,6 +1692,12 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1686,6 +1692,12 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
|
||||
@ -123,7 +123,7 @@ index b40117e9940ab493ea4a945dbd9754a38b1159b9..62f4fd6553ab0310e2c0dde1d917c636
|
||||
PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
|
||||
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
event.getInventory().setItem(2, event.getResult());
|
||||
@@ -1693,12 +1705,39 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1693,12 +1705,39 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {
|
||||
|
@ -7,7 +7,7 @@ Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 62f4fd6553ab0310e2c0dde1d917c63679365798..c7d78f54694b464696c0f1edd0b135d1d5bcde3e 100644
|
||||
index 876644a1b5d119c3420e3042b576e34878797d67..629936b6266dadcac9d9a1fd584e7ba6b67a0002 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -377,10 +377,11 @@ public class CraftEventFactory {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index c7d78f54694b464696c0f1edd0b135d1d5bcde3e..9e3037ac041da5ec2e15a4cd475ec52fee591aac 100644
|
||||
index 629936b6266dadcac9d9a1fd584e7ba6b67a0002..9f97216a4be562acb69281f4a638dad139c6bc7d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -312,6 +312,10 @@ public class CraftEventFactory {
|
||||
|
@ -32,10 +32,10 @@ index a08e8571f3a83afc80c2f1758a9029cd28ed6947..91b514967405115f22edf4255775361a
|
||||
} else {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 9e3037ac041da5ec2e15a4cd475ec52fee591aac..4d7ac961b35b747ba5369ec1bdb6a9d78281f5d7 100644
|
||||
index 9f97216a4be562acb69281f4a638dad139c6bc7d..1e918ef9296e5127b78a7eb0460225448982772e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2125,4 +2125,12 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -2125,4 +2125,12 @@ public class CraftEventFactory {
|
||||
return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
|
||||
}
|
||||
// Paper end - WitchReadyPotionEvent
|
||||
|
@ -29,10 +29,10 @@ index 91b514967405115f22edf4255775361a672e5c2f..ddecf443df3679e3098eb54edd19585a
|
||||
} else {
|
||||
// CraftBukkit start - Fire event when pushing items into other inventories
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 4d7ac961b35b747ba5369ec1bdb6a9d78281f5d7..12aeb922c8a53eff9ba8e2c765d87df497611362 100644
|
||||
index 1e918ef9296e5127b78a7eb0460225448982772e..a25e814978a2f19fa6fe74aaa5c529a524240d71 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2132,5 +2132,11 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -2132,5 +2132,11 @@ public class CraftEventFactory {
|
||||
io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block);
|
||||
return event.callEvent();
|
||||
}
|
||||
|
@ -139,10 +139,10 @@ index 4b44830ef5d08887274ebb39e2780606fe3a76b4..d3a7953a3f42a0020342845e9107c699
|
||||
flag1 = true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 12aeb922c8a53eff9ba8e2c765d87df497611362..cee72eb02ebba4f50a117876351b8f516ba12057 100644
|
||||
index a25e814978a2f19fa6fe74aaa5c529a524240d71..5064dd8c97f45f0c4e2d1402500e7cf67a263dfa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1596,8 +1596,10 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1596,8 +1596,10 @@ public class CraftEventFactory {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerRecipeBookSettingsChangeEvent(player.getBukkitEntity(), bukkitType, open, filter));
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index cee72eb02ebba4f50a117876351b8f516ba12057..1ce637a2b80dfc5c3da20f7bd95b97f4718a07d4 100644
|
||||
index 5064dd8c97f45f0c4e2d1402500e7cf67a263dfa..a5c9ff3a2f06e7207ae4fcaf69be8bd0c874d4e2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -461,13 +461,30 @@ public class CraftEventFactory {
|
||||
|
@ -143,7 +143,7 @@ index 224e768963d6969f25608065d37ad72d82acda68..d6ac07d9d5ee0430a1d91b7084b378aa
|
||||
|
||||
public boolean isLingering() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 1ce637a2b80dfc5c3da20f7bd95b97f4718a07d4..83648509a5b90daa4b072650cbc3215b64659a86 100644
|
||||
index a5c9ff3a2f06e7207ae4fcaf69be8bd0c874d4e2..e6b22f24eba945863bb625b40319e6874ff25534 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -884,6 +884,32 @@ public class CraftEventFactory {
|
||||
|
@ -61,10 +61,10 @@ index bc167c21f82ad09952f6cdbf1016523062890f8b..44bcb1117cfa4d66c500011489ae193a
|
||||
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 83648509a5b90daa4b072650cbc3215b64659a86..376563ea6990aef558a34e4f5889125412b734df 100644
|
||||
index e6b22f24eba945863bb625b40319e6874ff25534..a9ba62a9d605234d993b6e5330889795099af391 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1078,7 +1078,7 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1078,7 +1078,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;
|
||||
@ -73,7 +73,7 @@ index 83648509a5b90daa4b072650cbc3215b64659a86..376563ea6990aef558a34e4f58891254
|
||||
} else if (damager != null || source.getDirectEntity() != null) {
|
||||
DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1104,7 +1104,7 @@ public class CraftEventFactory {
|
||||
cause = DamageCause.MAGIC;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ index 83648509a5b90daa4b072650cbc3215b64659a86..376563ea6990aef558a34e4f58891254
|
||||
} 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)) {
|
||||
@@ -1164,13 +1164,13 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1164,13 +1164,13 @@ public class CraftEventFactory {
|
||||
cause = DamageCause.CUSTOM;
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ index e374b9f40eddca13b30855d25a2030f8df98138f..4fc893378fb0568ddcffc7593d66df6b
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 376563ea6990aef558a34e4f5889125412b734df..412f5e414745123535a275d5670b35fff5b1aaec 100644
|
||||
index a9ba62a9d605234d993b6e5330889795099af391..e0418c0c36aa99ea43dbf39fa176ddf8855e0568 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -841,19 +841,19 @@ public class CraftEventFactory {
|
||||
|
@ -196,10 +196,10 @@ index 674d710ff88db5eced9e017284d1b7ec7a4fe7cd..72320c6099a4b26235bab68570e7b7ef
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 412f5e414745123535a275d5670b35fff5b1aaec..f7e26e381c2a2fec70cc2df01a12e7dbeeab48cd 100644
|
||||
index e0418c0c36aa99ea43dbf39fa176ddf8855e0568..f54a4c263eeb4df40c72c20c3c480ce74718a718 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1378,11 +1378,11 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1378,11 +1378,11 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ index a706f0855fdf88cc9aece3ba00ef574b9cd8bd11..2aee9c2fbe38076317a3de7c3fdbd698
|
||||
this.interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
this.interactPosition = blockposition.immutable();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index f7e26e381c2a2fec70cc2df01a12e7dbeeab48cd..cb05a94f2856a8bfb478bceb7c8712bc5e7ad5c2 100644
|
||||
index f54a4c263eeb4df40c72c20c3c480ce74718a718..ea0241de1a7ef64059cddcb43c41f56b91901897 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -555,6 +555,12 @@ public class CraftEventFactory {
|
||||
|
@ -69,10 +69,10 @@ index 0395b120590552518a85f36a46b68532e936de49..7f70237a274fde0fb97880c1d4724615
|
||||
this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F);
|
||||
} // Paper - Call EntityDropItemEvent
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index cb05a94f2856a8bfb478bceb7c8712bc5e7ad5c2..145a278a1b6d9e79c27136e84d8ccea8834c07bc 100644
|
||||
index ea0241de1a7ef64059cddcb43c41f56b91901897..d63b9c666cf6eb1de114c5c89867b8d233267c9e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2195,4 +2195,28 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -2195,4 +2195,28 @@ public class CraftEventFactory {
|
||||
return event.callEvent();
|
||||
}
|
||||
// Paper end
|
||||
|
@ -49,10 +49,10 @@ index 76d8f0d390abf588886b42b6d2e3ed6f79a4d991..cdc53abb5572fa57b4ec98a694c5583a
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 145a278a1b6d9e79c27136e84d8ccea8834c07bc..ac25a5c933b8748ca44ca02100058992b1aad358 100644
|
||||
index d63b9c666cf6eb1de114c5c89867b8d233267c9e..dd0d19faccbc49b5f9718e2df9f004bb17a9ef7e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1284,10 +1284,10 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1284,10 +1284,10 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,10 @@ index 5793569ae8a088f21b0d8d6771a5099b1e88be09..f8f570a97789ab16e57774f233506a28
|
||||
for (int k = 0; k < 5; ++k) {
|
||||
worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index ac25a5c933b8748ca44ca02100058992b1aad358..22244f38bfee746f14c969de05bc028c934c6d6b 100644
|
||||
index dd0d19faccbc49b5f9718e2df9f004bb17a9ef7e..38c8f69dff0abe62fc405a9fbb29c80d45aa675f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -2196,6 +2196,32 @@ populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -2196,6 +2196,32 @@ public class CraftEventFactory {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 22244f38bfee746f14c969de05bc028c934c6d6b..03afabc3ab4b264f84698627b79e58f502a8cea9 100644
|
||||
index 38c8f69dff0abe62fc405a9fbb29c80d45aa675f..449380c97dc332ecd43e308fcf110c9548930600 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -744,7 +744,8 @@ public class CraftEventFactory {
|
||||
|
@ -18,7 +18,7 @@ index 3bd4ab8161c29bb8df2ba496a4430393b6593476..0da6496c18341c01fc4551ead7e740a6
|
||||
if (blockEvent.isCancelled()) {
|
||||
// Let the client know the block still exists
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 03afabc3ab4b264f84698627b79e58f502a8cea9..0bf830b51f078d1a642e1bbec6cd8b6e83501135 100644
|
||||
index 449380c97dc332ecd43e308fcf110c9548930600..c5f9d9aeeb1fc61edb0e57cef51f5f6371861000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -660,13 +660,13 @@ public class CraftEventFactory {
|
||||
|
@ -10,10 +10,10 @@ public net.minecraft.world.level.dimension.end.EndDragonFight respawnCrystals
|
||||
public net.minecraft.world.level.dimension.end.EndDragonFight spawnNewGateway(Lnet/minecraft/core/BlockPos;)V
|
||||
|
||||
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 bf39f006efef529db697ed4dccbd1657a2673b79..4a0479fcff94bf6a1f239c1f694202345cdea1d4 100644
|
||||
index 3701cdc9f0e71d19a1090cf179bac9d5b8c4759a..7389cecae1a46d652170bf0cfc5e731a230d4e5a 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
|
||||
@@ -441,6 +441,24 @@ public class EndDragonFight {
|
||||
@@ -442,6 +442,24 @@ public class EndDragonFight {
|
||||
this.gateways.clear();
|
||||
}
|
||||
|
@ -5,33 +5,33 @@ Subject: [PATCH] Add PlayerPickItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 7750660defe490bcdc24a3b4ad4f495c8a703fed..be0ce72bb493593a3d2eb7d7c37e3a650b7cc34b 100644
|
||||
index f21a5b9de17db9a094b22267b33bbffbf7ef8966..c6f51c3a1c0ff9bc6b6bfe3c7091be324a2129ed 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -935,8 +935,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -939,7 +939,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
- this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
|
||||
// Paper end - validate pick item position
|
||||
+ // Paper start - Add PlayerPickItemEvent
|
||||
+ // this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed - moved down
|
||||
+ Player bukkitPlayer = this.player.getBukkitEntity();
|
||||
+ int targetSlot = this.player.getInventory().getSuitableHotbarSlot();
|
||||
+ int sourceSlot = packet.getSlot();
|
||||
+
|
||||
+ io.papermc.paper.event.player.PlayerPickItemEvent event = new io.papermc.paper.event.player.PlayerPickItemEvent(bukkitPlayer, targetSlot, sourceSlot);
|
||||
+ if (!event.callEvent()) return;
|
||||
+
|
||||
+ this.player.getInventory().pickSlot(event.getSourceSlot(), event.getTargetSlot());
|
||||
+ // Paper end - Add PlayerPickItemEvent
|
||||
this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, this.player.getInventory().selected, this.player.getInventory().getItem(this.player.getInventory().selected)));
|
||||
this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot())));
|
||||
this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected));
|
||||
+
|
||||
+ this.player.getInventory().pickSlot(event.getSourceSlot(), event.getTargetSlot()); // Paper - Add PlayerPickItemEvent
|
||||
// Paper end - validate pick item position
|
||||
int i = this.player.getInventory().selected;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index 688ed0c32b05b0135b94ec05738cdc6ff8dcb677..a62e7354bf67a66bdf9cd7c8f5d2e8f6bcacc74f 100644
|
||||
index 8bdc2dd7e6b6824f4df5dce8bff5e87fa73d3d3a..aaff1592876ac4a967e4fd47e4b6619a17d57867 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -171,7 +171,13 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -170,7 +170,13 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public void pickSlot(int slot) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow trident custom damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
index e45c3a9805d9fac1fabe6d891c817743acd9969e..44c733c5b2c3e9942f28e882ad72306a24459c2c 100644
|
||||
index 248410547de380e3195bbdc8b7b39cff908a0c32..322733266fdca8ce43434a8ffea304c51794bcbb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
|
||||
@@ -36,16 +36,19 @@ public class ThrownTrident extends AbstractArrow {
|
||||
@ -28,7 +28,7 @@ index e45c3a9805d9fac1fabe6d891c817743acd9969e..44c733c5b2c3e9942f28e882ad72306a
|
||||
this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack));
|
||||
this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil());
|
||||
}
|
||||
@@ -129,7 +132,7 @@ public class ThrownTrident extends AbstractArrow {
|
||||
@@ -136,7 +139,7 @@ public class ThrownTrident extends AbstractArrow {
|
||||
@Override
|
||||
protected void onHitEntity(EntityHitResult entityHitResult) {
|
||||
Entity entity = entityHitResult.getEntity();
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose hand in BlockCanBuildEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 7180996027f70aef7afe32fb2adfce6431429401..fc7d978f9e57814a933b9cb725c3af1e7d403795 100644
|
||||
index d59120f0304823361cc4112f5583323945df4229..986b14a7b7c98641201ece649df09e4b8279a36c 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -191,7 +191,7 @@ public class BlockItem extends Item {
|
||||
@@ -185,7 +185,7 @@ public class BlockItem extends Item {
|
||||
boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true); // Paper - Cancel hit for vanished players
|
||||
org.bukkit.entity.Player player = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null;
|
||||
|
||||
@ -18,7 +18,7 @@ index 7180996027f70aef7afe32fb2adfce6431429401..fc7d978f9e57814a933b9cb725c3af1e
|
||||
|
||||
return event.isBuildable();
|
||||
diff --git a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
index 39b8b3675ac58409e05fac07e07c8016c5280d81..f8f909ebdad5e96379e8bd8c610164ef0697368e 100644
|
||||
index 81915cec3ec372d1ff59160b96399b8c6e693eba..1451b25cedb7a8f01c046c8e1f8c6853aca42283 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
@@ -59,7 +59,7 @@ public class StandingAndWallBlockItem extends BlockItem {
|
@ -14,7 +14,7 @@ ensure that the returned found structure (which may for example be a buried
|
||||
treasure that will be marked on a treasure map) is the same as in vanilla.
|
||||
|
||||
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 102de569415ef011dacdca9a6ea8134d0ef62454..29697fad32dad3377eebc82d280ba48d3c1ad516 100644
|
||||
index 906f56d07c26ef3c2dc1a3b62e9349dd91a37742..4cbc68d8e950f8d7c8b00535b82e916964c88ce0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -265,12 +265,15 @@ public abstract class ChunkGenerator {
|
@ -23,10 +23,10 @@ index 2c2c4db31a746b4eb853dc04c6b3e5631bbfa034..4f4e3ee18d586f61706504218cddc06a
|
||||
public String getName() {
|
||||
Player player = this.getPlayer();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index a3912d4de96a6bb2b9b3977705fa3facb891f73d..a1b870fb3d1fd5d209474c47bf523d0d5d58ce39 100644
|
||||
index b6093a1bbd8176cde85ef034373ae71f9dd8f1c1..3f55fbf41a85e71a62628db18fde4afb3dd923c3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -256,6 +256,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -257,6 +257,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.server.getPlayer(this.getUniqueId()) != null;
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ Co-authored-by: Minecrell <minecrell@minecrell.net>
|
||||
Co-authored-by: Newwind <support@newwindserver.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 7270b6fa96bae937663c0fea77887e21fbd0eb57..530728cd4b258444f6efe064903b521f4b23cd04 100644
|
||||
index 1a7d2ade0e85dd5e6cd6c9202e3277cc2fa43d4a..37defbc0674e67a26e5a9aebb811310ef12878ee 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -400,6 +400,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
@@ -460,6 +460,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
|
||||
// Use method to resend items in hands in case of client desync, because the item use got cancelled.
|
||||
// For example, when cancelling the leash event
|
||||
@ -22,10 +22,10 @@ index 7270b6fa96bae937663c0fea77887e21fbd0eb57..530728cd4b258444f6efe064903b521f
|
||||
this.containerMenu.findSlot(this.getInventory(), this.getInventory().selected).ifPresent(s -> {
|
||||
this.containerSynchronizer.sendSlotChange(this.containerMenu, s, this.getMainHandItem());
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index be0ce72bb493593a3d2eb7d7c37e3a650b7cc34b..0ffa95542a0ed49a3f83700841f7c76c0717ae22 100644
|
||||
index c6f51c3a1c0ff9bc6b6bfe3c7091be324a2129ed..fe23c77efae996dfa6c3530c11e51202bccca378 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2729,10 +2729,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -2741,10 +2741,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
// Refresh the current entity metadata
|
||||
entity.refreshEntityData(ServerGamePacketListenerImpl.this.player);
|
||||
// SPIGOT-7136 - Allays
|
||||
@ -40,10 +40,10 @@ index be0ce72bb493593a3d2eb7d7c37e3a650b7cc34b..0ffa95542a0ed49a3f83700841f7c76c
|
||||
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 84d283cd637b5c84a8682acec503b0e3831d1684..bd0e205c760414784ae483452fd02292939dcb5c 100644
|
||||
index a8a5b28d95f7c3ce944f51993dd0c0eb98e3c550..ba57deb4e10bba180429cca4d8c864ab869065c7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2638,8 +2638,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2752,8 +2752,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (!this.level().isClientSide()) {
|
||||
// CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) {
|
||||
@ -55,7 +55,7 @@ index 84d283cd637b5c84a8682acec503b0e3831d1684..bd0e205c760414784ae483452fd02292
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
index 5a7b1be351834a6b8889b1380cede1be025cb302..e336934f37075a827843e4b1bb2b6b660d2c60c9 100644
|
||||
index d99760f943846a1cfe5d0ec97313f453004feb98..3e00bbff266fc71b07014e7e047d77b7f809239f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java
|
||||
@@ -101,6 +101,7 @@ public class Cow extends Animal {
|
||||
@ -67,10 +67,10 @@ index 5a7b1be351834a6b8889b1380cede1be025cb302..e336934f37075a827843e4b1bb2b6b66
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 02e49c7ae5e120302b6479cf3e3934b9217eebf0..376bcbc189008464f4d518c1e07643431ba96306 100644
|
||||
index f745a554b9b84a53d9bd942ca9908153fb0a668c..ec3edd2eefc398dac9058e082c52a98dc48db36d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -234,6 +234,7 @@ public class Goat extends Animal {
|
||||
@@ -238,6 +238,7 @@ public class Goat extends Animal {
|
||||
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level(), player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@ -79,7 +79,7 @@ index 02e49c7ae5e120302b6479cf3e3934b9217eebf0..376bcbc189008464f4d518c1e0764343
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ArmorStandItem.java b/src/main/java/net/minecraft/world/item/ArmorStandItem.java
|
||||
index 1634a7d5ff06583408cf2f02f2b5f90931b1e02a..066a6e5ed2632a55324ec0d10f2f8a6bf3f30a0f 100644
|
||||
index 15c7c2417db1661c77c35455b59a77b1d1055858..cb4baebe22eeab17aed67a5ecc506b932fe2230b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorStandItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorStandItem.java
|
||||
@@ -55,6 +55,7 @@ public class ArmorStandItem extends Item {
|
||||
@ -91,10 +91,10 @@ index 1634a7d5ff06583408cf2f02f2b5f90931b1e02a..066a6e5ed2632a55324ec0d10f2f8a6b
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index fc7d978f9e57814a933b9cb725c3af1e7d403795..96fb69ec6db2e7c8c728435f0c537b076259b2fb 100644
|
||||
index 986b14a7b7c98641201ece649df09e4b8279a36c..c816c935ecc74a811ffdffbe6ded73c06e92324a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -114,7 +114,7 @@ public class BlockItem extends Item {
|
||||
@@ -108,7 +108,7 @@ public class BlockItem extends Item {
|
||||
if (placeEvent != null && (placeEvent.isCancelled() || !placeEvent.canBuild())) {
|
||||
blockstate.update(true, false);
|
||||
|
||||
@ -104,7 +104,7 @@ index fc7d978f9e57814a933b9cb725c3af1e7d403795..96fb69ec6db2e7c8c728435f0c537b07
|
||||
}
|
||||
return InteractionResult.FAIL;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/EndCrystalItem.java b/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
index f9a940cdff3983d9d4de46bd5ddc1905f9254dcf..273bb38f14b8af08d123e02742d365fb5d91cdf5 100644
|
||||
index 5311e653dceb085fcebb8ac5090d84e97e573e62..48317c7436445a7acff9103bac1de558c42f31cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
@@ -49,6 +49,7 @@ public class EndCrystalItem extends Item {
|
||||
@ -116,14 +116,14 @@ index f9a940cdff3983d9d4de46bd5ddc1905f9254dcf..273bb38f14b8af08d123e02742d365fb
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/item/MinecartItem.java b/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
index 66074445d3908b9bb1c8d70e1e27d057720ec8e5..d524fcc191cb95d6ec7f12ae7fceeb8077bb08fc 100644
|
||||
index 04eb25b05681a72968917b0b59c030d6629776fa..7153d9ed12276a0f2d8b8a17c79734aa25ed1fa5 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/MinecartItem.java
|
||||
@@ -137,6 +137,7 @@ public class MinecartItem extends Item {
|
||||
@@ -69,6 +69,7 @@ public class MinecartItem extends Item {
|
||||
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(context, entityminecartabstract).isCancelled()) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(context, entityminecartabstract).isCancelled()) {
|
||||
+ if (context.getPlayer() != null) context.getPlayer().containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
// CraftBukkit end
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
// CraftBukkit end
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add titleOverride to InventoryOpenEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 530728cd4b258444f6efe064903b521f4b23cd04..b65d816bb9feb18ecf74e10e9728c302e5657587 100644
|
||||
index 37defbc0674e67a26e5a9aebb811310ef12878ee..b0b4bede6f25b8a0de54d954c7010021f87aadc3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1656,12 +1656,17 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
@@ -1924,12 +1924,17 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
this.nextContainerCounter();
|
||||
AbstractContainerMenu container = factory.createMenu(this.containerCounter, this.getInventory(), this);
|
||||
|
||||
@ -27,7 +27,7 @@ index 530728cd4b258444f6efe064903b521f4b23cd04..b65d816bb9feb18ecf74e10e9728c302
|
||||
if (container == null && !cancelled) { // Let pre-cancelled events fall through
|
||||
// SPIGOT-5263 - close chest if cancelled
|
||||
if (factory instanceof Container) {
|
||||
@@ -1683,7 +1688,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
@@ -1951,7 +1956,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
this.containerMenu = container;
|
||||
@ -37,7 +37,7 @@ index 530728cd4b258444f6efe064903b521f4b23cd04..b65d816bb9feb18ecf74e10e9728c302
|
||||
this.initMenu(container);
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index b782cc64426a058881947ed62316c1cb8d332037..7dcfb45c24d7743956be514c7d554e06aac77b3e 100644
|
||||
index 7dddf4dd090fcd9e86b147d7e4ddeaa99800713e..4312290ad970f71e1dc25b707ab312c597a481a9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -366,12 +366,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
@ -79,10 +79,10 @@ index b782cc64426a058881947ed62316c1cb8d332037..7dcfb45c24d7743956be514c7d554e06
|
||||
if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper - Prevent opening inventories when frozen
|
||||
player.containerMenu = container;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 6b241ec85f360ec79f18b911175d7092861024a4..2690c471b819f8308f6db44150025dfa323d4e0c 100644
|
||||
index c5f9d9aeeb1fc61edb0e57cef51f5f6371861000..dbef230ae88ee1bfbc20ba53b534434c3ccac985 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1403,10 +1403,21 @@ public class CraftEventFactory {
|
||||
@@ -1401,10 +1401,21 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container) {
|
||||
@ -105,7 +105,7 @@ index 6b241ec85f360ec79f18b911175d7092861024a4..2690c471b819f8308f6db44150025dfa
|
||||
if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open
|
||||
player.connection.handleContainerClose(new ServerboundContainerClosePacket(player.containerMenu.containerId), InventoryCloseEvent.Reason.OPEN_NEW); // Paper - Inventory close reason
|
||||
}
|
||||
@@ -1421,10 +1432,10 @@ public class CraftEventFactory {
|
||||
@@ -1419,10 +1430,10 @@ public class CraftEventFactory {
|
||||
|
||||
if (event.isCancelled()) {
|
||||
container.transferTo(player.containerMenu, craftPlayer);
|
@ -5,10 +5,10 @@ Subject: [PATCH] Configure sniffer egg hatch time
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||
index b943384eb6a4612993556036f0d3beec6939a559..ffe5e14cf8190774c8935513ebeb041eda81f912 100644
|
||||
index c6b7cfd78bc0c4cb64eada507876c293541890f4..ec04fcc23c86d34a6dc1eaadda7f9d876f3d8ffe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
||||
@@ -62,7 +62,7 @@ public class SnifferEggBlock extends Block {
|
||||
@@ -63,7 +63,7 @@ public class SnifferEggBlock extends Block {
|
||||
|
||||
// Paper start - Call BlockFadeEvent
|
||||
private void rescheduleTick(ServerLevel world, BlockPos pos) {
|
||||
@ -17,7 +17,7 @@ index b943384eb6a4612993556036f0d3beec6939a559..ffe5e14cf8190774c8935513ebeb041e
|
||||
world.scheduleTick(pos, this, (baseDelay / 3) + world.random.nextInt(RANDOM_HATCH_OFFSET_TICKS));
|
||||
// reschedule to avoid being stuck here and behave like the other calls (see #onPlace)
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class SnifferEggBlock extends Block {
|
||||
@@ -105,7 +105,7 @@ public class SnifferEggBlock extends Block {
|
||||
world.levelEvent(3009, pos, 0);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ some servers that have players placing end crystals as a style of combat.
|
||||
The very cheap distance check prevents running the entity lookup every time.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/EndCrystalItem.java b/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
index 273bb38f14b8af08d123e02742d365fb5d91cdf5..5f51e64cb0611a4ba6bdcdcacbcba1063a7f3a5c 100644
|
||||
index 48317c7436445a7acff9103bac1de558c42f31cc..b62db8c7c8c57e43869ee239ebf4b02f112355d9 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EndCrystalItem.java
|
||||
@@ -30,7 +30,7 @@ public class EndCrystalItem extends Item {
|
||||
@ -34,10 +34,10 @@ index 273bb38f14b8af08d123e02742d365fb5d91cdf5..5f51e64cb0611a4ba6bdcdcacbcba106
|
||||
}
|
||||
|
||||
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 4a0479fcff94bf6a1f239c1f694202345cdea1d4..84300f2f7b7be4f5281edd8e263646dbcbb3ba07 100644
|
||||
index 7389cecae1a46d652170bf0cfc5e731a230d4e5a..c90ad702df2fe5c796d041afc04523a0318d9565 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
|
||||
@@ -560,6 +560,12 @@ public class EndDragonFight {
|
||||
@@ -563,6 +563,12 @@ public class EndDragonFight {
|
||||
}
|
||||
|
||||
public boolean tryRespawn() { // CraftBukkit - return boolean
|
||||
@ -50,7 +50,7 @@ index 4a0479fcff94bf6a1f239c1f694202345cdea1d4..84300f2f7b7be4f5281edd8e263646db
|
||||
if (this.dragonKilled && this.respawnStage == null) {
|
||||
BlockPos blockposition = this.portalLocation;
|
||||
|
||||
@@ -577,6 +583,22 @@ public class EndDragonFight {
|
||||
@@ -580,6 +586,22 @@ public class EndDragonFight {
|
||||
blockposition = this.portalLocation;
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 0ffa95542a0ed49a3f83700841f7c76c0717ae22..d377804026f3f5cf80a623228d24e09c56ef0dae 100644
|
||||
index fe23c77efae996dfa6c3530c11e51202bccca378..8b5be8870a0077b82e345027b323b8b4f448f231 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2986,6 +2986,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -3003,6 +3003,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
break;
|
||||
case SWAP:
|
||||
if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) {
|
||||
@ -22,10 +22,10 @@ index 0ffa95542a0ed49a3f83700841f7c76c0717ae22..d377804026f3f5cf80a623228d24e09c
|
||||
Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum());
|
||||
if (clickedSlot.mayPickup(this.player)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 0e380151b038e2133013eb7d73621cf247b5b954..afd8f48bd41d2cac413c292f7988c903da1dc700 100644
|
||||
index fc23e2dc42e907d5f8dc134a06102cc3e7fde515..22dc1569aabe69f139d9682ceb81311993706cb8 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -460,6 +460,7 @@ public abstract class AbstractContainerMenu {
|
||||
this.resetQuickCraft();
|
||||
}
|
||||
} else if (this.quickcraftStatus == 1) {
|
||||
@ -33,7 +33,7 @@ index 0e380151b038e2133013eb7d73621cf247b5b954..afd8f48bd41d2cac413c292f7988c903
|
||||
slot = (Slot) this.slots.get(slotIndex);
|
||||
itemstack = this.getCarried();
|
||||
if (AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && (this.quickcraftType == 2 || itemstack.getCount() > this.quickcraftSlots.size()) && this.canDragTo(slot)) {
|
||||
@@ -597,6 +598,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -634,6 +635,7 @@ public abstract class AbstractContainerMenu {
|
||||
int j2;
|
||||
|
||||
if (actionType == ClickType.SWAP && (button >= 0 && button < 9 || button == 40)) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Call BlockRedstoneEvents for lecterns
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
||||
index 751ff3d51f8ae57f847c3acf7a7cd663a6ae1c68..0c52e1f8bc233bb66e53f4c69e1d8757382bbe81 100644
|
||||
index 44d322d26187bd7528799069d0e08dbf571a57f3..3537795720be76483579fc50715914974c97c9c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
||||
@@ -179,6 +179,16 @@ public class LecternBlock extends BaseEntityBlock {
|
||||
@@ -180,6 +180,16 @@ public class LecternBlock extends BaseEntityBlock {
|
||||
}
|
||||
|
||||
private static void changePowered(Level world, BlockPos pos, BlockState state, boolean powered) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Allow proper checking of empty item stacks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 4d29c34e221b749b6972c7ed79ac1f86da999ed7..c5a09f086d35f84c0a30266f78e06e2dfb5603e6 100644
|
||||
index 134db8c2dd72d0651fc889cc8931e7c971f62deb..30eba68435387daa3917fa2b3071892c350d9ddc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -40,12 +40,19 @@ public final class CraftItemStack extends ItemStack {
|
||||
@@ -45,12 +45,19 @@ public final class CraftItemStack extends ItemStack {
|
||||
}
|
||||
// Paper end - MC Utils
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix silent equipment change for mobs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index e87360e21e6eb7b0161c34a3ac6cb83d18bcd1e8..cf1f6a0081f0dbcf43842ec23accf6c3ae9b79d8 100644
|
||||
index ac7a52e77fd2fcbe9f95709b95ba54f8c2a6514b..8a0e65ac8318a467996f48b423db1ac621359fbe 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1106,19 +1106,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -1100,19 +1100,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
|
||||
@ -39,10 +39,10 @@ index e87360e21e6eb7b0161c34a3ac6cb83d18bcd1e8..cf1f6a0081f0dbcf43842ec23accf6c3
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 6627126ab02dbd5e9d1de6b186d75d850ef11280..3b5cf6ffb74d11bea5eb21bd66d679734ff5000c 100644
|
||||
index 0cb179bc28cc863b09a079b37b957744f26f3e1d..32670a3cb4b54b66d655197e3fde834d2b2b6d34 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -254,8 +254,8 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@@ -258,8 +258,8 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
// Paper end - shouldBurnInDay API
|
||||
|
||||
@Override
|
@ -18,7 +18,7 @@ index db41ffbd24adccd78edf3368ba1f7a3ab9f6072c..5db5ba026462ca642dcee718af732f80
|
||||
void setMaxStackSize(int size);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
index 6632cf24ebe6d147950a1fdb876660937da86b73..d04bf7d06855022c973073fb84c5d3d65f2553e1 100644
|
||||
index b0963c534afe5be164701cb283f1849e32ae5a86..7ed52b887c4d766c23220a8809914d5d80f12ea4 100644
|
||||
--- a/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
@@ -30,7 +30,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
||||
@ -57,10 +57,10 @@ index 6632cf24ebe6d147950a1fdb876660937da86b73..d04bf7d06855022c973073fb84c5d3d6
|
||||
public SimpleContainer(int i, org.bukkit.inventory.InventoryHolder owner) {
|
||||
this.bukkitOwner = owner;
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index afd8f48bd41d2cac413c292f7988c903da1dc700..8a1035c0aa859f67a6806c183d96a88ddf760baa 100644
|
||||
index 22dc1569aabe69f139d9682ceb81311993706cb8..85caec29a705f216eff8a5ae11f250697891a05c 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -991,4 +991,15 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -1054,4 +1054,15 @@ public abstract class AbstractContainerMenu {
|
||||
this.stateId = this.stateId + 1 & 32767;
|
||||
return this.stateId;
|
||||
}
|
||||
@ -77,7 +77,7 @@ index afd8f48bd41d2cac413c292f7988c903da1dc700..8a1035c0aa859f67a6806c183d96a88d
|
||||
+ // Paper end - Add missing InventoryHolders
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
index a735aeeb59f79154ce797c6e2f5600305f46d217..b93c118d957f0a2f40e2f31fd6400bd69438cf72 100644
|
||||
index c0dfa04511110be366ee5b0bd75efc51afcce2e4..e0ee1c10960d24d2369d16f22431a8e02a5570aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
||||
@@ -42,7 +42,7 @@ public class BeaconMenu extends AbstractContainerMenu {
|
||||
@ -90,7 +90,7 @@ index a735aeeb59f79154ce797c6e2f5600305f46d217..b93c118d957f0a2f40e2f31fd6400bd6
|
||||
public boolean canPlaceItem(int slot, ItemStack stack) {
|
||||
return stack.is(ItemTags.BEACON_PAYMENT_ITEMS);
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
index c52c4c4210bc6ae082443318d9795c48c816aba6..ab98637bf967ac19f0bc06e8cb7f18a8b13ec809 100644
|
||||
index 8b72d1fd551dcb113f4137aee441a9531c00288a..b3a16b024e46ee8203b225ee429a5c973eab12c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
@@ -54,7 +54,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
|
||||
@ -148,7 +148,7 @@ index 85e336637db8643fc5aca1dba724c9b341cbf46f..12b466ccb7c36021cf807c4f3fd2bcb0
|
||||
@Override
|
||||
public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> getter) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
index 2fa009b33bccd6aeee30f23f9207ab039740d95d..fff1c39920e7d7051dfe3dd39c77865d3bdf113e 100644
|
||||
index 2642d8ddc79ad97675f958c89ef03da39903f359..36496144dd6fa87163b692034570eba70c83678c 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
@@ -63,7 +63,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
@ -161,7 +161,7 @@ index 2fa009b33bccd6aeee30f23f9207ab039740d95d..fff1c39920e7d7051dfe3dd39c77865d
|
||||
public void setChanged() {
|
||||
super.setChanged();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 15ec798e149d80aace186f84b9236ddeaba690c3..1678f6c8b2c7db761783e53043169bf12bc2cb29 100644
|
||||
index 8e58dbb4b110338dfe8add26697d0b1c9ec5fa9c..3b303d41b9facfb2892ff8402ee0de4608db7318 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -60,8 +60,8 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
@ -176,37 +176,49 @@ index 15ec798e149d80aace186f84b9236ddeaba690c3..1678f6c8b2c7db761783e53043169bf1
|
||||
public void setChanged() {
|
||||
super.setChanged();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
index be840717e180b6b5abd14db6cc9263349737f9a3..7de5e47f9a54263734eeef855a2dc07ef64d30ea 100644
|
||||
index 4734dd90f2a66e1ac7a64b35ecd62a630108cf07..a5d53a656513ae81cc3f9fc506caf6adaba62a8e 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -18,7 +18,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
@@ -17,12 +17,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
protected final ContainerLevelAccess access;
|
||||
protected final Player player;
|
||||
protected final Container inputSlots;
|
||||
private final List<Integer> inputSlotIndexes;
|
||||
- protected final ResultContainer resultSlots = new ResultContainer();
|
||||
- protected final ResultContainer resultSlots = new ResultContainer() {
|
||||
- @Override
|
||||
- public void setChanged() {
|
||||
- ItemCombinerMenu.this.slotsChanged(this);
|
||||
- }
|
||||
- };
|
||||
+ protected final ResultContainer resultSlots; // Paper - Add missing InventoryHolders; delay field init
|
||||
private final int resultSlotIndex;
|
||||
|
||||
protected abstract boolean mayPickup(Player player, boolean present);
|
||||
@@ -30,6 +30,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
public ItemCombinerMenu(@Nullable MenuType<?> type, int syncId, Inventory playerInventory, ContainerLevelAccess context) {
|
||||
protected boolean mayPickup(Player player, boolean present) {
|
||||
@@ -36,6 +31,14 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
public ItemCombinerMenu(@Nullable MenuType<?> type, int syncId, Inventory playerInventory, ContainerLevelAccess context, ItemCombinerMenuSlotDefinition forgingSlotsManager) {
|
||||
super(type, syncId);
|
||||
this.access = context;
|
||||
+ this.resultSlots = new ResultContainer(this.createBlockHolder(this.access)); // Paper - Add missing InventoryHolders; delay field init
|
||||
+ // Paper start - Add missing InventoryHolders; delay field init
|
||||
+ this.resultSlots = new ResultContainer(this.createBlockHolder(this.access)) {
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ ItemCombinerMenu.this.slotsChanged(this);
|
||||
+ }
|
||||
+ };
|
||||
+ // Paper end - Add missing InventoryHolders; delay field init
|
||||
this.player = playerInventory.player;
|
||||
ItemCombinerMenuSlotDefinition itemcombinermenuslotdefinition = this.createInputSlotDefinitions();
|
||||
|
||||
@@ -96,7 +97,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
protected abstract ItemCombinerMenuSlotDefinition createInputSlotDefinitions();
|
||||
this.inputSlots = this.createContainer(forgingSlotsManager.getNumOfInputSlots());
|
||||
this.resultSlotIndex = forgingSlotsManager.getResultSlotIndex();
|
||||
@@ -82,7 +85,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
public abstract void createResult();
|
||||
|
||||
private SimpleContainer createContainer(int size) {
|
||||
- return new SimpleContainer(size) {
|
||||
+ return new SimpleContainer(this.createBlockHolder(this.access), size) { // Paper - Add missing InventoryHolders
|
||||
+ return new SimpleContainer(this.createBlockHolder(this.access), size) {
|
||||
@Override
|
||||
public void setChanged() {
|
||||
super.setChanged();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
index dc23b646e55bb66e0aa584d82b75b4b3d233276a..2c0e182f7b03ed0f87c259af4df9c4e52106220d 100644
|
||||
index 1b7cf165ab0818792870f43719a6324b282bb57a..98519dd3bccca516acdedc69a59189b1106fb75b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
@@ -73,7 +73,7 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
@ -261,7 +273,7 @@ index d4592218d761eb38402e3d95c642e80a708cb333..4c4266a85c38e41e6c7e6144a68624f4
|
||||
public ResultContainer() {
|
||||
this.itemStacks = NonNullList.withSize(1, ItemStack.EMPTY);
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index 37e75c02c374314372630f4bda0b92519809f2a4..5a0015f761f6a25d7bb7b9cfe7a9b4771a6a37ec 100644
|
||||
index a93870952e2ef674028b8a20aa52a685c743e7ea..ca65965757e6f12abc972250a04817c7547bb0bd 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -69,7 +69,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sun, 18 Jun 2023 23:04:46 -0700
|
||||
Subject: [PATCH] Do not read tile entities in chunks that are positioned
|
||||
outside of the chunk
|
||||
|
||||
The tile entities are not accessible and so should not be loaded.
|
||||
This can happen as a result of users moving regionfiles around,
|
||||
which would cause a crash on Folia but would appear to function
|
||||
fine on Paper.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
|
||||
index d7a204216332ccbd6bece23bd507be0366ea4d61..b86b3bf713668999a21c4120b1d16c295531b2ad 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
|
||||
@@ -363,6 +363,13 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
|
||||
|
||||
while (iterator2.hasNext()) {
|
||||
nbttagcompound = (CompoundTag) iterator2.next();
|
||||
+ // Paper start - do not read tile entities positioned outside the chunk
|
||||
+ final BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
|
||||
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
||||
+ LOGGER.warn("Tile entity serialized in chunk {} in world '{}' positioned at {} is located outside of the chunk", chunkPos, world.getWorld().getName(), blockposition);
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end - do not read tile entities positioned outside the chunk
|
||||
protochunk1.setBlockEntityNbt(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -616,6 +623,13 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
|
||||
chunk.setBlockEntityNbt(nbttagcompound);
|
||||
} else {
|
||||
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
|
||||
+ // Paper start - do not read tile entities positioned outside the chunk
|
||||
+ ChunkPos chunkPos = chunk.getPos();
|
||||
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
||||
+ LOGGER.warn("Tile entity serialized in chunk " + chunkPos + " in world '" + world.getWorld().getName() + "' positioned at " + blockposition + " is located outside of the chunk");
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end - do not read tile entities positioned outside the chunk
|
||||
BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound, world.registryAccess());
|
||||
|
||||
if (tileentity != null) {
|
@ -14,10 +14,10 @@ field by calling any method on the class, and for convenience
|
||||
we use values().
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||
index 22b6d0851a51da180cd8fbbe6554c5370f5ac5bd..cd9b65f278a750a0177a3252271015d43172b2e9 100644
|
||||
index ce3d79ebc7f933d0b34b3f8f71bbec872076847a..ce84851c0c2bf9a066fd5e07be8635d3dcaea0b9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java
|
||||
@@ -140,6 +140,7 @@ public class UpgradeData {
|
||||
@@ -153,6 +153,7 @@ public class UpgradeData {
|
||||
Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type();
|
||||
level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority());
|
||||
});
|
@ -7,10 +7,10 @@ Subject: [PATCH] Fix missing map initialize event call
|
||||
public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 1ed6002501b501e72bfff81ae9abc506133a10d0..c13652fccf08ff9235f22e89941a37b283f92f03 100644
|
||||
index 1cb5e107a391ab56942cdb2d1cae7d5646a85ec6..39dba6c2e9de2c1d6716945a49d48d9b76a07c77 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1664,13 +1664,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1726,13 +1726,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@Nullable
|
||||
@Override
|
||||
public MapItemSavedData getMapData(MapId id) {
|
@ -5,13 +5,13 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 23ed0a130525a0b3a1b41330685476463c81f183..b07c8111daa010dee2bb8be52162aafa4c267f1f 100644
|
||||
index a4998c2df341a1b9a337afb24284428cd98e59d8..fa3add7cc39997d137b9dbc2178e08e9a6e5f31a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -308,9 +308,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(key);
|
||||
|
||||
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);
|
||||
JsonElement jsonelement = JsonParser.parseString(advancement);
|
||||
- net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement).getOrThrow(JsonParseException::new);
|
||||
+ final net.minecraft.resources.RegistryOps<JsonElement> ops = CraftRegistry.getMinecraftRegistry().createSerializationContext(JsonOps.INSTANCE); // Paper - use RegistryOps
|
||||
+ final net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(ops, jsonelement).getOrThrow(JsonParseException::new); // Paper - use RegistryOps
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API
|
||||
Implements API for getting and resetting a player's idle duration.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index a1b870fb3d1fd5d209474c47bf523d0d5d58ce39..1d79bacbfb24442573245550263141ad56332971 100644
|
||||
index 3f55fbf41a85e71a62628db18fde4afb3dd923c3..6de8cd1961a3d5bb50043cc4f1135a981e398666 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3419,6 +3419,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3432,6 +3432,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Don't check if we can see non-visible entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 57af5d1986021c9a135599c6f55b091aebd3bab7..6c667823c2ef15766f3afc1a9c819cb6c24b0912 100644
|
||||
index 49d926313b0d0f2ed2e93ca824009c8d0a988f67..29a28e160f6ca87d263b84fbf0c5429d30e34a21 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1537,7 +1537,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1596,7 +1596,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - Configurable entity tracking range by Y
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix NPE in SculkBloomEvent world access
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
index 8d95d129cae03af9ded699047742324807186994..a74732902c0494c67e6acf2fc04581ff9c46b832 100644
|
||||
index da81f76a2ee779ffedf9a02d91b5971004167725..4729befa12732a9fd65cce243b33b3b479026c41 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -35,9 +35,16 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
|
@ -5,10 +5,10 @@ Subject: [PATCH] Allow null itemstack for Player#sendEquipmentChange
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 1d79bacbfb24442573245550263141ad56332971..b2abaf6b535da13cdeeb99c568b91c585ac2ed20 100644
|
||||
index 6de8cd1961a3d5bb50043cc4f1135a981e398666..620977c5afae38b8769cea8ccd5e97b311da6fc3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1127,7 +1127,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1140,7 +1140,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void sendEquipmentChange(LivingEntity entity, EquipmentSlot slot, ItemStack item) {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add API to get the collision shape of a block before it's
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
index 64ddd6d1c40dc91b6e7fc3118403415bb4533d97..0daa0bf7e56aa7228d89867500cb780b37f06541 100644
|
||||
index 3ec64c995dcb59a758741e32b886925983a8be56..50fb7edd25c1b38f5c463b78d21d4583bdc89229 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
||||
@@ -679,6 +679,20 @@ public class CraftBlockData implements BlockData {
|
||||
@@ -683,6 +683,20 @@ public class CraftBlockData implements BlockData {
|
||||
return this.state.isFaceSturdy(EmptyBlockGetter.INSTANCE, BlockPos.ZERO, CraftBlock.blockFaceToNotch(face), CraftBlockSupport.toNMS(support));
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add predicate for blocks when raytracing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||
index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa35cfa5fd3 100644
|
||||
index cc9ae2122b563d7b583c7335d0a8ce227f9b1af4..d00ebcd6fccbf1d1efe83604ed86d317119be5f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||
@@ -70,6 +70,12 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||
@@ -71,6 +71,12 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||
|
||||
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
|
||||
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
|
||||
@ -21,7 +21,7 @@ index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa3
|
||||
// Paper start - Prevent raytrace from loading chunks
|
||||
BlockState iblockdata = this.getBlockStateIfLoaded(blockposition);
|
||||
if (iblockdata == null) {
|
||||
@@ -79,7 +85,7 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||
@@ -80,7 +86,7 @@ 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
|
||||
@ -30,7 +30,7 @@ index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa3
|
||||
FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: don't need to go to world state again
|
||||
Vec3 vec3d = raytrace1.getFrom();
|
||||
Vec3 vec3d1 = raytrace1.getTo();
|
||||
@@ -95,8 +101,14 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||
@@ -96,8 +102,14 @@ public interface BlockGetter extends LevelHeightAccessor {
|
||||
// CraftBukkit end
|
||||
|
||||
default BlockHitResult clip(ClipContext context) {
|
||||
@ -47,10 +47,10 @@ index c978f3b2d42f512e982f289e76c2422e41b7eec6..bb8e962e63c7a2d931f9bd7f7c002aa3
|
||||
Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo());
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index cb50fca4867688d2572e8ab5b7fef7243c5b8ba9..7ada46aa24e1bc15207a34c15b056e4e76238757 100644
|
||||
index 536ad499e893c5b9898fb02582eeca541c917890..a81d9f5920de0bd6e54d199cccad96f7f8cebb05 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1106,9 +1106,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1116,9 +1116,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize, Predicate<? super Entity> filter) {
|
||||
@ -68,7 +68,7 @@ index cb50fca4867688d2572e8ab5b7fef7243c5b8ba9..7ada46aa24e1bc15207a34c15b056e4e
|
||||
|
||||
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
|
||||
direction.checkFinite();
|
||||
@@ -1158,9 +1164,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1168,9 +1174,16 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
|
||||
@ -87,7 +87,7 @@ index cb50fca4867688d2572e8ab5b7fef7243c5b8ba9..7ada46aa24e1bc15207a34c15b056e4e
|
||||
|
||||
Preconditions.checkArgument(direction != null, "Vector direction cannot be null");
|
||||
direction.checkFinite();
|
||||
@@ -1173,16 +1186,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1183,16 +1196,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
}
|
||||
|
||||
Vector dir = direction.clone().normalize().multiply(maxDistance);
|
@ -6,10 +6,10 @@ Subject: [PATCH] Broadcast take item packets with collector as source
|
||||
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4e96a65396b687d2823f2229744f5d448ba87512..04232f281ebd46954ef2259962c7bfc43b8a8aeb 100644
|
||||
index 95bbde31de42e1e12d722de86085e59050f1c3ae..c0646a4c023a34d4ca516390d748d29d7b9c265b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3749,7 +3749,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3893,7 +3893,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public void take(Entity item, int count) {
|
||||
if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expand LingeringPotion API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
index 5c6cb752f61c3f3c2960a337173fb7dfe86cc1d3..86c4b593a97431efd062b8c9d86bf92269c00536 100644
|
||||
index e78eef3b6fbcd657f9dd180df4cb2eeb55d0814f..9d79b193fe2a737a20d1709548b2cd6c454ff27b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -274,7 +274,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
@@ -276,7 +276,7 @@ public class ThrownPotion extends ThrowableItemProjectile {
|
||||
boolean noEffects = potioncontents.hasEffects(); // Paper - Fix potions splash events
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix strikeLightningEffect powers lightning rods and clears
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
index 0471d9c85af02133f99cca4e181b83b58a3f1abc..4f701788bd21b61cad251a3a88f9bc416fb99051 100644
|
||||
index 152ecd38814089333b8d61538297ce720756d2c3..12127b14babf646711d3a118416453c4f1ac1460 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
||||
@@ -47,6 +47,7 @@ public class LightningBolt extends Entity {
|
||||
@@ -48,6 +48,7 @@ public class LightningBolt extends Entity {
|
||||
private ServerPlayer cause;
|
||||
private final Set<Entity> hitEntities = Sets.newHashSet();
|
||||
private int blocksSetOnFire;
|
||||
@ -17,7 +17,7 @@ index 0471d9c85af02133f99cca4e181b83b58a3f1abc..4f701788bd21b61cad251a3a88f9bc41
|
||||
|
||||
public LightningBolt(EntityType<? extends LightningBolt> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -87,7 +88,7 @@ public class LightningBolt extends Entity {
|
||||
@@ -86,7 +87,7 @@ public class LightningBolt extends Entity {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@ -26,7 +26,7 @@ index 0471d9c85af02133f99cca4e181b83b58a3f1abc..4f701788bd21b61cad251a3a88f9bc41
|
||||
if (this.level().isClientSide()) {
|
||||
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false);
|
||||
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false);
|
||||
@@ -134,7 +135,7 @@ public class LightningBolt extends Entity {
|
||||
@@ -133,7 +134,7 @@ public class LightningBolt extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,22 +35,22 @@ index 0471d9c85af02133f99cca4e181b83b58a3f1abc..4f701788bd21b61cad251a3a88f9bc41
|
||||
if (!(this.level() instanceof ServerLevel)) {
|
||||
this.level().setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -163,7 +164,7 @@ public class LightningBolt extends Entity {
|
||||
@@ -162,7 +163,7 @@ public class LightningBolt extends Entity {
|
||||
}
|
||||
|
||||
private void spawnFire(int spreadAttempts) {
|
||||
- if (!this.visualOnly && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
+ if (!this.visualOnly && !this.isEffect && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { // Paper - Properly handle lightning effects api
|
||||
BlockPos blockposition = this.blockPosition();
|
||||
BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition);
|
||||
- if (!this.visualOnly) {
|
||||
+ if (!this.visualOnly && !this.isEffect) { // Paper - Properly handle lightning effects api
|
||||
Level world = this.level();
|
||||
|
||||
if (world instanceof ServerLevel) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 166458785b507208caa7ecf8ee8b60650ca3523a..7200c336de27ffd4d37231768ff5192956ede972 100644
|
||||
index a81d9f5920de0bd6e54d199cccad96f7f8cebb05..b8bb6ae33a78b7fb152d0068f54cd7c5b046ebdd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -736,7 +736,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -742,7 +742,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world);
|
||||
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world, EntitySpawnReason.COMMAND);
|
||||
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||
- lightning.setVisualOnly(isVisual);
|
||||
+ lightning.isEffect = isVisual; // Paper - Properly handle lightning effects api
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add hand to fish event for all player interactions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb5e011819 100644
|
||||
index 1f95234c0a1457050574aa0f6c4b2a8c91b1f272..5b49b11d2d88b33731df582b119ef7a680d862e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -482,7 +482,15 @@ public class FishingHook extends Projectile {
|
||||
@@ -487,7 +487,15 @@ public class FishingHook extends Projectile {
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {}
|
||||
|
||||
@ -24,7 +24,7 @@ index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb
|
||||
net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner();
|
||||
|
||||
if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) {
|
||||
@@ -490,7 +498,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -495,7 +503,7 @@ public class FishingHook extends Projectile {
|
||||
|
||||
if (this.hookedIn != null) {
|
||||
// CraftBukkit start
|
||||
@ -33,7 +33,7 @@ index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb
|
||||
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
@@ -519,7 +527,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -524,7 +532,7 @@ public class FishingHook extends Projectile {
|
||||
}
|
||||
// Paper end
|
||||
// CraftBukkit start
|
||||
@ -42,7 +42,7 @@ index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb
|
||||
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
@@ -553,7 +561,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -558,7 +566,7 @@ public class FishingHook extends Projectile {
|
||||
|
||||
if (this.onGround()) {
|
||||
// CraftBukkit start
|
||||
@ -51,7 +51,7 @@ index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb
|
||||
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
@@ -564,7 +572,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -569,7 +577,7 @@ public class FishingHook extends Projectile {
|
||||
}
|
||||
// CraftBukkit start
|
||||
if (i == 0) {
|
||||
@ -61,10 +61,10 @@ index e70ca1b2e6fbbc1f20e65429298d01b4ebd2dd29..270f4c94912b16c7d4a2d62670847cbb
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
return 0;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java
|
||||
index 364c3090057405f83130089d275baf1a61d8e0ca..efb21967fdd2c3b4cb35db6faf213d55da5fc30e 100644
|
||||
index 5a50f3391d73fe881b8219d9da05c1dc45533251..801a513d67637136a15307a98fc6bbec9d202b00 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/FishingRodItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java
|
||||
@@ -30,7 +30,7 @@ public class FishingRodItem extends Item {
|
||||
@@ -31,7 +31,7 @@ public class FishingRodItem extends Item {
|
||||
|
||||
if (user.fishing != null) {
|
||||
if (!world.isClientSide) {
|
@ -11,10 +11,10 @@ also changed. Also in several places, the breed item was stored after
|
||||
it was decreased by one to consume the item.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
index b46352b328178df2a48d1c9e895bed3fabd2c292..1808e1b01afa3041a54c9c9a7586d4d61960527a 100644
|
||||
index 775bfac26aaa6db998c2647ec81247b67d0bf784..5677dc97ed83652f261100cf391883cfac7d16fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
||||
@@ -148,8 +148,9 @@ public abstract class Animal extends AgeableMob {
|
||||
@@ -158,8 +158,9 @@ public abstract class Animal extends AgeableMob {
|
||||
int i = this.getAge();
|
||||
|
||||
if (!this.level().isClientSide && i == 0 && this.canFallInLove()) {
|
||||
@ -22,10 +22,10 @@ index b46352b328178df2a48d1c9e895bed3fabd2c292..1808e1b01afa3041a54c9c9a7586d4d6
|
||||
this.usePlayerItem(player, hand, itemstack);
|
||||
- this.setInLove(player);
|
||||
+ this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
return InteractionResult.SUCCESS;
|
||||
this.playEatingSound();
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
}
|
||||
|
||||
@@ -175,10 +176,18 @@ public abstract class Animal extends AgeableMob {
|
||||
@@ -201,10 +202,18 @@ public abstract class Animal extends AgeableMob {
|
||||
return this.inLove <= 0;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ index b46352b328178df2a48d1c9e895bed3fabd2c292..1808e1b01afa3041a54c9c9a7586d4d6
|
||||
return;
|
||||
}
|
||||
this.inLove = entityEnterLoveModeEvent.getTicksInLove();
|
||||
@@ -186,7 +195,7 @@ public abstract class Animal extends AgeableMob {
|
||||
@@ -212,7 +221,7 @@ public abstract class Animal extends AgeableMob {
|
||||
if (player != null) {
|
||||
this.loveCause = player.getUUID();
|
||||
}
|
||||
@ -54,10 +54,10 @@ index b46352b328178df2a48d1c9e895bed3fabd2c292..1808e1b01afa3041a54c9c9a7586d4d6
|
||||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||
index 293d6891948e99ac9bd741008f7dcbc5fc1a2e3d..e108f876d3f129c6287f13d68427aed2a6f0c5b1 100644
|
||||
index b654bec0fbe903fac24f3bb99399455bf367c68a..be753557d7ebd6f1e82b1bdb6d60ecc450f72eec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
||||
@@ -673,8 +673,9 @@ public class Panda extends Animal {
|
||||
@@ -653,8 +653,9 @@ public class Panda extends Animal {
|
||||
this.usePlayerItem(player, hand, itemstack);
|
||||
this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true);
|
||||
} else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) {
|
||||
@ -66,28 +66,13 @@ index 293d6891948e99ac9bd741008f7dcbc5fc1a2e3d..e108f876d3f129c6287f13d68427aed2
|
||||
- this.setInLove(player);
|
||||
+ this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying
|
||||
} else {
|
||||
if (this.level().isClientSide || this.isSitting() || this.isInWater()) {
|
||||
return InteractionResult.PASS;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
index 4eb305bc77767531efb6f9d299216248d4ee39d2..729fd2d52dd48e25ee7a077a3ffafc80ecef7c9f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -352,8 +352,8 @@ public class Armadillo extends Animal {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setInLove(@Nullable Player player) {
|
||||
- super.setInLove(player);
|
||||
+ public void setInLove(@Nullable Player player, @Nullable ItemStack breedItemCopy) { // Paper
|
||||
+ super.setInLove(player, breedItemCopy); // Paper
|
||||
this.makeSound(SoundEvents.ARMADILLO_EAT);
|
||||
}
|
||||
Level world = this.level();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index 0388b09e1c4f03958384680ed487792a54007463..8941752e4600ccd11b3fa1147b2e414785589eed 100644
|
||||
index c99d37a40c63726c11980adccc67d09fd5132885..f3c884ab9c09f04dd01cabf2ee9de3b5b620563d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -393,7 +393,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
@@ -395,7 +395,7 @@ public class Camel extends AbstractHorse {
|
||||
boolean flag1 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
|
||||
|
||||
if (flag1) {
|
||||
@ -97,10 +82,10 @@ index 0388b09e1c4f03958384680ed487792a54007463..8941752e4600ccd11b3fa1147b2e4147
|
||||
|
||||
boolean flag2 = this.isBaby();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index f1e43254936feedfe0ffbf77071505f3a65e5053..1f5ed236fb7c0c1b0181675747d25d233f534284 100644
|
||||
index 74151d69380e4adede40c7d7fc20834553706730..8aed30cdbbfdd42c20dcd4c8773c8a0ee21a980d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -572,7 +572,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@@ -585,7 +585,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
b0 = 5;
|
||||
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
|
||||
flag = true;
|
||||
@ -109,7 +94,7 @@ index f1e43254936feedfe0ffbf77071505f3a65e5053..1f5ed236fb7c0c1b0181675747d25d23
|
||||
}
|
||||
} else if (item.is(Items.GOLDEN_APPLE) || item.is(Items.ENCHANTED_GOLDEN_APPLE)) {
|
||||
f = 10.0F;
|
||||
@@ -580,7 +580,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@@ -593,7 +593,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
b0 = 10;
|
||||
if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) {
|
||||
flag = true;
|
||||
@ -119,10 +104,10 @@ index f1e43254936feedfe0ffbf77071505f3a65e5053..1f5ed236fb7c0c1b0181675747d25d23
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
index 82c57124433cc033c99e609e8ad71e03d340bc5e..cf6a3a63b6f2b96943c0f399e8c82d293fee31ba 100644
|
||||
index 4da66867109394c8966e27551d20b4bcdf4bc9be..18bd483fe46de3d9dc129bffbccfba9d4cab9550 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
@@ -179,7 +179,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
|
||||
@@ -177,7 +177,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
|
||||
f = 10.0F;
|
||||
if (this.isTamed() && this.getAge() == 0 && this.canFallInLove()) {
|
||||
flag = true;
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix missing event call for entity teleport API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 580427bf1521ac9fef37f7464e12a7bfe4fbfb10..9ca1fee03bfa557f1df7388c6043c9ec6d02a79a 100644
|
||||
index 9c8e2731ca37a16cb538da27190c085bbc9791e3..c1d3dd2bd217efd6914bceb1027fa12b06c22a55 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -258,6 +258,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -259,6 +259,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return false;
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ where generation happened directly to a ServerLevel and the
|
||||
entity still has the flag set.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 60c75f7c4258efb26c2595ca7724b08d3c046c9d..34ece37aee68e4d8eeaa919e8bd489a672756049 100644
|
||||
index 39dba6c2e9de2c1d6716945a49d48d9b76a07c77..e3df141a2a49f10e83fe132514a9b1d969cc4417 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1224,6 +1224,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1219,6 +1219,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
// CraftBukkit start
|
||||
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||
@ -31,10 +31,10 @@ index 60c75f7c4258efb26c2595ca7724b08d3c046c9d..34ece37aee68e4d8eeaa919e8bd489a6
|
||||
if (entity.valid) {
|
||||
MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index bd0e205c760414784ae483452fd02292939dcb5c..f163cb3c75e90b96b3794a7e0c5b803268814c8c 100644
|
||||
index ba57deb4e10bba180429cca4d8c864ab869065c7..1fb29f2c5e55d77eb5d04d423cf9f38a6e7d9f4c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -624,7 +624,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -631,7 +631,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (pose == this.getPose()) {
|
||||
return;
|
||||
}
|
||||
@ -48,30 +48,30 @@ index bd0e205c760414784ae483452fd02292939dcb5c..f163cb3c75e90b96b3794a7e0c5b8032
|
||||
this.entityData.set(Entity.DATA_POSE, pose);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 5fb3279342506611882b5780cfbee0371919c93c..b98f9246b60daf31460f41ce214dfa7c011f5684 100644
|
||||
index 6b2f0a4bc911888b72b796099760af38b1e28656..4eec58353343b414120e189afed04b98ae3e87c8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -592,9 +592,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
@@ -659,9 +659,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
}
|
||||
|
||||
public static Optional<Entity> create(CompoundTag nbt, Level world) {
|
||||
+ // Paper start - Don't fire sync event during generation
|
||||
public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason) {
|
||||
+ // Paper start - Don't fire sync event during generation
|
||||
+ return create(nbt, world, false);
|
||||
+ }
|
||||
+ public static Optional<Entity> create(CompoundTag nbt, Level world, boolean generation) {
|
||||
+ // Paper end - Don't fire sync event during generation
|
||||
+ public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason, boolean generation) {
|
||||
+ // Paper end - Don't fire sync event during generation
|
||||
return Util.ifElse(EntityType.by(nbt).map((entitytypes) -> {
|
||||
return entitytypes.create(world);
|
||||
return entitytypes.create(world, reason);
|
||||
}), (entity) -> {
|
||||
+ if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
|
||||
entity.load(nbt);
|
||||
}, () -> {
|
||||
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 04232f281ebd46954ef2259962c7bfc43b8a8aeb..0c67f04ae7eeaa10a90419031447ad5397c6b9e2 100644
|
||||
index c0646a4c023a34d4ca516390d748d29d7b9c265b..d37e6651b7be89b14ed5781e1a72fc1b8f50c103 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1138,6 +1138,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1161,6 +1161,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
||||
@ -83,7 +83,7 @@ index 04232f281ebd46954ef2259962c7bfc43b8a8aeb..0c67f04ae7eeaa10a90419031447ad53
|
||||
// org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
||||
if (this.isTickingEffects) {
|
||||
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
||||
@@ -1157,10 +1162,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1180,10 +1185,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
override = new MobEffectInstance(mobeffect1).update(mobeffect);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ index 04232f281ebd46954ef2259962c7bfc43b8a8aeb..0c67f04ae7eeaa10a90419031447ad53
|
||||
// CraftBukkit end
|
||||
|
||||
if (mobeffect1 == null) {
|
||||
@@ -1169,7 +1177,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1192,7 +1200,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
flag = true;
|
||||
mobeffect.onEffectAdded(this);
|
||||
// CraftBukkit start
|
||||
@ -107,7 +107,7 @@ index 04232f281ebd46954ef2259962c7bfc43b8a8aeb..0c67f04ae7eeaa10a90419031447ad53
|
||||
this.onEffectUpdated(mobeffect1, true, entity);
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
index f91ea9ac5a0d0d3bae5d1eb0c409f4f9c4e5a62b..9045f18f49a5c6685597d0a77126d7cb35bc5e88 100644
|
||||
index 6c2d4c2163cf299c0943af21d4dc367b5677c089..72e42605c278028480c368762da18f61806d766a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -172,7 +172,7 @@ public class Spider extends Monster {
|
||||
@ -120,46 +120,46 @@ index f91ea9ac5a0d0d3bae5d1eb0c409f4f9c4e5a62b..9045f18f49a5c6685597d0a77126d7cb
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
|
||||
index cf8258e8d46ca7286a66c38fa24af369bd9a279f..0555abfda468c343af8244a122ebe769e70a0292 100644
|
||||
index 734f511d197bc6bf2b02588069eb02c0224781f5..d35b731751e851bee531aa5e7996557658ba6fae 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
|
||||
@@ -525,7 +525,7 @@ public class StructureTemplate {
|
||||
@@ -549,7 +549,7 @@ public class StructureTemplate {
|
||||
private static Optional<Entity> createEntityIgnoreException(ServerLevelAccessor world, CompoundTag nbt) {
|
||||
// CraftBukkit start
|
||||
// try {
|
||||
- return EntityType.create(nbt, world.getLevel());
|
||||
+ return EntityType.create(nbt, world.getLevel(), true); // Paper - Don't fire sync event during generation
|
||||
- return EntityType.create(nbt, world.getLevel(), EntitySpawnReason.STRUCTURE);
|
||||
+ return EntityType.create(nbt, world.getLevel(), EntitySpawnReason.STRUCTURE, true); // Paper - Don't fire sync event during generation
|
||||
// } catch (Exception exception) {
|
||||
// return Optional.empty();
|
||||
// }
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
index 524b51a0ab808a0629c871ad813115abd4b49dbd..fceed3d08ee6f4c171685986bb19d2be592eedc6 100644
|
||||
index e444662ee4d9405eeea7caa41b9cd6b36586d840..54c4434662d057a08800918641b95708cda61207 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
@@ -92,15 +92,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
|
||||
@@ -90,15 +90,17 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
|
||||
return this.handle.getLevel();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void addFreshEntityWithPassengers(Entity arg0, CreatureSpawnEvent.SpawnReason arg1) {
|
||||
- this.handle.addFreshEntityWithPassengers(arg0, arg1);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void addFreshEntityWithPassengers(Entity entity) {
|
||||
- this.handle.addFreshEntityWithPassengers(entity);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void addFreshEntityWithPassengers(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
- this.handle.addFreshEntityWithPassengers(entity, reason);
|
||||
- }
|
||||
+ // Paper start - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
|
||||
+ // @Override
|
||||
+ // public void addFreshEntityWithPassengers(Entity arg0, CreatureSpawnEvent.SpawnReason arg1) {
|
||||
+ // this.handle.addFreshEntityWithPassengers(arg0, arg1);
|
||||
+ // }
|
||||
+ //
|
||||
+ // @Override
|
||||
+ // public void addFreshEntityWithPassengers(Entity entity) {
|
||||
+ // this.handle.addFreshEntityWithPassengers(entity);
|
||||
+ // }
|
||||
+ // Paper end - Don't fire sync event during generation; don't override these methods
|
||||
+ //
|
||||
+ // @Override
|
||||
+ // public void addFreshEntityWithPassengers(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // this.handle.addFreshEntityWithPassengers(entity, reason);
|
||||
+ // }
|
||||
+ // Paper end - Don't fire sync event during generation; don't override these methods so all entities are run through addFreshEntity
|
||||
|
||||
@Override
|
||||
public ServerLevel getMinecraftWorld() {
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add Structure check API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 7200c336de27ffd4d37231768ff5192956ede972..cb85180daaa2b40cba2474784548d650bc4d639b 100644
|
||||
index b8bb6ae33a78b7fb152d0068f54cd7c5b046ebdd..1675ad5818340f21c7e5b6982af315bcad30240b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -246,6 +246,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -250,6 +250,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
};
|
||||
}
|
||||
// Paper end
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix CraftMetaItem#getAttributeModifier duplication check
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index df34eba383c0d3035c8baed7fdd054ecdd681fa3..f15456b02cabbbe33d701450ef53a0561d91cb8c 100644
|
||||
index af78e73755743fb2db7a99b834affc963b44bc10..3bcc807005a677884255f1ee36cbf1653797ba55 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -1414,7 +1414,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1666,7 +1666,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null");
|
||||
this.checkAttributeList();
|
||||
for (Map.Entry<Attribute, AttributeModifier> entry : this.attributeModifiers.entries()) {
|
@ -9,16 +9,16 @@ on dropping the item instead of generalizing it for all dropped
|
||||
items like CB does.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a67636855f 100644
|
||||
index b0b4bede6f25b8a0de54d954c7010021f87aadc3..52b18f2c333b7535929bb4e52e65cf5fb0f5692f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -976,20 +976,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
@@ -1235,20 +1235,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||
if (this.isRemoved()) {
|
||||
return;
|
||||
}
|
||||
- java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<>(this.getInventory().getContainerSize());
|
||||
+ List<DefaultDrop> loot = new java.util.ArrayList<>(this.getInventory().getContainerSize()); // Paper - Restore vanilla drops behavior
|
||||
boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
boolean keepInventory = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
|
||||
if (!keepInventory) {
|
||||
for (ItemStack item : this.getInventory().getContents()) {
|
||||
@ -30,22 +30,22 @@ index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a6
|
||||
}
|
||||
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
|
||||
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
|
||||
this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0);
|
||||
this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0);
|
||||
- this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
|
||||
+ // Paper - Restore vanilla drops behaviour; custom death loot is a noop on server player, remove.
|
||||
|
||||
loot.addAll(this.drops);
|
||||
this.drops.clear(); // SPIGOT-5188: make sure to clear
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f163cb3c75e90b96b3794a7e0c5b803268814c8c..e88c88b6f87dddda8e8e3ed215a8f2c166afa3ef 100644
|
||||
index 1fb29f2c5e55d77eb5d04d423cf9f38a6e7d9f4c..0223f2e282a85882645f4ed52891c566a268f37b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2562,6 +2562,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2678,19 +2678,45 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
@Nullable
|
||||
public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) {
|
||||
public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset) {
|
||||
+ // Paper start - Restore vanilla drops behavior
|
||||
+ return this.spawnAtLocation(stack, yOffset, null);
|
||||
+ return this.spawnAtLocation(world, stack, yOffset, null);
|
||||
+ }
|
||||
+ public record DefaultDrop(Item item, org.bukkit.inventory.ItemStack stack, @Nullable java.util.function.Consumer<ItemStack> dropConsumer) {
|
||||
+ public DefaultDrop(final ItemStack stack, final java.util.function.Consumer<ItemStack> dropConsumer) {
|
||||
@ -61,12 +61,10 @@ index f163cb3c75e90b96b3794a7e0c5b803268814c8c..e88c88b6f87dddda8e8e3ed215a8f2c1
|
||||
+ }
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public ItemEntity spawnAtLocation(ItemStack stack, float yOffset, @Nullable java.util.function.Consumer<? super ItemEntity> delayedAddConsumer) {
|
||||
+ public ItemEntity spawnAtLocation(ServerLevel world, ItemStack stack, float yOffset, @Nullable java.util.function.Consumer<? super ItemEntity> delayedAddConsumer) {
|
||||
+ // Paper end - Restore vanilla drops behavior
|
||||
if (stack.isEmpty()) {
|
||||
return null;
|
||||
} else if (this.level().isClientSide) {
|
||||
@@ -2569,14 +2588,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
} else {
|
||||
// CraftBukkit start - Capture drops for death event
|
||||
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
|
||||
@ -82,7 +80,7 @@ index f163cb3c75e90b96b3794a7e0c5b803268814c8c..e88c88b6f87dddda8e8e3ed215a8f2c1
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY() + (double) yOffset, this.getZ(), stack.copy()); // Paper - copy so we can destroy original
|
||||
ItemEntity entityitem = new ItemEntity(world, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack);
|
||||
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
|
||||
|
||||
- entityitem.setDefaultPickUpDelay();
|
||||
@ -91,10 +89,10 @@ index f163cb3c75e90b96b3794a7e0c5b803268814c8c..e88c88b6f87dddda8e8e3ed215a8f2c1
|
||||
return this.spawnAtLocation(entityitem);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0c67f04ae7eeaa10a90419031447ad5397c6b9e2..6b2dc430126713e11658f94762035ff10bbe018c 100644
|
||||
index d37e6651b7be89b14ed5781e1a72fc1b8f50c103..0fcc5ed28b2371a62be57d7ea62f2e3dfedcf735 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -278,7 +278,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -291,7 +291,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected float appliedScale;
|
||||
// CraftBukkit start
|
||||
public int expToDrop;
|
||||
@ -104,16 +102,16 @@ index 0c67f04ae7eeaa10a90419031447ad5397c6b9e2..6b2dc430126713e11658f94762035ff1
|
||||
public boolean collides = true;
|
||||
public Set<UUID> collidableExemptions = new HashSet<>();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 1b49090a466bc74d9e5f2815314955b6dfbb83dc..62271e74399a827a488159da234465ef18e15e6e 100644
|
||||
index e6b18d7f8922cb42acb9e40bef2f71a56aea8646..e1be143959fbaa1d54af2a1a2c27187d70e6a9e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -538,10 +538,9 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
@@ -536,10 +536,10 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
@Override
|
||||
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
|
||||
super.dropCustomDeathLoot(world, source, causedByPlayer);
|
||||
- ItemEntity entityitem = this.spawnAtLocation((ItemLike) Items.NETHER_STAR);
|
||||
-
|
||||
+ ItemEntity entityitem = this.spawnAtLocation(new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), 0, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer
|
||||
- ItemEntity entityitem = this.spawnAtLocation(world, (ItemLike) Items.NETHER_STAR);
|
||||
+ ItemEntity entityitem = this.spawnAtLocation(world, new net.minecraft.world.item.ItemStack(Items.NETHER_STAR), 0, ItemEntity::setExtendedLifetime); // Paper - Restore vanilla drops behavior; spawnAtLocation returns null so modify the item entity with a consumer
|
||||
|
||||
if (entityitem != null) {
|
||||
- entityitem.setExtendedLifetime();
|
||||
+ entityitem.setExtendedLifetime(); // Paper - diff on change
|
||||
@ -121,10 +119,10 @@ index 1b49090a466bc74d9e5f2815314955b6dfbb83dc..62271e74399a827a488159da234465ef
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc14364e4de776 100644
|
||||
index 2bb2b36f793d25b6e49d1a72bb665cfa9f212730..63f02cdc67d9e88cc6998d0ae9d139c83e85b447 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -621,7 +621,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -619,7 +619,7 @@ public class ArmorStand extends LivingEntity {
|
||||
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
|
||||
|
||||
itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
|
||||
@ -133,7 +131,7 @@ index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc1436
|
||||
return this.brokenByAnything(world, damageSource); // Paper
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity {
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@ -142,7 +140,7 @@ index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc1436
|
||||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -643,7 +643,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -641,7 +641,7 @@ public class ArmorStand extends LivingEntity {
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@ -152,10 +150,10 @@ index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc1436
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d895333848b14a74 100644
|
||||
index dbef230ae88ee1bfbc20ba53b534434c3ccac985..fb75b7f84575c42ab5dcb7e9c5659cecf439da90 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -975,18 +975,24 @@ public class CraftEventFactory {
|
||||
@@ -973,19 +973,25 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource) {
|
||||
@ -175,16 +173,17 @@ index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d8953338
|
||||
+ return new Entity.DefaultDrop(CraftItemType.bukkitToMinecraft(stack.getType()), stack, null);
|
||||
+ };
|
||||
+
|
||||
+ public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<Entity.DefaultDrop> drops, Runnable lootCheck) { // Paper
|
||||
+ public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<Entity.DefaultDrop> drops, Runnable lootCheck) { // Paper - Restore vanilla drops behavior
|
||||
// Paper end
|
||||
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
|
||||
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
|
||||
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()));
|
||||
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(damageSource.getEntity())); // Paper - Restore vanilla drops behavior
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
CraftWorld world = (CraftWorld) entity.getWorld();
|
||||
- EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(world.getHandle(), damageSource.getEntity()));
|
||||
+ EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(world.getHandle(), damageSource.getEntity())); // Paper - Restore vanilla drops behavior, victim.getExpReward(world.getHandle(), damageSource.getEntity()));
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@@ -1000,20 +1006,24 @@ public class CraftEventFactory {
|
||||
|
||||
@@ -998,20 +1004,24 @@ public class CraftEventFactory {
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
lootCheck.run(); // Paper - advancement triggers before destroying items
|
||||
|
||||
@ -193,7 +192,7 @@ index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d8953338
|
||||
+ for (Entity.DefaultDrop drop : drops) {
|
||||
+ if (drop == null) continue;
|
||||
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
||||
+ // Paper end - Restore vanilla drops behavior
|
||||
+ // Paper end - Restore vanilla drops behavior
|
||||
if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
|
||||
|
||||
- world.dropItem(entity.getLocation(), stack); // Paper - note: dropItem already clones due to this being bukkit -> NMS
|
||||
@ -208,12 +207,12 @@ index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d8953338
|
||||
+ public static PlayerDeathEvent callPlayerDeathEvent(ServerPlayer victim, DamageSource damageSource, List<Entity.DefaultDrop> drops, net.kyori.adventure.text.Component deathMessage, boolean keepInventory) { // Paper - Adventure & Restore vanilla drops behavior
|
||||
CraftPlayer entity = victim.getBukkitEntity();
|
||||
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
|
||||
- PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
|
||||
+ PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(damageSource.getEntity()), 0, deathMessage); // Paper - Restore vanilla drops behavior
|
||||
- PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage);
|
||||
+ PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, new io.papermc.paper.util.TransformingRandomAccessList<>(drops, Entity.DefaultDrop::stack, FROM_FUNCTION), victim.getExpReward(victim.serverLevel(), damageSource.getEntity()), 0, deathMessage); // Paper - Restore vanilla drops behavior
|
||||
event.setKeepInventory(keepInventory);
|
||||
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -1031,16 +1041,14 @@ public class CraftEventFactory {
|
||||
@@ -1029,16 +1039,14 @@ public class CraftEventFactory {
|
||||
victim.expToDrop = event.getDroppedExp();
|
||||
victim.newExp = event.getNewExp();
|
||||
|
||||
@ -222,14 +221,14 @@ index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d8953338
|
||||
+ for (Entity.DefaultDrop drop : drops) {
|
||||
+ if (drop == null) continue;
|
||||
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
||||
+ // Paper end - Restore vanilla drops behavior
|
||||
+ // Paper end - Restore vanilla drops behavior
|
||||
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||
|
||||
- if (stack instanceof CraftItemStack craftItemStack && craftItemStack.isForInventoryDrop()) {
|
||||
- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for Player Inventory dropped items
|
||||
- } else {
|
||||
- victim.forceDrops = true;
|
||||
- victim.spawnAtLocation(CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items
|
||||
- victim.spawnAtLocation(victim.serverLevel(), CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items
|
||||
- victim.forceDrops = false;
|
||||
- }
|
||||
+ drop.runConsumer(s -> victim.drop(CraftItemStack.unwrap(s), true, false, false)); // Paper - Restore vanilla drops behavior
|
||||
@ -237,10 +236,10 @@ index 2690c471b819f8308f6db44150025dfa323d4e0c..f529243852df8e193a604bb6d8953338
|
||||
|
||||
return event;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index c5a09f086d35f84c0a30266f78e06e2dfb5603e6..f33742ee06e8443a5f5adaaa987d7523dc193b5a 100644
|
||||
index 30eba68435387daa3917fa2b3071892c350d9ddc..0b7bc5e83634a26ac6521694377b554c74c6bff0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -130,27 +130,6 @@ public final class CraftItemStack extends ItemStack {
|
||||
@@ -142,27 +142,6 @@ public final class CraftItemStack extends ItemStack {
|
||||
this.setItemMeta(itemMeta);
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ In general, the client now has an acknowledgment system which will prevent block
|
||||
It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672fa50c585f 100644
|
||||
index 0da6496c18341c01fc4551ead7e740a6037dcf31..c4bc1819cba3287c4a67ae5d00f8c4d6ab899732 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -204,7 +204,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -202,7 +202,7 @@ public class ServerPlayerGameMode {
|
||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
if (event.isCancelled()) {
|
||||
// Let the client know the block still exists
|
||||
@ -20,7 +20,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
// Update any tile entity data for this block
|
||||
capturedBlockEntity = true; // Paper - Send block entities after destroy prediction
|
||||
return;
|
||||
@@ -219,7 +219,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -217,7 +217,7 @@ public class ServerPlayerGameMode {
|
||||
// Spigot start - handle debug stick left click for non-creative
|
||||
if (this.player.getMainHandItem().is(net.minecraft.world.item.Items.DEBUG_STICK)
|
||||
&& ((net.minecraft.world.item.DebugStickItem) net.minecraft.world.item.Items.DEBUG_STICK).handleInteraction(this.player, this.level.getBlockState(pos), this.level, pos, false, this.player.getMainHandItem())) {
|
||||
@ -29,7 +29,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
return;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -237,15 +237,17 @@ public class ServerPlayerGameMode {
|
||||
@@ -235,15 +235,17 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start - Swings at air do *NOT* exist.
|
||||
if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
@ -56,7 +56,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
} else if (!iblockdata.isAir()) {
|
||||
EnchantmentHelper.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EquipmentSlot.MAINHAND, Vec3.atCenterOf(pos), iblockdata, (item) -> {
|
||||
this.player.onEquippedItemBroken(item, EquipmentSlot.MAINHAND);
|
||||
@@ -257,7 +259,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -255,7 +257,7 @@ public class ServerPlayerGameMode {
|
||||
if (event.useItemInHand() == Event.Result.DENY) {
|
||||
// If we 'insta destroyed' then the client needs to be informed.
|
||||
if (f > 1.0f) {
|
||||
@ -65,7 +65,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -265,7 +267,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -263,7 +265,7 @@ public class ServerPlayerGameMode {
|
||||
|
||||
if (blockEvent.isCancelled()) {
|
||||
// Let the client know the block still exists
|
||||
@ -74,7 +74,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +358,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -354,7 +356,7 @@ public class ServerPlayerGameMode {
|
||||
|
||||
// Tell client the block is gone immediately then process events
|
||||
// Don't tell the client if its a creative sword break because its not broken!
|
||||
@ -83,7 +83,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(pos, Blocks.AIR.defaultBlockState());
|
||||
this.player.connection.send(packet);
|
||||
}
|
||||
@@ -382,13 +384,15 @@ public class ServerPlayerGameMode {
|
||||
@@ -380,13 +382,15 @@ public class ServerPlayerGameMode {
|
||||
if (isSwordNoBreak) {
|
||||
return false;
|
||||
}
|
||||
@ -103,7 +103,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
|
||||
// Update any tile entity data for this block
|
||||
if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction
|
||||
@@ -537,16 +541,18 @@ public class ServerPlayerGameMode {
|
||||
@@ -543,16 +547,18 @@ public class ServerPlayerGameMode {
|
||||
if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
if (iblockdata.getBlock() instanceof DoorBlock) {
|
||||
@ -127,7 +127,7 @@ index d839f8df658c894f144ba4637d290ffbed77e132..415d9802ae4dd75b44055b8faf19672f
|
||||
} else if (iblockdata.is(Blocks.JIGSAW) || iblockdata.is(Blocks.STRUCTURE_BLOCK) || iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
|
||||
player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
index 6caed156ed0cfe0017d578f58cb963ee68272d78..321188173918d0d60858a258400dfd682ccdb21c 100644
|
||||
index 002e2f8e956b2631529e2189be225385dfb501df..3bddfb6f7412ab86e0c090d0cbc6cf254b3f891c 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
@@ -79,7 +79,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
@ -137,7 +137,7 @@ index 6caed156ed0cfe0017d578f58cb963ee68272d78..321188173918d0d60858a258400dfd68
|
||||
- ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
|
||||
+ // ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) // Paper - Don't resend blocks
|
||||
((ServerPlayer) user).getBukkitEntity().updateInventory(); // SPIGOT-4541
|
||||
return InteractionResultHolder.fail(itemstack);
|
||||
return InteractionResult.FAIL;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
if (flag2 && entityhuman != null) {
|
||||
@ -149,23 +149,23 @@ index 6caed156ed0cfe0017d578f58cb963ee68272d78..321188173918d0d60858a258400dfd68
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 87cae96faf33fa0491b13add79e02fc225bd2f70..e9a9c89bd6a4ce7cb30c2fcf79a537fc18204aeb 100644
|
||||
index db971851a9e219ead89d71bb97d65ff73d9fd285..bba4fbde31ef25bc086fefaa86f9a479ef6ccf26 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -500,10 +500,12 @@ public final class ItemStack implements DataComponentHolder {
|
||||
world.preventPoiUpdated = false;
|
||||
@@ -506,10 +506,12 @@ public final class ItemStack implements DataComponentHolder {
|
||||
world.preventPoiUpdated = false;
|
||||
|
||||
// Brute force all possible updates
|
||||
- BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
|
||||
- for (Direction dir : Direction.values()) {
|
||||
- ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
|
||||
- }
|
||||
+ // Paper start - Don't resync blocks
|
||||
+ // BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
|
||||
+ // for (Direction dir : Direction.values()) {
|
||||
+ // ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
|
||||
+ // }
|
||||
+ // Paper end - Don't resync blocks
|
||||
SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
|
||||
} else {
|
||||
// Change the stack to its new contents if it hasn't been tampered with.
|
||||
// Brute force all possible updates
|
||||
- BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
|
||||
- for (Direction dir : Direction.values()) {
|
||||
- ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
|
||||
- }
|
||||
+ // Paper start - Don't resync blocks
|
||||
+ // BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
|
||||
+ // for (Direction dir : Direction.values()) {
|
||||
+ // ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
|
||||
+ // }
|
||||
+ // Paper end - Don't resync blocks
|
||||
SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
|
||||
} else {
|
||||
// Change the stack to its new contents if it hasn't been tampered with.
|
@ -5,7 +5,7 @@ Subject: [PATCH] Improve Registry
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||
index 3dbdfc2fb973c3c9aecc6582451071e8a939f5f0..c410e2d94562afc6bdd5bb3c9c01995eac0bc3fc 100644
|
||||
index 09929f580164abcd1c04061d04c6aa992767e256..aa66fd8dca886c1f064d8cb4a3d15c2086c1719a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||
@@ -155,6 +155,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
|
||||
@ -37,7 +37,7 @@ index 3dbdfc2fb973c3c9aecc6582451071e8a939f5f0..c410e2d94562afc6bdd5bb3c9c01995e
|
||||
+ // Paper end - improve Registry
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
index cd3e35867075e65f46051fb88d8a2460a8bb4b53..76627683f256a034a147765db693a9fd2ab9613f 100644
|
||||
index caf7e4312e95e90dd0822355c8832006e69a2700..38578ef887227ecc8e8bba281eae17a849b4fbe6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
@@ -54,6 +54,7 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable<net.minecraft
|
||||
@ -49,7 +49,7 @@ index cd3e35867075e65f46051fb88d8a2460a8bb4b53..76627683f256a034a147765db693a9fd
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
index 364f8d7a7106259401154d91b1b79869d014a469..f336bf98574e4fdeabc3b210629834393ec11a74 100644
|
||||
index f91577c9239c8d5ed4b72b23dde9c053b4beae0b..36df80a8be8a2485823f699e45c99674dbe71507 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
|
||||
@@ -54,6 +54,7 @@ public class CraftTrimPattern implements TrimPattern, Handleable<net.minecraft.w
|
@ -10,11 +10,11 @@ already existing behavior for the EntityPortalEvent (which
|
||||
extends EntityTeleportEvent).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/TeleportCommand.java b/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
||||
index a306b30af19277386a2f3e560b4902a8b5796f2a..54851f6cc0d5fddb32a9a1e84a4f5ae41af18758 100644
|
||||
index c6dcc37ac5fcf50bcb246f533b99983dfc5c19c2..c13b6f14c3061710c2b27034db240cc94ec0fcb5 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
||||
@@ -169,9 +169,10 @@ public class TeleportCommand {
|
||||
Location to = new Location(world.getWorld(), x, y, z, f2, f3);
|
||||
@@ -181,9 +181,10 @@ public class TeleportCommand {
|
||||
Location to = new Location(world.getWorld(), d3, d4, d5, f4, f5);
|
||||
EntityTeleportEvent event = new EntityTeleportEvent(target.getBukkitEntity(), target.getBukkitEntity().getLocation(), to);
|
||||
world.getCraftServer().getPluginManager().callEvent(event);
|
||||
- if (event.isCancelled()) {
|
||||
@ -23,13 +23,13 @@ index a306b30af19277386a2f3e560b4902a8b5796f2a..54851f6cc0d5fddb32a9a1e84a4f5ae4
|
||||
}
|
||||
+ to = event.getTo(); // Paper - actually track new location
|
||||
|
||||
x = to.getX();
|
||||
y = to.getY();
|
||||
d3 = to.getX();
|
||||
d4 = to.getY();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6b2dc430126713e11658f94762035ff10bbe018c..13ef1ad250b56dbadba0244186e369d7ba9b5c0e 100644
|
||||
index 0fcc5ed28b2371a62be57d7ea62f2e3dfedcf735..f42a98324ecfc992cf36c2f44cdb781ad4edbad4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4232,7 +4232,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4365,7 +4365,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (!(this instanceof ServerPlayer)) {
|
||||
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
|
||||
this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
||||
@ -39,10 +39,10 @@ index 6b2dc430126713e11658f94762035ff10bbe018c..13ef1ad250b56dbadba0244186e369d7
|
||||
this.teleportTo(to.getX(), to.getY(), to.getZ());
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||
index 87c669517baa923ffa7392e400e7344e81fc9406..9aee0569447d351729c26eedbe24d5defe620162 100644
|
||||
index e9e4d6fd69f9eec25a75b2610e15a19f8326f87b..7a4cb1d27bfe42f93525232892a59068560cd735 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java
|
||||
@@ -303,7 +303,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
||||
@@ -314,7 +314,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity {
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) x + 0.5D, (double) y, (double) z + 0.5D);
|
||||
@ -52,10 +52,10 @@ index 87c669517baa923ffa7392e400e7344e81fc9406..9aee0569447d351729c26eedbe24d5de
|
||||
}
|
||||
Location to = event.getTo();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
index 632b74e84d6ee58da8806e30b75e16fb864afa64..bf58956379d0a5dbfdc34e8626847638b4111433 100644
|
||||
index dc1870baf172982ebb34eccd4ee79497f48f8050..0fffa9dbcbbb15a2138f9a4e4d8e812c8047a7bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -415,7 +415,7 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
||||
@@ -416,7 +416,7 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
|
||||
if (enumdirection != null) {
|
||||
// CraftBukkit start
|
||||
EntityTeleportEvent teleportEvent = CraftEventFactory.callEntityTeleportEvent(this, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add experience points 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 950ce40d268d89ff3c503116081db6c9ccd65329..454b29d8c9e42e328933aa578f49d28f1e77898a 100644
|
||||
index aca888c2f02b09ac6739bdc81b194c4527dd69f5..a19a795deaa7f46c92b97912e2ade006bc90c2d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1869,7 +1869,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1823,7 +1823,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public int getXpNeededForNextLevel() {
|
||||
@ -18,10 +18,10 @@ index 950ce40d268d89ff3c503116081db6c9ccd65329..454b29d8c9e42e328933aa578f49d28f
|
||||
// Paper start - send while respecting visibility
|
||||
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index b2abaf6b535da13cdeeb99c568b91c585ac2ed20..6db4d21ee4dc97820943d3fd2aa55054cac95f50 100644
|
||||
index 620977c5afae38b8769cea8ccd5e97b311da6fc3..24b05e9b21ec84a4677f58ed790d308e700741b5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1921,6 +1921,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1934,6 +1934,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
Preconditions.checkArgument(exp >= 0, "Total experience points must not be negative (%s)", exp);
|
||||
this.getHandle().totalExperience = exp;
|
||||
}
|
398
patches/server/0909-Add-drops-to-shear-events.patch
Normal file
398
patches/server/0909-Add-drops-to-shear-events.patch
Normal file
@ -0,0 +1,398 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 18 May 2021 12:32:02 -0700
|
||||
Subject: [PATCH] Add drops to shear events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
index 9b5a1dc958232e4c2c9631f3504edc6383afd92a..f5206e4176f58cff4cfe70c94f014afebc98c589 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -103,11 +103,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
if (entityliving instanceof Shearable ishearable) {
|
||||
if (ishearable.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem).isCancelled()) {
|
||||
+ // Paper start - Add drops to shear events
|
||||
+ org.bukkit.event.block.BlockShearEntityEvent event = CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem, ishearable.generateDefaultDrops(worldserver, itemstack));
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Paper end - Add drops to shear events
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- ishearable.shear(worldserver, SoundSource.BLOCKS, itemstack);
|
||||
+ ishearable.shear(worldserver, SoundSource.BLOCKS, itemstack, CraftItemStack.asNMSCopy(event.getDrops())); // Paper - Add drops to shear events
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
index a3095eee48d8b87a35ad35da9c8a2a9ca20c92bc..88dcde6c901753d002a99333eb646bda17122c95 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
@@ -5,7 +5,13 @@ import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public interface Shearable {
|
||||
+ default void shear(ServerLevel world, SoundSource soundCategory, ItemStack shears, java.util.List<net.minecraft.world.item.ItemStack> drops) { this.shear(world, soundCategory, shears); } // Paper - Add drops to shear events
|
||||
void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears);
|
||||
|
||||
boolean readyForShearing();
|
||||
+ // Paper start - custom shear drops; ensure all implementing entities override this
|
||||
+ default java.util.List<net.minecraft.world.item.ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index d4d343e2d75a3e3ea787c3c68c64970f5b239f81..fad312784476d361e548a4d4ea942fa60ec72c66 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -46,6 +46,7 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.entity.EntityDropItemEvent;
|
||||
import org.bukkit.event.entity.EntityTransformEvent;
|
||||
// CraftBukkit end
|
||||
@@ -128,11 +129,18 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops(worldserver, itemstack);
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(worldserver, SoundSource.PLAYERS, itemstack);
|
||||
+ this.shear(worldserver, SoundSource.PLAYERS, itemstack, drops); // Paper - custom shear drops
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
}
|
||||
@@ -168,22 +176,32 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(world, shearedSoundCategory, shears, this.generateDefaultDrops(world, shears));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
|
||||
+ final java.util.List<ItemStack> drops = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ this.dropFromShearingLootTable(serverLevel, BuiltInLootTables.SHEAR_MOOSHROOM, shears, (ignored, stack) -> {
|
||||
+ for (int i = 0; i < stack.getCount(); ++i) drops.add(stack.copyWithCount(1));
|
||||
+ });
|
||||
+ return drops;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears, java.util.List<ItemStack> drops) {
|
||||
+ // Paper end - custom shear drops
|
||||
world.playSound((Player) null, (Entity) this, SoundEvents.MOOSHROOM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), (entitycow) -> {
|
||||
world.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.dropFromShearingLootTable(world, BuiltInLootTables.SHEAR_MOOSHROOM, shears, (worldserver1, itemstack1) -> {
|
||||
- for (int i = 0; i < itemstack1.getCount(); ++i) {
|
||||
- // CraftBukkit start
|
||||
- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), itemstack1.copyWithCount(1));
|
||||
- EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
- Bukkit.getPluginManager().callEvent(event);
|
||||
- if (event.isCancelled()) {
|
||||
- continue;
|
||||
- }
|
||||
- worldserver1.addFreshEntity(entityitem);
|
||||
- // CraftBukkit end
|
||||
+ // Paper start - custom shear drops; moved drop generation to separate method
|
||||
+ drops.forEach(itemstack1 -> {
|
||||
+ for (final ItemStack drop : drops) {
|
||||
+ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop);
|
||||
+ this.spawnAtLocation(entityitem);
|
||||
}
|
||||
-
|
||||
+ // Paper end - custom shear drops; moved drop generation to separate method
|
||||
});
|
||||
}, EntityTransformEvent.TransformReason.SHEARED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); // CraftBukkit
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index 1bc638ab505850bffcbd08025de9664dd27e47c6..432ad1c785e133ef18390108fd342be50ec4dddc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -173,11 +173,18 @@ public class Sheep extends Animal implements Shearable {
|
||||
|
||||
if (this.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops(worldserver, itemstack);
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(worldserver, SoundSource.PLAYERS, itemstack);
|
||||
+ this.shear(worldserver, SoundSource.PLAYERS, itemstack, drops); // Paper - custom shear drops
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
@@ -192,9 +199,26 @@ public class Sheep extends Animal implements Shearable {
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(world, shearedSoundCategory, shears, this.generateDefaultDrops(world, shears));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
|
||||
+ final java.util.List<ItemStack> drops = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ this.dropFromShearingLootTable(serverLevel, BuiltInLootTables.SHEAR_SHEEP, shears, (ignored, stack) -> {
|
||||
+ for (int i = 0; i < stack.getCount(); ++i) drops.add(stack.copyWithCount(1));
|
||||
+ });
|
||||
+ return drops;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears, java.util.List<ItemStack> drops) {
|
||||
+ final ServerLevel worldserver1 = world; // Named for lambda consumption
|
||||
+ // Paper end - custom shear drops
|
||||
world.playSound((Player) null, (Entity) this, SoundEvents.SHEEP_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
- this.dropFromShearingLootTable(world, BuiltInLootTables.SHEAR_SHEEP, shears, (worldserver1, itemstack1) -> {
|
||||
- for (int i = 0; i < itemstack1.getCount(); ++i) {
|
||||
+ drops.forEach(itemstack1 -> { // Paper - custom drops - loop in generated default drops
|
||||
+ if (true) { // Paper - custom drops - loop in generated default drops
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
ItemEntity entityitem = this.spawnAtLocation(worldserver1, itemstack1.copyWithCount(1), 1.0F);
|
||||
this.forceDrops = false; // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index 975a9e35303bec29aedfbd554c38e4331cdfb174..fd9f6c17448a4d87f940eb8f544ecb9669068582 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -161,11 +161,18 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops(worldserver, itemstack);
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(worldserver, SoundSource.PLAYERS, itemstack);
|
||||
+ this.shear(worldserver, SoundSource.PLAYERS, itemstack, drops); // Paper - custom shear drops
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
}
|
||||
@@ -178,9 +185,26 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(world, shearedSoundCategory, shears, this.generateDefaultDrops(world, shears));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
|
||||
+ final java.util.List<ItemStack> drops = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ this.dropFromShearingLootTable(serverLevel, BuiltInLootTables.SHEAR_SNOW_GOLEM, shears, (ignored, stack) -> {
|
||||
+ drops.add(stack);
|
||||
+ });
|
||||
+ return drops;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears, java.util.List<ItemStack> drops) {
|
||||
+ final ServerLevel worldserver1 = world; // Named for lambda consumption
|
||||
+ // Paper end - custom shear drops
|
||||
world.playSound((Player) null, (Entity) this, SoundEvents.SNOW_GOLEM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
this.setPumpkin(false);
|
||||
- this.dropFromShearingLootTable(world, BuiltInLootTables.SHEAR_SNOW_GOLEM, shears, (worldserver1, itemstack1) -> {
|
||||
+ drops.forEach(itemstack1 -> { // Paper - custom shear drops
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(worldserver1, itemstack1, this.getEyeHeight());
|
||||
this.forceDrops = false; // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
index 9d416f775fa19ad1978c7c9c9e0d5bc16728879d..18dae37d65552077aa3825c76f433bbd31152db9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
||||
public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
|
||||
@@ -80,12 +81,19 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
|
||||
// CraftBukkit start
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops(worldserver, itemstack);
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(worldserver, SoundSource.PLAYERS, itemstack);
|
||||
+ this.shear(worldserver, SoundSource.PLAYERS, itemstack, drops); // Paper - custom shear drops
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
}
|
||||
@@ -139,13 +147,32 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
|
||||
@Override
|
||||
public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(world, shearedSoundCategory, shears, this.generateDefaultDrops(world, shears));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops(final ServerLevel serverLevel, final ItemStack shears) {
|
||||
+ final java.util.List<ItemStack> drops = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ this.dropFromShearingLootTable(serverLevel, BuiltInLootTables.BOGGED_SHEAR, shears, (ignored, stack) -> {
|
||||
+ drops.add(stack);
|
||||
+ });
|
||||
+ return drops;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(ServerLevel world, SoundSource shearedSoundCategory, ItemStack shears, java.util.List<ItemStack> drops) {
|
||||
+ // Paper end - custom shear drops
|
||||
world.playSound((Player) null, (Entity) this, SoundEvents.BOGGED_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
- this.spawnShearedMushrooms(world, shears);
|
||||
+ this.spawnShearedMushrooms(world, shears, drops); // Paper - custom shear drops
|
||||
this.setSheared(true);
|
||||
}
|
||||
|
||||
- private void spawnShearedMushrooms(ServerLevel world, ItemStack shears) {
|
||||
- this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> {
|
||||
+ // Paper start - custom shear drops
|
||||
+ private void spawnShearedMushrooms(ServerLevel world, ItemStack shears, java.util.List<ItemStack> drops) {
|
||||
+ final ServerLevel worldserver1 = world; // Named for lambda consumption
|
||||
+ drops.forEach(itemstack1 -> {
|
||||
+ // Paper end - custom shear drops
|
||||
this.spawnAtLocation(worldserver1, itemstack1, this.getBbHeight());
|
||||
});
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index fb75b7f84575c42ab5dcb7e9c5659cecf439da90..89109bf9ad85b1859ce6ae0808ac0a1fb2cb6816 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1689,20 +1689,20 @@ public class CraftEventFactory {
|
||||
player.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
- public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is) {
|
||||
- BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is);
|
||||
+ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
+ BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is, Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops
|
||||
Bukkit.getPluginManager().callEvent(bse);
|
||||
return bse;
|
||||
}
|
||||
|
||||
- public static boolean handlePlayerShearEntityEvent(net.minecraft.world.entity.player.Player player, Entity sheared, ItemStack shears, InteractionHand hand) {
|
||||
+ public static PlayerShearEntityEvent handlePlayerShearEntityEvent(net.minecraft.world.entity.player.Player player, Entity sheared, ItemStack shears, InteractionHand hand, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
if (!(player instanceof ServerPlayer)) {
|
||||
- return true;
|
||||
+ return null; // Paper - custom shear drops
|
||||
}
|
||||
|
||||
- PlayerShearEntityEvent event = new PlayerShearEntityEvent((Player) player.getBukkitEntity(), sheared.getBukkitEntity(), CraftItemStack.asCraftMirror(shears), (hand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
|
||||
+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((Player) player.getBukkitEntity(), sheared.getBukkitEntity(), CraftItemStack.asCraftMirror(shears), (hand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND), Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
- return !event.isCancelled();
|
||||
+ return event; // Paper - custom shear drops
|
||||
}
|
||||
|
||||
public static Cancellable handleStatisticsIncrease(net.minecraft.world.entity.player.Player entityHuman, net.minecraft.stats.Stat<?> statistic, int current, int newValue) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 0b7bc5e83634a26ac6521694377b554c74c6bff0..ffd7ba14be38a117f5a7d7035a8d71a20fb1c4fc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -74,6 +74,16 @@ public final class CraftItemStack extends ItemStack {
|
||||
return stack;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static java.util.List<net.minecraft.world.item.ItemStack> asNMSCopy(java.util.List<? extends ItemStack> originals) {
|
||||
+ final java.util.List<net.minecraft.world.item.ItemStack> items = new java.util.ArrayList<>(originals.size());
|
||||
+ for (final ItemStack original : originals) {
|
||||
+ items.add(asNMSCopy(original));
|
||||
+ }
|
||||
+ return items;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static net.minecraft.world.item.ItemStack copyNMSStack(net.minecraft.world.item.ItemStack original, int amount) {
|
||||
net.minecraft.world.item.ItemStack stack = original.copy();
|
||||
stack.setCount(amount);
|
||||
diff --git a/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java b/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5e6dfc93c86ec369b686f15ca066478e1635dbc3
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package io.papermc.paper.entity;
|
||||
+
|
||||
+import io.github.classgraph.ClassGraph;
|
||||
+import io.github.classgraph.ClassInfo;
|
||||
+import io.github.classgraph.MethodInfoList;
|
||||
+import io.github.classgraph.ScanResult;
|
||||
+import java.util.ArrayList;
|
||||
+import net.minecraft.world.entity.Shearable;
|
||||
+import org.bukkit.support.environment.Normal;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.MethodSource;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
+
|
||||
+@Normal
|
||||
+class ShearableDropsTest {
|
||||
+
|
||||
+ static Iterable<ClassInfo> parameters() {
|
||||
+ try (ScanResult scanResult = new ClassGraph()
|
||||
+ .enableClassInfo()
|
||||
+ .enableMethodInfo()
|
||||
+ .whitelistPackages("net.minecraft")
|
||||
+ .scan()
|
||||
+ ) {
|
||||
+ return new ArrayList<>(scanResult.getClassesImplementing(Shearable.class.getName()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ParameterizedTest
|
||||
+ @MethodSource("parameters")
|
||||
+ void checkShearableDropOverrides(final ClassInfo classInfo) {
|
||||
+ final MethodInfoList generateDefaultDrops = classInfo.getDeclaredMethodInfo("generateDefaultDrops");
|
||||
+ assertEquals(1, generateDefaultDrops.size(), classInfo.getName() + " doesn't implement Shearable#generateDefaultDrops");
|
||||
+ }
|
||||
+}
|
@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sun, 18 Jun 2023 23:04:46 -0700
|
||||
Subject: [PATCH] Do not read tile entities in chunks that are positioned
|
||||
outside of the chunk
|
||||
|
||||
The tile entities are not accessible and so should not be loaded.
|
||||
This can happen as a result of users moving regionfiles around,
|
||||
which would cause a crash on Folia but would appear to function
|
||||
fine on Paper.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index 5e1a68e3a920aab10a459b9b54f6abd59e7855e0..d42585bccb03f8ee1be5e37cfbe8520af4cc5454 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -303,6 +303,13 @@ public class ChunkSerializer {
|
||||
for (int k1 = 0; k1 < nbttaglist3.size(); ++k1) {
|
||||
CompoundTag nbttagcompound4 = nbttaglist3.getCompound(k1);
|
||||
|
||||
+ // Paper start - do not read tile entities positioned outside the chunk
|
||||
+ BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound4);
|
||||
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
||||
+ LOGGER.warn("Tile entity serialized in chunk " + chunkPos + " in world '" + world.getWorld().getName() + "' positioned at " + blockposition + " is located outside of the chunk");
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end - do not read tile entities positioned outside the chunk
|
||||
((ChunkAccess) object1).setBlockEntityNbt(nbttagcompound4);
|
||||
}
|
||||
|
||||
@@ -507,10 +514,19 @@ public class ChunkSerializer {
|
||||
CompoundTag nbttagcompound1 = nbttaglist1.getCompound(i);
|
||||
boolean flag = nbttagcompound1.getBoolean("keepPacked");
|
||||
|
||||
+ // Paper start - do not read tile entities positioned outside the chunk
|
||||
+ BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1); // moved up
|
||||
+ ChunkPos chunkPos = chunk.getPos();
|
||||
+ if ((blockposition.getX() >> 4) != chunkPos.x || (blockposition.getZ() >> 4) != chunkPos.z) {
|
||||
+ LOGGER.warn("Tile entity serialized in chunk " + chunkPos + " in world '" + world.getWorld().getName() + "' positioned at " + blockposition + " is located outside of the chunk");
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end - do not read tile entities positioned outside the chunk
|
||||
+
|
||||
if (flag) {
|
||||
chunk.setBlockEntityNbt(nbttagcompound1);
|
||||
} else {
|
||||
- BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1);
|
||||
+ // Paper - do not read tile entities positioned outside the chunk; move up
|
||||
BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound1, world.registryAccess());
|
||||
|
||||
if (tileentity != null) {
|
@ -1,411 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 18 May 2021 12:32:02 -0700
|
||||
Subject: [PATCH] Add drops to shear events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
index f32f8d5cb22feb885a53d3b56c04ad4219d2bafa..44b79a7c2f8b95a484d1999fa2167ce588f7985b 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -103,11 +103,14 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
if (entityliving instanceof Shearable ishearable) {
|
||||
if (ishearable.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem).isCancelled()) {
|
||||
+ // Paper start - Add drops to shear events
|
||||
+ org.bukkit.event.block.BlockShearEntityEvent event = CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem, ishearable.generateDefaultDrops());
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Paper end - Add drops to shear events
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- ishearable.shear(SoundSource.BLOCKS);
|
||||
+ ishearable.shear(SoundSource.BLOCKS, CraftItemStack.asNMSCopy(event.getDrops())); // Paper - Add drops to shear events
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Shearable.java b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
index 5e8cc5cfac8888628c6d513148f41be09ca65a2c..2ee48ac3b665db2b02bcb1a30ec972d43a3725b0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Shearable.java
|
||||
@@ -3,7 +3,13 @@ package net.minecraft.world.entity;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
||||
public interface Shearable {
|
||||
+ default void shear(SoundSource soundCategory, java.util.List<net.minecraft.world.item.ItemStack> drops) { this.shear(soundCategory); } // Paper - Add drops to shear events
|
||||
void shear(SoundSource shearedSoundCategory);
|
||||
|
||||
boolean readyForShearing();
|
||||
+ // Paper start - custom shear drops; ensure all implementing entities override this
|
||||
+ default java.util.List<net.minecraft.world.item.ItemStack> generateDefaultDrops() {
|
||||
+ return java.util.Collections.emptyList();
|
||||
+ }
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index aa125e3043b120935aaa015803f065f99eb8d050..0c21959f57ae88fcd0a4d6dc911c1ce347c96528 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -123,11 +123,18 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops();
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
}
|
||||
+ // Paper end - custom shear drops
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, drops); // Paper - custom shear drops
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
if (!this.level().isClientSide) {
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
@@ -164,6 +171,22 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
|
||||
@Override
|
||||
public void shear(SoundSource shearedSoundCategory) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(shearedSoundCategory, this.generateDefaultDrops());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops() {
|
||||
+ java.util.List<ItemStack> dropEntities = new java.util.ArrayList<>(5);
|
||||
+ for (int i = 0; i < 5; ++i) {
|
||||
+ dropEntities.add(new ItemStack(this.getVariant().getBlockState().getBlock()));
|
||||
+ }
|
||||
+ return dropEntities;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(SoundSource shearedSoundCategory, java.util.List<ItemStack> drops) { // If drops is null, need to generate drops
|
||||
+ // Paper end - custom shear drops
|
||||
this.level().playSound((Player) null, (Entity) this, SoundEvents.MOOSHROOM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
if (!this.level().isClientSide()) {
|
||||
Cow entitycow = (Cow) EntityType.COW.create(this.level());
|
||||
@@ -193,17 +216,12 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
this.discard(EntityRemoveEvent.Cause.TRANSFORMATION); // CraftBukkit - from above and add Bukkit remove cause
|
||||
// CraftBukkit end
|
||||
|
||||
- for (int i = 0; i < 5; ++i) {
|
||||
- // CraftBukkit start
|
||||
- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
- EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
- Bukkit.getPluginManager().callEvent(event);
|
||||
- if (event.isCancelled()) {
|
||||
- continue;
|
||||
- }
|
||||
- this.level().addFreshEntity(entityitem);
|
||||
- // CraftBukkit end
|
||||
+ // Paper start - custom shear drops; moved drop generation to separate method
|
||||
+ for (final ItemStack drop : drops) {
|
||||
+ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop);
|
||||
+ this.spawnAtLocation(entityitem);
|
||||
}
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index 6b26af41423110bd982eb8c0eea0cba5e9fdc633..38ac2759894660be1ee7ba59b0bd1270158e9232 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -256,11 +256,18 @@ public class Sheep extends Animal implements Shearable {
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level().isClientSide && this.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops();
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
}
|
||||
+ // Paper end - custom shear drops
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, drops); // Paper
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -274,13 +281,30 @@ public class Sheep extends Animal implements Shearable {
|
||||
|
||||
@Override
|
||||
public void shear(SoundSource shearedSoundCategory) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(shearedSoundCategory, this.generateDefaultDrops());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops() {
|
||||
+ int count = 1 + this.random.nextInt(3);
|
||||
+ java.util.List<ItemStack> dropEntities = new java.util.ArrayList<>(count);
|
||||
+ for (int j = 0; j < count; ++j) {
|
||||
+ dropEntities.add(new ItemStack(Sheep.ITEM_BY_DYE.get(this.getColor())));
|
||||
+ }
|
||||
+ return dropEntities;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(SoundSource shearedSoundCategory, java.util.List<ItemStack> drops) {
|
||||
+ // Paper end - custom shear drops
|
||||
this.level().playSound((Player) null, (Entity) this, SoundEvents.SHEEP_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
this.setSheared(true);
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
- for (int j = 0; j < i; ++j) {
|
||||
+ for (final ItemStack drop : drops) { // Paper - custom shear drops (moved drop generation to separate method)
|
||||
this.forceDrops = true; // CraftBukkit
|
||||
- ItemEntity entityitem = this.spawnAtLocation((ItemLike) Sheep.ITEM_BY_DYE.get(this.getColor()), 1);
|
||||
+ ItemEntity entityitem = this.spawnAtLocation(drop, 1); // Paper - custom shear drops
|
||||
this.forceDrops = false; // CraftBukkit
|
||||
|
||||
if (entityitem != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index 2de1a2f666da9db1832907e1651dbff948e37252..5c2ed3c39c8eb850f3be1e2ea5b5a7ea266e16d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -146,11 +146,18 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
|
||||
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (!CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - custom shear drops
|
||||
+ java.util.List<ItemStack> drops = this.generateDefaultDrops();
|
||||
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
}
|
||||
+ // Paper end - custom shear drops
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, drops); // Paper
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
if (!this.level().isClientSide) {
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
@@ -164,12 +171,28 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
|
||||
@Override
|
||||
public void shear(SoundSource shearedSoundCategory) {
|
||||
+ // Paper start - custom shear drops
|
||||
+ this.shear(shearedSoundCategory, this.generateDefaultDrops());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops() {
|
||||
+ return java.util.Collections.singletonList(new ItemStack(Items.CARVED_PUMPKIN));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(SoundSource shearedSoundCategory, java.util.List<ItemStack> drops) {
|
||||
+ // Paper end - custom shear drops
|
||||
this.level().playSound((Player) null, (Entity) this, SoundEvents.SNOW_GOLEM_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
if (!this.level().isClientSide()) {
|
||||
this.setPumpkin(false);
|
||||
- this.forceDrops = true; // CraftBukkit
|
||||
- this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), this.getEyeHeight());
|
||||
- this.forceDrops = false; // CraftBukkit
|
||||
+ // Paper start - custom shear drops (moved drop generation to separate method)
|
||||
+ for (final ItemStack drop : drops) {
|
||||
+ this.forceDrops = true;
|
||||
+ this.spawnAtLocation(drop, this.getEyeHeight());
|
||||
+ this.forceDrops = false;
|
||||
+ }
|
||||
+ // Paper end - custom shear drops
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
index dc6230458e09f7555eee7f6a567ff60ad454666b..9d50b9ac8084f3db1844cc7ad1ce9153614ff9d9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
@@ -80,12 +80,19 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
|
||||
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
// CraftBukkit start
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand)) {
|
||||
- this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
|
||||
- return InteractionResult.PASS;
|
||||
+ // Paper start - expose drops in event
|
||||
+ java.util.List<net.minecraft.world.item.ItemStack> drops = generateDefaultDrops();
|
||||
+ final org.bukkit.event.player.PlayerShearEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
|
||||
+ if (event != null) {
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (player instanceof final net.minecraft.server.level.ServerPlayer serverPlayer) this.resendPossiblyDesyncedDataValues(java.util.List.of(Bogged.DATA_SHEARED), serverPlayer);
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
|
||||
+ // Paper end - expose drops in event
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.shear(SoundSource.PLAYERS);
|
||||
+ this.shear(SoundSource.PLAYERS, drops); // Paper - expose drops in event
|
||||
this.gameEvent(GameEvent.SHEAR, player);
|
||||
if (!this.level().isClientSide) {
|
||||
itemstack.hurtAndBreak(1, player, getSlotForHand(hand));
|
||||
@@ -140,12 +147,31 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
|
||||
@Override
|
||||
public void shear(SoundSource shearedSoundCategory) {
|
||||
+ // Paper start - shear drop API
|
||||
+ this.shear(shearedSoundCategory, generateDefaultDrops());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shear(SoundSource shearedSoundCategory, java.util.List<net.minecraft.world.item.ItemStack> drops) {
|
||||
+ // Paper end - shear drop API
|
||||
this.level().playSound((Player) null, (Entity) this, SoundEvents.BOGGED_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
|
||||
- this.spawnShearedMushrooms();
|
||||
+ this.spawnDrops(drops); // Paper - shear drop API
|
||||
this.setSheared(true);
|
||||
}
|
||||
|
||||
private void spawnShearedMushrooms() {
|
||||
+ // Paper start - shear drops API
|
||||
+ this.spawnDrops(generateDefaultDrops()); // Only here for people calling spawnSheardMushrooms. Not used otherwise.
|
||||
+ }
|
||||
+ private void spawnDrops(java.util.List<net.minecraft.world.item.ItemStack> drops) {
|
||||
+ drops.forEach(stack -> {
|
||||
+ this.forceDrops = true;
|
||||
+ this.spawnAtLocation(stack, this.getBbHeight());
|
||||
+ this.forceDrops = false;
|
||||
+ });
|
||||
+ }
|
||||
+ private void generateShearedMushrooms(java.util.function.Consumer<ItemStack> stackConsumer) {
|
||||
+ // Paper end - shear drops API
|
||||
Level world = this.level();
|
||||
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
@@ -156,12 +182,21 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
while (objectlistiterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) objectlistiterator.next();
|
||||
|
||||
- this.spawnAtLocation(itemstack, this.getBbHeight());
|
||||
+ stackConsumer.accept(itemstack); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - shear drops API
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops() {
|
||||
+ final java.util.List<ItemStack> drops = new java.util.ArrayList<>();
|
||||
+ this.generateShearedMushrooms(drops::add);
|
||||
+ return drops;
|
||||
+ }
|
||||
+ // Paper end - shear drops API
|
||||
+
|
||||
@Override
|
||||
public boolean readyForShearing() {
|
||||
return !this.isSheared() && this.isAlive();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index f529243852df8e193a604bb6d895333848b14a74..d407e9e8f1b530f00e632e0249514fb68d48316b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1691,20 +1691,20 @@ public class CraftEventFactory {
|
||||
player.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
- public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is) {
|
||||
- BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is);
|
||||
+ public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
+ BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is, Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops
|
||||
Bukkit.getPluginManager().callEvent(bse);
|
||||
return bse;
|
||||
}
|
||||
|
||||
- public static boolean handlePlayerShearEntityEvent(net.minecraft.world.entity.player.Player player, Entity sheared, ItemStack shears, InteractionHand hand) {
|
||||
+ public static PlayerShearEntityEvent handlePlayerShearEntityEvent(net.minecraft.world.entity.player.Player player, Entity sheared, ItemStack shears, InteractionHand hand, List<ItemStack> drops) { // Paper - custom shear drops
|
||||
if (!(player instanceof ServerPlayer)) {
|
||||
- return true;
|
||||
+ return null; // Paper - custom shear drops
|
||||
}
|
||||
|
||||
- PlayerShearEntityEvent event = new PlayerShearEntityEvent((Player) player.getBukkitEntity(), sheared.getBukkitEntity(), CraftItemStack.asCraftMirror(shears), (hand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
|
||||
+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((Player) player.getBukkitEntity(), sheared.getBukkitEntity(), CraftItemStack.asCraftMirror(shears), (hand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND), Lists.transform(drops, CraftItemStack::asCraftMirror)); // Paper - custom shear drops
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
- return !event.isCancelled();
|
||||
+ return event; // Paper - custom shear drops
|
||||
}
|
||||
|
||||
public static Cancellable handleStatisticsIncrease(net.minecraft.world.entity.player.Player entityHuman, net.minecraft.stats.Stat<?> statistic, int current, int newValue) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index f33742ee06e8443a5f5adaaa987d7523dc193b5a..a1a32a77bda0560a7b7f30a5d1c1837ee96997d3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -69,6 +69,16 @@ public final class CraftItemStack extends ItemStack {
|
||||
return stack;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static java.util.List<net.minecraft.world.item.ItemStack> asNMSCopy(java.util.List<? extends ItemStack> originals) {
|
||||
+ final java.util.List<net.minecraft.world.item.ItemStack> items = new java.util.ArrayList<>(originals.size());
|
||||
+ for (final ItemStack original : originals) {
|
||||
+ items.add(asNMSCopy(original));
|
||||
+ }
|
||||
+ return items;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static net.minecraft.world.item.ItemStack copyNMSStack(net.minecraft.world.item.ItemStack original, int amount) {
|
||||
net.minecraft.world.item.ItemStack stack = original.copy();
|
||||
stack.setCount(amount);
|
||||
diff --git a/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java b/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5e6dfc93c86ec369b686f15ca066478e1635dbc3
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/entity/ShearableDropsTest.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package io.papermc.paper.entity;
|
||||
+
|
||||
+import io.github.classgraph.ClassGraph;
|
||||
+import io.github.classgraph.ClassInfo;
|
||||
+import io.github.classgraph.MethodInfoList;
|
||||
+import io.github.classgraph.ScanResult;
|
||||
+import java.util.ArrayList;
|
||||
+import net.minecraft.world.entity.Shearable;
|
||||
+import org.bukkit.support.environment.Normal;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.MethodSource;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
+
|
||||
+@Normal
|
||||
+class ShearableDropsTest {
|
||||
+
|
||||
+ static Iterable<ClassInfo> parameters() {
|
||||
+ try (ScanResult scanResult = new ClassGraph()
|
||||
+ .enableClassInfo()
|
||||
+ .enableMethodInfo()
|
||||
+ .whitelistPackages("net.minecraft")
|
||||
+ .scan()
|
||||
+ ) {
|
||||
+ return new ArrayList<>(scanResult.getClassesImplementing(Shearable.class.getName()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ParameterizedTest
|
||||
+ @MethodSource("parameters")
|
||||
+ void checkShearableDropOverrides(final ClassInfo classInfo) {
|
||||
+ final MethodInfoList generateDefaultDrops = classInfo.getDeclaredMethodInfo("generateDefaultDrops");
|
||||
+ assertEquals(1, generateDefaultDrops.size(), classInfo.getName() + " doesn't implement Shearable#generateDefaultDrops");
|
||||
+ }
|
||||
+}
|
Loading…
Reference in New Issue
Block a user