mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-06-23 18:57:49 +02:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@2e7bb166 Deprecate dyes custom tag in favour of vanilla tag (#13855) PaperMC/Paper@6048c2d9 Fix LivingEntity#knockback ignored when its Player (#13842) PaperMC/Paper@b80b6046 fix: Attack strength ticker cooldown incorrectly reset (#13856) PaperMC/Paper@1835b046 Call AsyncPlayerPreLoginEvent/AsyncPlayerConnectionConfigureEvent on virtual threads (#13816) PaperMC/Paper@afea65c2 Fix leash event for boats and elytra (#13697) PaperMC/Paper@39bd1bac [ci/skip] Rebuild patches PaperMC/Paper@11dbf110 Call BlockRedstoneEvent for more interactions (#12206) PaperMC/Paper@b8b4a1c7 Update Player#getClientViewDistance (#13530) PaperMC/Paper@b685281d [ci/skip] Mention documenting new config options in CONTRIBUTING.md (#13664)
113 lines
7.8 KiB
Diff
113 lines
7.8 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 3f4986d6a755088a2014a373767e51efa976e997..8cb13a742a1cc03d60c78d0bf5be8c6a8cd1a6ae 100644
|
|
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -452,6 +452,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.drops.add(new DefaultDrop(result, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
|
|
return this.brokenByAnything(level, source); // Paper
|
|
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
index 898f64de427b84cbf9b0e5198098f8e2e9040928..bc12a7a96d8db8eb6ad2bcfccaa69464c1e2170d 100644
|
|
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
@@ -246,7 +246,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 7195082470ca411caf9c071e970edddae93cb127..9740bb9ec78cad900b9fa7d8ed6fca6a4016de03 100644
|
|
--- a/net/minecraft/world/entity/decoration/painting/Painting.java
|
|
+++ b/net/minecraft/world/entity/decoration/painting/Painting.java
|
|
@@ -182,7 +182,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 a820abd08a5e2a7deada616305f3a3e8ecc4fea8..f289bd4a4251dc98b194b79d030dc480dd9dbb66 100644
|
|
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
@@ -822,7 +822,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 4b4cc75640cc567a74c99ec8653436b2f2a50df6..47d1e104d910addcf8322976061ef38d8c791ea8 100644
|
|
--- a/net/minecraft/world/item/ArmorStandItem.java
|
|
+++ b/net/minecraft/world/item/ArmorStandItem.java
|
|
@@ -51,6 +51,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 cd7f38ab2553062dcd003bd6f758e4aba77051ea..2b90dec5d564f05f350637a9645d76d4ab7d6126 100644
|
|
--- a/net/minecraft/world/item/BoatItem.java
|
|
+++ b/net/minecraft/world/item/BoatItem.java
|
|
@@ -63,6 +63,7 @@ public class BoatItem extends Item {
|
|
return InteractionResult.FAIL;
|
|
} else {
|
|
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;
|
|
} else {
|
|
diff --git a/net/minecraft/world/item/HangingEntityItem.java b/net/minecraft/world/item/HangingEntityItem.java
|
|
index 1e30fe428914c8ae4f6caf3cb5a05ced4e183393..c07b334eb05fd277925b684256591d505e5fd46a 100644
|
|
--- a/net/minecraft/world/item/HangingEntityItem.java
|
|
+++ b/net/minecraft/world/item/HangingEntityItem.java
|
|
@@ -59,7 +59,7 @@ public class HangingEntityItem extends Item {
|
|
entity = new GlowItemFrame(level, blockPos, clickedFace);
|
|
}
|
|
|
|
- EntityType.<HangingEntity>createDefaultStackConfig(level, itemInHand, player).accept(entity);
|
|
+ EntityType.<HangingEntity>appendDefaultStackConfig(entity1 -> {if (!level.purpurConfig.persistentDroppableEntityDisplayNames) entity1.setCustomName(null);}, level, itemInHand, player).accept(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
|