13
0
geforkt von Mirrors/Paper

Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11024)

* Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e86f4dc4 PR-1041: Improve getPlayer(String) docs to clarify it matches the name
9738f005 Fix spawner API documentation
69ebd9fd PR-1034: Add TrialSpawnerSpawnEvent
23cffd9c PR-973: Improve spawner API and add API for Trial Spawners
8bf19163 PR-1038: Clarify HumanEntity#openInventory(InventoryView) JavaDoc
1ff76351 SPIGOT-7732, SPIGOT-7786: Add freezing damage modifier
02161cb4 PR-1034: Add CreatureSpawnEvent.SpawnReason#TRIAL_SPAWNER
f9cb6f34 SPIGOT-7777: All entity potion effects are removed on death
25d548eb PR-1031: Expose Creeper igniter
ccbf0915 SPIGOT-7770: Reserve spaces in shaped recipes for blank ingredients
17f7097c Clarify ambiguity around what is API
71714f0c Remove note from InventoryView JavaDoc
aaf49731 PR-1030: Deprecate more unused methods in UnsafeValues
3a9dc689 SPIGOT-7771: Material.getDefaultAttributes always returns an empty map

CraftBukkit Changes:
c3ceeb6f7 SPIGOT-7814: Call PlayerShearEntityEvent for Bogged
97b1e4f58 Fix wolf armor not dropping from use of shears
fd2ef563a SPIGOT-7812: Revert "SPIGOT-7809: Restore shield/banner conversion for base colours"
f672c351b SPIGOT-7811: Enchantments are applied on sweeping attack even if damage event is cancelled
cfe29350b SPIGOT-7808: Fix implementation of Enchantment#getName() for bad name return
19335f69e SPIGOT-7809: Restore shield/banner conversion for base colours
ae4f5a0be SPIGOT-7805: Fix jukebox deserialization
62e3b73a4 SPIGOT-7804: Fix written book serialization
aac911d26 SPIGOT-7800, SPIGOT-7801: Keep vanilla behaviour for items dropped on player death
13ece474f PR-1429: Implement TrialSpawnerSpawnEvent
bf13e9113 PR-1354: Improve spawner API and add API for Trial Spawners
515fe49e1 Increase outdated build delay
9cd5a19a0 SPIGOT-7794: Cancelling InventoryItemMoveEvent destroys items
ce40c7b14 SPIGOT-7796: Kickplayer newlines not working
5167256ff SPIGOT-7795: Fix damage/stats ignore the invulnerable damage time
f993563ee Improve cross-world teleportation handling
ab29122cf PR-1433: HumanEntity#openInventory(InventoryView) should only support views belonging to the player
764a541c5 SPIGOT-7732: Issue with the "hurt()" method of EntityLiving and invulnerable time
820084b5f SPIGOT-7791: Skull BlockState with null profile causes NullPointerException
5e46f1c82 SPIGOT-7785: Teleporting a player at the right moment can mess up vanilla teleportation
cbd95a6b3 SPIGOT-7772: Include hidden / non-sampled players in player count
3153debc5 SPIGOT-7790: Server crashes after bee nest is forced to update
e77bb26bb SPIGOT-7788: The healing power of friendship advancement is never granted
ee3d7258a SPIGOT-7789: Fix NPE in CraftMetaFirework applyToItem
2889b3a11 PR-1429: Add CreatureSpawnEvent.SpawnReason#TRIAL_SPAWNER
cdd05bc7f SPIGOT-7777: Speed attribute stays after death; missing EntityPotionEffectEvent call
d0e6af2d4 PR-1428: Expose Creeper igniter
d01c70e93 PR-1425: Fix bytecode transformation taking care of class-to-interface compatibility.
b2b08f68c SPIGOT-7770: Fix certain shaped recipes not registering
3f8e4161f PR-1426: Deprecate more unused methods in UnsafeValues
2c9dd879e SPIGOT-7771: Material.getDefaultAttributes always returns an empty map

Spigot Changes:
491f3675 Rebuild patches
0a642bd7 Rebuild patches
8897571b Rebuild patches
cb8cf80c Fix newlines in custom restart message
1aabe506 Rebuild patches
Dieser Commit ist enthalten in:
Bjarne Koll 2024-07-06 21:19:14 +02:00
Ursprung 5cc2489fef
Commit 980b33a6d0
33 geänderte Dateien mit 270 neuen und 217 gelöschten Zeilen

Datei anzeigen

@ -75,9 +75,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Creeper.java
+++ b/src/main/java/org/bukkit/entity/Creeper.java
@@ -0,0 +0,0 @@ public interface Creeper extends Monster {
* griefing gamerule.
*/
public void ignite();
@Nullable
public Entity getIgniter();
+ // Paper start
+
+ /**

Datei anzeigen

@ -72,13 +72,14 @@ diff --git a/src/main/java/org/bukkit/block/TrialSpawner.java b/src/main/java/or
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/TrialSpawner.java
+++ b/src/main/java/org/bukkit/block/TrialSpawner.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus;
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a captured state of a trial spawner.
*/
-@ApiStatus.Experimental
public interface TrialSpawner extends TileState {
}
/**
diff --git a/src/main/java/org/bukkit/block/Vault.java b/src/main/java/org/bukkit/block/Vault.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/Vault.java

Datei anzeigen

@ -1631,8 +1631,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -0,0 +0,0 @@ public class ShapedRecipe extends CraftingRecipe {
* @param ingredient The ingredient.
* @return The changed recipe, so you can chain calls.
* @throws IllegalArgumentException if the {@code key} is a space character
* @throws IllegalArgumentException if the {@code key} does not appear in the shape.
+ * @deprecated use {@link #setIngredient(char, RecipeChoice)}
*/

Datei anzeigen

@ -215,7 +215,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -0,0 +0,0 @@ public class ShapedRecipe extends CraftingRecipe {
public ShapedRecipe setIngredient(char key, @NotNull RecipeChoice ingredient) {
Preconditions.checkArgument(key != ' ', "Space in recipe shape must represent no ingredient");
Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
- ingredients.put(key, ingredient);

Datei anzeigen

@ -4,14 +4,14 @@ Date: Fri, 19 Apr 2019 12:41:19 -0500
Subject: [PATCH] Mob Spawner API Enhancements
diff --git a/src/main/java/org/bukkit/block/CreatureSpawner.java b/src/main/java/org/bukkit/block/CreatureSpawner.java
diff --git a/src/main/java/org/bukkit/spawner/Spawner.java b/src/main/java/org/bukkit/spawner/Spawner.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/CreatureSpawner.java
+++ b/src/main/java/org/bukkit/block/CreatureSpawner.java
@@ -0,0 +0,0 @@ public interface CreatureSpawner extends TileState {
--- a/src/main/java/org/bukkit/spawner/Spawner.java
+++ b/src/main/java/org/bukkit/spawner/Spawner.java
@@ -0,0 +0,0 @@ public interface Spawner extends BaseSpawner {
* @param maxNearbyEntities the maximum number of nearby, similar, entities
*/
@NotNull
public List<SpawnerEntry> getPotentialSpawns();
public void setMaxNearbyEntities(int maxNearbyEntities);
+
+ // Paper start
+ /**

Datei anzeigen

@ -9,11 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {
- ((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
+ // Paper start - PlayerAttackEntityCooldownResetEvent
+ //((net.minecraft.world.entity.player.Player) damagesource.getEntity()).resetAttackStrengthTicker(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
+ if (damagesource.getEntity() instanceof ServerPlayer) {
+ ServerPlayer player = (ServerPlayer) damagesource.getEntity();
+ if (new com.destroystokyo.paper.event.player.PlayerAttackEntityCooldownResetEvent(player.getBukkitEntity(), this.getBukkitEntity(), player.getAttackStrengthScale(0F)).callEvent()) {
@ -24,5 +25,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end - PlayerAttackEntityCooldownResetEvent
}
if (event.isCancelled()) {
return false;
// Resistance

Datei anzeigen

@ -487,8 +487,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;
- this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message));
+ this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message), org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause
- this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message, true));
+ this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message, true), org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause
}
// Paper start
@ -526,8 +526,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Kick all players
for ( ServerPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
{
- p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ) );
+ p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ), org.bukkit.event.player.PlayerKickEvent.Cause.RESTART_COMMAND); // Paper - kick event reason (cause is never used))
- p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage, true ) );
+ p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage, true ), org.bukkit.event.player.PlayerKickEvent.Cause.RESTART_COMMAND); // Paper - kick event reason (cause is never used))
}
// Give the socket a chance to send the packets
try

Datei anzeigen

@ -43,9 +43,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
// CraftBukkit start - Only apply knockback if the damage hits
- if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
+ if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API
entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
- if (!entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
+ if (!entityliving2.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API
continue;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java

Datei anzeigen

@ -237,29 +237,71 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
@@ -0,0 +0,0 @@ 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));
@@ -0,0 +0,0 @@ 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.generateShearedMushrooms(stack -> {
+ // 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
if (this.level() instanceof ServerLevel serverLevel) {
LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.BOGGED_SHEAR);
LootParams lootParams = new LootParams.Builder(serverLevel)
@@ -0,0 +0,0 @@ public class Bogged extends AbstractSkeleton implements Shearable {
.create(LootContextParamSets.SHEARING);
+ // Paper end - shear drops API
Level world = this.level();
for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) {
- this.spawnAtLocation(itemStack, this.getBbHeight());
+ stackConsumer.accept(itemStack); // Paper
if (world instanceof ServerLevel worldserver) {
@@ -0,0 +0,0 @@ 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

Datei anzeigen

@ -216,14 +216,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
- entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
+ entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
continue;
}
// CraftBukkit end
- entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
+ entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
// entityliving2.hurt(damagesource, f7); // CraftBukkit - moved up
Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java

Datei anzeigen

@ -56,20 +56,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
@@ -0,0 +0,0 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
this.playSound(SoundEvents.ARMOR_UNEQUIP_WOLF);
itemstack1 = this.getBodyArmorItem();
this.setBodyArmorItem(ItemStack.EMPTY);
+ this.forceDrops = true; // Paper - add missing forceDrops toggles
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // Paper - add missing forceDrops toggles
return InteractionResult.SUCCESS;
} else if (((Ingredient) ((ArmorMaterial) ArmorMaterials.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(player) && this.getBodyArmorItem().isDamaged()) {
itemstack.shrink(1);
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java

Datei anzeigen

@ -4252,7 +4252,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message));
this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message, true));
}
+ // Paper start
@ -5044,21 +5044,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableMap; // Paper
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -0,0 +0,0 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
}
@Override
- Builder<String, Object> serialize(Builder<String, Object> builder) {
+ ImmutableMap.Builder<String, Object> serialize(ImmutableMap.Builder<String, Object> builder) {
+ com.google.common.collect.ImmutableMap.Builder<String, Object> serialize(com.google.common.collect.ImmutableMap.Builder<String, Object> builder) { // Paper - adventure - fqn as it conflicts with adventure book builder
super.serialize(builder);
if (this.hasTitle()) {

Datei anzeigen

@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

Datei anzeigen

@ -610,7 +610,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static boolean useConsole = true;
@@ -0,0 +0,0 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

Datei anzeigen

@ -36,9 +36,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
if (retainOwnership) {
if (flag1) {
if (!itemstack1.isEmpty()) {
- this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), stack.getCount());
- this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack.getCount());
+ this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper - Fix PlayerDropItemEvent using wrong item
}

Datei anzeigen

@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
Map<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
modifiers.put(DamageModifier.BASE, rawDamage);
modifierFunctions.put(DamageModifier.BASE, CraftEventFactory.ZERO);
modifiers.put(DamageModifier.FREEZING, freezingModifier);
modifierFunctions.put(DamageModifier.FREEZING, freezing);
}
- if (source.is(DamageTypes.FALLING_BLOCK) || source.is(DamageTypes.FALLING_ANVIL)) {
+ if (source.is(DamageTypeTags.DAMAGES_HELMET)) { // Paper
modifiers.put(DamageModifier.HARD_HAT, hardHatModifier);

Datei anzeigen

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main {
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit

Datei anzeigen

@ -457,45 +457,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static final int MAX_PAGE_LENGTH = WritableBookContent.PAGE_EDIT_LENGTH; // SPIGOT-6911: Use Minecraft limits
// We store the pages in their raw original text representation. See SPIGOT-5063, SPIGOT-5350, SPIGOT-3206
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java
@@ -0,0 +0,0 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
}
}
- this.resolved = SerializableMeta.getObject(Boolean.class, map, CraftMetaBookSigned.RESOLVED.BUKKIT, true);
- this.generation = SerializableMeta.getObject(Integer.class, map, CraftMetaBookSigned.GENERATION.BUKKIT, true);
+ this.resolved = SerializableMeta.getBoolean(map, CraftMetaBookSigned.RESOLVED.BUKKIT); // Paper - General ItemMeta fixes
+ this.generation = SerializableMeta.getObjectOptionally(Integer.class, map, CraftMetaBookSigned.GENERATION.BUKKIT, true).orElse(0); // Paper - General ItemMeta Fixes
}
@Override
@@ -0,0 +0,0 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
for (Component page : this.pages) {
list.add(Filterable.passThrough(page));
}
- itemData.put(CraftMetaBookSigned.BOOK_CONTENT, new WrittenBookContent(Filterable.from(FilteredText.passThrough(this.title)), this.author, this.generation, list, this.resolved));
+ itemData.put(CraftMetaBookSigned.BOOK_CONTENT, new WrittenBookContent(Filterable.from(FilteredText.passThrough(this.title == null ? "" : this.title)), this.author == null ? "" : this.author, this.generation, list, this.resolved));
}
}
@@ -0,0 +0,0 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta {
}
if (this.pages != null) {
- builder.put(CraftMetaBookSigned.BOOK_PAGES.BUKKIT, ImmutableList.copyOf(this.pages));
+ // Paper start - deserialization expects json
+ final List<String> jsonPages = new ArrayList<>(this.pages.size());
+ for (final Component page : this.pages) {
+ jsonPages.add(CraftChatMessage.toJSON(page));
+ }
+ builder.put(CraftMetaBookSigned.BOOK_PAGES.BUKKIT, ImmutableList.copyOf(jsonPages));
+ // Paper end - deserialization expects json
}
if (this.resolved) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java
@ -740,22 +701,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
effects.add((FireworkEffect) obj);
}
}
@@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
}
List<FireworkExplosion> effects = new ArrayList<>();
- for (FireworkEffect effect : this.effects) {
- effects.add(CraftMetaFirework.getExplosion(effect));
+ // Paper start - fix NPE with effects list being null
+ if (this.effects != null) {
+ for (FireworkEffect effect : this.effects) {
+ effects.add(CraftMetaFirework.getExplosion(effect));
+ }
}
+ // Paper end
itemTag.put(CraftMetaFirework.FIREWORKS, new Fireworks(this.power, effects));
}
@@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
}

Datei anzeigen

@ -468,7 +468,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
event.setKeepInventory(keepInventory);
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
+ populateFields(victim, event); // Paper - make cancellable
org.bukkit.World world = entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);
+ // Paper start - make cancellable
+ if (event.isCancelled()) {

Datei anzeigen

@ -33,16 +33,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (event.isCancelled()) {
return false;
}
- if (event.getTarget() == null) {
- memoryaccessor.erase();
- return true;
- }
- entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
+ // if (event.getTarget() == null) { // Paper - this is wrong, you are skipping the forgetCallback
+ // memoryaccessor.erase();
+ // return true;
+ // }
+ // entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
// CraftBukkit end
forgetCallback.accept(entityinsentient, entityliving);
memoryaccessor.erase();

Datei anzeigen

@ -3,8 +3,6 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:01:54 -0700
Subject: [PATCH] Improve item default attribute API
Also fixes an issue where upstream isn't
actually getting the correct default attributes
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -37,24 +35,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ // Paper start - improve/fix item default attribute API
+ final net.minecraft.world.entity.EquipmentSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
+ return this.getDefaultAttributeModifiers(sg -> sg.test(nmsSlot));
+ }
+
+ private Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(final java.util.function.Predicate<net.minecraft.world.entity.EquipmentSlotGroup> slotPredicate) {
+ // Paper end - improve/fix item default attribute API
ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
if (nmsDefaultAttributes.modifiers().isEmpty()) {
nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
}
-
- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
- });
+ private Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(final java.util.function.Predicate<net.minecraft.world.entity.EquipmentSlotGroup> slotPredicate) {
+ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
+ if (nmsDefaultAttributes.modifiers().isEmpty()) {
+ // we have to check both places cause for some reason vanilla puts default modifiers for armor in a different place
+ nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
+ }
+ // Paper start - improve/fix item default attribute API
+ for (final net.minecraft.world.item.component.ItemAttributeModifiers.Entry entry : nmsDefaultAttributes.modifiers()) {
+ if (!slotPredicate.test(entry.slot())) continue;
+ final Attribute attribute = CraftAttribute.minecraftHolderToBukkit(entry.attribute());
@ -73,15 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {
- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
-
- ItemAttributeModifiers nmsDefaultAttributes = CraftMagicNumbers.getItem(material).getDefaultAttributeModifiers();
- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
- });
-
- return defaultAttributes.build();
- return material.getDefaultAttributeModifiers(slot);
+ // Paper start - delegate to method on ItemType
+ final org.bukkit.inventory.ItemType item = material.asItemType();
+ Preconditions.checkArgument(item != null, material + " is not an item and does not have default attributes");

Datei anzeigen

@ -72,40 +72,148 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftEntityType;
import org.bukkit.entity.EntitySnapshot;
import org.bukkit.entity.EntityType;
-public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEntity> implements CreatureSpawner {
+public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEntity> implements CreatureSpawner, org.bukkit.craftbukkit.spawner.PaperSharedSpawnerLogic { // Paper - more spawner API
public CraftCreatureSpawner(World world, SpawnerBlockEntity tileEntity) {
super(world, tileEntity);
@@ -0,0 +0,0 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti
new HashMap<>(nms.slotDropChances().entrySet().stream().collect(Collectors.toMap((entry) -> CraftEquipmentSlot.getSlot(entry.getKey()), Map.Entry::getValue)))
)).orElse(null);
}
+
+ // Paper start
+ // Paper start - more spawner API
+ @Override
+ public boolean isActivated() {
+ this.requirePlaced();
+ return this.getSnapshot().getSpawner().isNearPlayer(this.world.getHandle(), this.getPosition());
+ requirePlaced();
+ return org.bukkit.craftbukkit.spawner.PaperSharedSpawnerLogic.super.isActivated();
+ }
+
+ @Override
+ public void resetTimer() {
+ this.requirePlaced();
+ this.getSnapshot().getSpawner().delay(this.world.getHandle(), this.getPosition());
+ requirePlaced();
+ org.bukkit.craftbukkit.spawner.PaperSharedSpawnerLogic.super.resetTimer();
+ }
+
+ @Override
+ public void setSpawnedItem(org.bukkit.inventory.ItemStack itemStack) {
+ public void setNextSpawnData(final SpawnData spawnData) {
+ this.getSpawner().setNextSpawnData(this.isPlaced() ? this.getInternalWorld() : null, this.getInternalPosition(), spawnData);
+ }
+
+ @Override
+ public BaseSpawner getSpawner() {
+ return this.getSnapshot().getSpawner();
+ }
+
+ @Override
+ public net.minecraft.core.BlockPos getInternalPosition() {
+ return this.getPosition();
+ }
+
+ @Override
+ public net.minecraft.world.level.Level getInternalWorld() {
+ return this.world.getHandle();
+ }
+ // Paper end - more spawner API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java
@@ -0,0 +0,0 @@ import org.bukkit.entity.EntitySnapshot;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.minecart.SpawnerMinecart;
-final class CraftMinecartMobSpawner extends CraftMinecart implements SpawnerMinecart {
+final class CraftMinecartMobSpawner extends CraftMinecart implements SpawnerMinecart, org.bukkit.craftbukkit.spawner.PaperSharedSpawnerLogic { // Paper - more spawner API
CraftMinecartMobSpawner(CraftServer server, MinecartSpawner entity) {
super(server, entity);
}
@@ -0,0 +0,0 @@ final class CraftMinecartMobSpawner extends CraftMinecart implements SpawnerMine
public String toString() {
return "CraftMinecartMobSpawner";
}
+
+ // Paper start - more spawner API
+ @Override
+ public net.minecraft.world.level.BaseSpawner getSpawner() {
+ return this.getHandle().getSpawner();
+ }
+
+ @Override
+ public net.minecraft.world.level.Level getInternalWorld() {
+ return this.getHandle().level();
+ }
+
+ @Override
+ public net.minecraft.core.BlockPos getInternalPosition() {
+ return this.getHandle().blockPosition();
+ }
+ // Paper end - more spawner API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/spawner/PaperSharedSpawnerLogic.java b/src/main/java/org/bukkit/craftbukkit/spawner/PaperSharedSpawnerLogic.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/spawner/PaperSharedSpawnerLogic.java
@@ -0,0 +0,0 @@
+package org.bukkit.craftbukkit.spawner;
+
+import com.google.common.base.Preconditions;
+import java.util.Optional;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.level.BaseSpawner;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.SpawnData;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.spawner.Spawner;
+
+/**
+ * A common parent interface for both the {@link org.bukkit.craftbukkit.block.CraftCreatureSpawner} and minecart mob spawner.
+ */
+public interface PaperSharedSpawnerLogic extends Spawner {
+
+ BaseSpawner getSpawner();
+
+ Level getInternalWorld();
+
+ BlockPos getInternalPosition();
+
+ default boolean isActivated() {
+ return this.getSpawner().isNearPlayer(this.getInternalWorld(), this.getInternalPosition());
+ }
+
+ default void resetTimer() {
+ this.getSpawner().delay(this.getInternalWorld(), this.getInternalPosition());
+ }
+
+ default void setNextSpawnData(SpawnData spawnData) {
+ this.getSpawner().setNextSpawnData(this.getInternalWorld(), this.getInternalPosition(), spawnData);
+ }
+
+ default void setSpawnedItem(final ItemStack itemStack) {
+ Preconditions.checkArgument(itemStack != null && !itemStack.getType().isAir(), "spawners cannot spawn air");
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(itemStack);
+ net.minecraft.nbt.CompoundTag entity = new net.minecraft.nbt.CompoundTag();
+ entity.putString("id", net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getKey(net.minecraft.world.entity.EntityType.ITEM).toString());
+ entity.put("Item", item.save(this.world.getHandle().registryAccess()));
+ this.getSnapshot().getSpawner().setNextSpawnData(
+ this.isPlaced() ? this.world.getHandle() : null,
+ this.getPosition(),
+
+ final net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itemStack);
+ final CompoundTag entity = new CompoundTag();
+ entity.putString(Entity.ID_TAG, BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.ITEM).toString());
+ entity.put("Item", item.save(this.getInternalWorld().registryAccess()));
+
+ this.setNextSpawnData(
+ new net.minecraft.world.level.SpawnData(
+ entity,
+ java.util.Optional.empty(),
+ Optional.ofNullable(this.getSnapshot().getSpawner().nextSpawnData).flatMap(SpawnData::equipment)
+ Optional.ofNullable(this.getSpawner().nextSpawnData).flatMap(SpawnData::equipment)
+ )
+ );
+ }
+ // Paper end
}
+}

Datei anzeigen

@ -265,5 +265,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entity.connection.internalTeleport(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), nms);
+ // Paper end - Teleport API
} else {
entity.portalProcess = null; // SPIGOT-7785: there is no need to carry this over as it contains the old world/location and we might run into trouble if there is a portal in the same spot in both worlds
// The respawn reason should never be used if the passed location is non null.
this.server.getHandle().respawn(entity, true, Entity.RemovalReason.CHANGED_DIMENSION, null, to);

Datei anzeigen

@ -380,6 +380,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (!itemstack.isEmpty()) {
- int j = itemstack.getCount();
- // CraftBukkit start - Call event when pushing items into other inventories
- ItemStack original = itemstack.copy();
- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(blockEntity.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
-
- Inventory destinationInventory;
@ -395,7 +396,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- InventoryMoveItemEvent event = new InventoryMoveItemEvent(blockEntity.getOwner().getInventory(), oitemstack, destinationInventory, true);
- world.getCraftServer().getPluginManager().callEvent(event);
- if (event.isCancelled()) {
- blockEntity.setItem(i, itemstack);
- blockEntity.setItem(i, original);
- blockEntity.setCooldown(world.spigotConfig.hopperTransfer); // Delay hopper checks // Spigot
- return false;
- }
@ -423,6 +424,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // if (!itemstack.isEmpty()) {
+ // int j = itemstack.getCount();
+ // // CraftBukkit start - Call event when pushing items into other inventories
+ // ItemStack original = itemstack.copy();
+ // CraftItemStack oitemstack = CraftItemStack.asCraftMirror(blockEntity.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
+
+ // Inventory destinationInventory;
@ -438,7 +440,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentityhopper.getOwner().getInventory(), oitemstack, destinationInventory, true);
+ // world.getCraftServer().getPluginManager().callEvent(event);
+ // if (event.isCancelled()) {
+ // blockEntity.setItem(i, itemstack);
+ // blockEntity.setItem(i, original);
+ // blockEntity.setCooldown(world.spigotConfig.hopperTransfer); // Delay hopper checks // Spigot
+ // return false;
+ // }
@ -484,6 +486,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!itemstack.isEmpty() && HopperBlockEntity.canTakeItemFromContainer(ihopper, iinventory, itemstack, i, enumdirection)) {
- int j = itemstack.getCount();
- // CraftBukkit start - Call event on collection of items from inventories into the hopper
- ItemStack original = itemstack.copy();
- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
-
- Inventory sourceInventory;
@ -500,7 +503,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-
- Bukkit.getServer().getPluginManager().callEvent(event);
- if (event.isCancelled()) {
- iinventory.setItem(i, itemstack);
- iinventory.setItem(i, original);
-
- if (ihopper instanceof HopperBlockEntity) {
- ((HopperBlockEntity) ihopper).setCooldown(world.spigotConfig.hopperTransfer); // Spigot
@ -524,6 +527,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return hopperPull(world, ihopper, iinventory, itemstack, i);
+ // int j = itemstack.getCount();
+ // // CraftBukkit start - Call event on collection of items from inventories into the hopper
+ // ItemStack original = itemstack.copy();
+ // CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, world.spigotConfig.hopperAmount)); // Spigot
+
+ // Inventory sourceInventory;
@ -540,7 +544,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ // Bukkit.getServer().getPluginManager().callEvent(event);
+ // if (event.isCancelled()) {
+ // iinventory.setItem(i, itemstack);
+ // iinventory.setItem(i, original);
+
+ // if (ihopper instanceof HopperBlockEntity) {
+ // ((HopperBlockEntity) ihopper).setCooldown(world.spigotConfig.hopperTransfer); // Spigot

Datei anzeigen

@ -119,7 +119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // Kick all players
- for ( ServerPlayer p : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players )
- {
- p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ) );
- p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage, true ) );
- }
- // Give the socket a chance to send the packets
- try
@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Kick all players
+ for ( ServerPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
+ {
+ p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ) );
+ p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage, true ) );
+ }
+ // Give the socket a chance to send the packets
+ try

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.isRemoved()) {
return;
}
- java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
- 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();
@ -31,24 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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);
- for (org.bukkit.inventory.ItemStack item : this.drops) {
- loot.add(item);
- }
+ loot.addAll(this.drops); // Paper
- 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
} // Paper - fix player loottables running when mob loot gamerule is false
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
@Override
- public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) {
- ItemEntity entityitem = super.drop(stack, throwRandomly, retainOwnership);
+ public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership, boolean callDropEvent) { // Paper - Restore vanilla drops behavior; override method with most params
+ ItemEntity entityitem = super.drop(stack, throwRandomly, retainOwnership, callDropEvent); // Paper - Restore vanilla drops behavior; override method with most params
if (entityitem == null) {
return null;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
@ -238,8 +225,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - Restore vanilla drops behavior
if (stack == null || stack.getType() == Material.AIR) continue;
- world.dropItem(entity.getLocation(), stack);
+ drop.runConsumer(world, entity.getLocation()); // Paper - Restore vanilla drops behavior
- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for dropped items
+ drop.runConsumer(entity.getWorld(), entity.getLocation()); // Paper - Restore vanilla drops behavior
}
return event;

Datei anzeigen

@ -9,14 +9,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
// CraftBukkit start
- protected boolean actuallyHurt(final DamageSource damagesource, float f) { // void -> boolean, add final
+ protected boolean actuallyHurt(final DamageSource damagesource, float f) { // void -> boolean, add final // Paper - return false ONLY if event cancelled
if (!this.isInvulnerableTo(damagesource)) {
final boolean human = this instanceof net.minecraft.world.entity.player.Player;
float originalDamage = f;
// CraftBukkit start
- if (!this.actuallyHurt(source, (float) event.getFinalDamage() - this.lastHurt, event)) {
+ final float actualDamage = (float) event.getFinalDamage() - this.lastHurt; // Paper - revert to vanilla damage - move out for diff on change
+ if (!this.actuallyHurt(source, actualDamage, event)) { // Paper - revert to vanilla damage - move out for diff on change
return false;
}
+ if (this instanceof ServerPlayer && actualDamage == 0.0F) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0.
// CraftBukkit end
this.lastHurt = amount;
flag1 = false;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.actuallyHurt(source, (float) event.getFinalDamage(), event)) {
return false;
}
+ if (this instanceof ServerPlayer && event.getFinalDamage() == 0.0F) return false; // Paper - revert to vanilla damage - players are not affected by damage that is 0.
this.lastHurt = amount;
this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks
// this.actuallyHurt(damagesource, f);
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
return true;

Datei anzeigen

@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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);
for (org.bukkit.inventory.ItemStack item : this.drops) {
loot.add(item);
}
this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
loot.addAll(this.drops);
this.drops.clear(); // SPIGOT-5188: make sure to clear
+ } // Paper - fix player loottables running when mob loot gamerule is false

Datei anzeigen

@ -533,7 +533,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- CraftMetaFirework.FIREWORKS.TYPE,
- CraftMetaEnchantedBook.STORED_ENCHANTMENTS.TYPE,
- CraftMetaCharge.EXPLOSION.TYPE,
- CraftMetaBlockState.BLOCK_ENTITY_TAG.TYPE,
- CraftMetaKnowledgeBook.BOOK_RECIPES.TYPE,
- CraftMetaTropicalFishBucket.ENTITY_TAG.TYPE,
- CraftMetaTropicalFishBucket.BUCKET_ENTITY_TAG.TYPE,

@ -1 +1 @@
Subproject commit 2b4b6d14241d3d96eb6b7d1888176146dc5895d4
Subproject commit e86f4dc4bb897d2ad627763e46c9ed08b090f0f3

@ -1 +1 @@
Subproject commit 68603b1c1162f168efdfe8d989d8795587ef9842
Subproject commit c3ceeb6f79b4258d3c966f34aeafb7ca6d72e41a

@ -1 +1 @@
Subproject commit 146439e88cdda2de5ce54c2a9d6a6cdd9aa8bc1b
Subproject commit 491f36750240694ded097bb893aa03d5f7bb81d8