mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-04-19 17:58:15 +02:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@e4a5a894 Update to Minecraft 26.1.1 PaperMC/Paper@92a4d8db Update "Only write chunk data to disk if it serializes without throwing" PaperMC/Paper@02d9cbce Update "Entity load/save limit per chunk" PaperMC/Paper@cb696286 Update "Attempt to recalculate regionfile header if it is corrupt" PaperMC/Paper@4662bab9 Update "Incremental chunk and player saving" PaperMC/Paper@4dddc82f Implement new version schema: `<mcver>.build.<paper_build_no>-<paper_status>` / `<mcver>.local-SNAPSHOT` PaperMC/Paper@fc0a9980 Set channel to ALPHA PaperMC/Paper@a4fa0357 update gradle wrapper PaperMC/Paper@a15ceb7a Update fill-gradle to 1.0.11 PaperMC/Paper@52f7e24e Publish to releases repository PaperMC/Paper@bb7ff8f0 Update "Optimise general POI access" PaperMC/Paper@ac42a07e Update "Flush regionfiles on save configuration option" PaperMC/Paper@14357cc5 Avoid using the regionfile directory name to determine if it is chunk data PaperMC/Paper@a2f4d349 Update "Optimise collision checking in player move packet handling" PaperMC/Paper@50303a0e Update "Add explicit flush support to Log4j AsyncAppender" PaperMC/Paper@7bc4f895 Shift unapplied patches PaperMC/Paper@62ba2c4f Update "Improve keepalive ping system" PaperMC/Paper@f6d27019 Update "Optimise EntityScheduler ticking" PaperMC/Paper@4d8d06c7 Fix WorldBorder#setCenter ignoring new values on 26.1.1 (#13741) PaperMC/Paper@f9da8035 update unpick definitions PaperMC/Paper@fc71a133 [ci/skip] fixup previous commit PaperMC/Paper@4c91cd34 Lazy set Entity.projectileSource in AbstractProjectile#getShooter PaperMC/Paper@3d1da60c Cache the climbing check in activation range (#12764) PaperMC/Paper@575630f3 feat: Optimize ServerWaypointManager when locator bar is disabled PaperMC/Paper@742daf02 [ci/skip] fixup previous commit PaperMC/Paper@d29063da Rebuild patches PaperMC/Paper@ce581c3c Bump deps to match Vanilla versions (#13744) PaperMC/Paper@f3e9a934 Fix attack check PaperMC/Paper@b4743b58 Fix gamerule loading in Management Protocol (#13753) PaperMC/Paper@c53ac8a1 Add PlayerToggleEntityAgeLockEvent (#13742) PaperMC/Paper@59081719 fixup previous event PaperMC/Paper@7b49b586 Update "Optional per player mob spawns" PaperMC/Paper@1fae14c2 Update "Improve cancelling PreCreatureSpawnEvent with per player mob spawns" PaperMC/Paper@c40cb75b Update "Optimize Hoppers" PaperMC/Paper@edad1e4c Update "Anti-Xray" PaperMC/Paper@106a934d [ci/skip] Drop stale TODO PaperMC/Paper@77c0866f handle legacy uid in vanilla migration and always write metadata during migration
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 5c749dbb137fed1c94430c0df637fec95a8773be..25c403d66d6e4c8b1798f5ba7f0a610430b4cc09 100644
|
|
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
|
@@ -814,7 +814,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
|