mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-06-21 17:57:50 +02:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7b66699b 26.2-rc-2 PaperMC/Paper@bb676e22 actual 26.2-rc-2 PaperMC/Paper@a737972b Fix isAllowedInPeaceful call PaperMC/Paper@c35810c3 Update deps to match Vanilla PaperMC/Paper@e5643cd4 Update Vex#getSummoner return type PaperMC/Paper@e00936a3 [ci/skip] update log4j for the api PaperMC/Paper@eb5df78f fix wither spawning parity and remove openSign var PaperMC/Paper@d1aca9a6 Apply most remaining feature patches
113 lines
7.6 KiB
Diff
113 lines
7.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
Date: Tue, 17 Nov 2020 03:23:48 -0800
|
|
Subject: [PATCH] Apply display names from item forms of entities to entities
|
|
and vice versa
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
index c1c9387a54ed219f8da58a9a417c85a15eea7bec..235c2acd9781979d4cf621cdfae2d6f745595fbd 100644
|
|
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -476,6 +476,7 @@ public class ArmorStand extends LivingEntity {
|
|
|
|
private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(final ServerLevel level, final DamageSource source) { // Paper
|
|
ItemStack result = new ItemStack(Items.ARMOR_STAND);
|
|
+ if (level.purpurConfig.persistentDroppableEntityDisplayNames) // Purpur - Apply display names from item forms of entities to entities and vice versa
|
|
result.set(DataComponents.CUSTOM_NAME, this.getCustomName());
|
|
this.deathDropItems = new java.util.ArrayList<>(); // Paper
|
|
this.deathDropItems.add(new DefaultDrop(result, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
|
|
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
index 7fa894e6052dd35a87b19f6bac6031bfd0243deb..19bd80e860a520f6a07baa3e66cc40c8a419c79f 100644
|
|
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
@@ -249,7 +249,11 @@ public class ItemFrame extends HangingEntity {
|
|
this.removeFramedMap(itemStack);
|
|
} else {
|
|
if (withFrame) {
|
|
- this.spawnAtLocation(level, this.getFrameItemStack());
|
|
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
|
|
+ final ItemStack itemFrame = this.getFrameItemStack();
|
|
+ if (!level.purpurConfig.persistentDroppableEntityDisplayNames) itemFrame.set(DataComponents.CUSTOM_NAME, null);
|
|
+ this.spawnAtLocation(level, itemFrame);
|
|
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
|
|
}
|
|
|
|
if (!itemStack.isEmpty()) {
|
|
diff --git a/net/minecraft/world/entity/decoration/painting/Painting.java b/net/minecraft/world/entity/decoration/painting/Painting.java
|
|
index ed20a97ca9253c5c6626f3fddef45c54490fc285..338992872b24a46babd24eb364044e1449e27f17 100644
|
|
--- a/net/minecraft/world/entity/decoration/painting/Painting.java
|
|
+++ b/net/minecraft/world/entity/decoration/painting/Painting.java
|
|
@@ -183,7 +183,11 @@ public class Painting extends HangingEntity {
|
|
if (level.getGameRules().get(GameRules.ENTITY_DROPS)) {
|
|
this.playSound(SoundEvents.PAINTING_BREAK, 1.0F, 1.0F);
|
|
if (!(causedBy instanceof Player player && player.hasInfiniteMaterials())) {
|
|
- this.spawnAtLocation(level, Items.PAINTING);
|
|
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
|
|
+ final ItemStack painting = new ItemStack(Items.PAINTING);
|
|
+ if (!this.level().purpurConfig.persistentDroppableEntityDisplayNames) painting.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, null);
|
|
+ this.spawnAtLocation(level, painting);
|
|
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
|
|
}
|
|
}
|
|
}
|
|
diff --git a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
index 2a6c5faa18da0f008e34eb4f2e2c3dc14e49186a..2e4ee279e4a9afacdfdfb6e1ed99a66c08aee4c9 100644
|
|
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
@@ -825,7 +825,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
|
|
|
|
@Override
|
|
public final ItemStack getPickResult() {
|
|
- return new ItemStack(this.dropItem.get());
|
|
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
|
|
+ final ItemStack boat = new ItemStack(this.dropItem.get());
|
|
+ if (!this.level().purpurConfig.persistentDroppableEntityDisplayNames) {
|
|
+ boat.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, null);
|
|
+ }
|
|
+ return boat;
|
|
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/item/ArmorStandItem.java b/net/minecraft/world/item/ArmorStandItem.java
|
|
index 9ed039c323cccf163e7b3f39d73fcc7e3b5c663c..e640c97e26308988f0c8bd0c57d05365e8a41d9f 100644
|
|
--- a/net/minecraft/world/item/ArmorStandItem.java
|
|
+++ b/net/minecraft/world/item/ArmorStandItem.java
|
|
@@ -53,6 +53,10 @@ public class ArmorStandItem extends Item {
|
|
return InteractionResult.FAIL;
|
|
}
|
|
// CraftBukkit end
|
|
+ // Purpur start - Apply display names from item forms of entities to entities and vice versa
|
|
+ if (!serverLevel.purpurConfig.persistentDroppableEntityDisplayNames) entity.setCustomName(null);
|
|
+ if (serverLevel.purpurConfig.armorstandSetNameVisible && entity.getCustomName() != null) entity.setCustomNameVisible(true);
|
|
+ // Purpur end - Apply display names from item forms of entities to entities and vice versa
|
|
serverLevel.addFreshEntityWithPassengers(entity);
|
|
level.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ARMOR_STAND_PLACE, SoundSource.BLOCKS, 0.75F, 0.8F);
|
|
entity.gameEvent(GameEvent.ENTITY_PLACE, context.getPlayer());
|
|
diff --git a/net/minecraft/world/item/BoatItem.java b/net/minecraft/world/item/BoatItem.java
|
|
index 416feeb88dd0c473e596a8bb217fab52a24d23be..597f14af31e1a1253e5d412af390e200632ba279 100644
|
|
--- a/net/minecraft/world/item/BoatItem.java
|
|
+++ b/net/minecraft/world/item/BoatItem.java
|
|
@@ -65,6 +65,7 @@ public class BoatItem extends Item {
|
|
}
|
|
|
|
boat.setYRot(player.getYRot());
|
|
+ if (!level.purpurConfig.persistentDroppableEntityDisplayNames) boat.setCustomName(null); // Purpur - Apply display names from item forms of entities to entities and vice versa
|
|
if (!level.noCollision(boat, boat.getBoundingBox())) {
|
|
return InteractionResult.FAIL;
|
|
}
|
|
diff --git a/net/minecraft/world/item/HangingEntityItem.java b/net/minecraft/world/item/HangingEntityItem.java
|
|
index 56a048740794db66917c2975a65d9d8fc5a8dc36..e3d81dc449545d6ce25c2f2cb46d521cc6a2a422 100644
|
|
--- a/net/minecraft/world/item/HangingEntityItem.java
|
|
+++ b/net/minecraft/world/item/HangingEntityItem.java
|
|
@@ -61,7 +61,7 @@ public class HangingEntityItem extends Item {
|
|
entity = new GlowItemFrame(level, blockPos, clickedFace);
|
|
}
|
|
|
|
- EntityType.<HangingEntity>createDefaultStackConfig(level, itemInHand, player).apply(entity);
|
|
+ EntityType.<HangingEntity>appendDefaultStackConfig(entity1 -> {if (!level.purpurConfig.persistentDroppableEntityDisplayNames) entity1.setCustomName(null);}, level, itemInHand, player).apply(entity); // Purpur - Apply display names from item forms of entities to entities and vice versa
|
|
if (entity.survives()) {
|
|
if (!level.isClientSide()) {
|
|
// CraftBukkit start - fire HangingPlaceEvent
|