mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Persistent BlockEntity Lore and DisplayName
Makes it so that when a BlockEntity is placed in the world and then broken, the dropped ItemStack retains any original custom display name/lore.
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
--- a/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/net/minecraft/world/item/BlockItem.java
|
||||
@@ -152,7 +_,16 @@
|
||||
}
|
||||
|
||||
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level level, @Nullable Player player, ItemStack stack, BlockState state) {
|
||||
- return updateCustomBlockEntityTag(level, player, pos, stack);
|
||||
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
|
||||
+ boolean handled = updateCustomBlockEntityTag(level, player, pos, stack);
|
||||
+ if (level.purpurConfig.persistentTileEntityLore) {
|
||||
+ BlockEntity blockEntity1 = level.getBlockEntity(pos);
|
||||
+ if (blockEntity1 != null) {
|
||||
+ blockEntity1.setPersistentLore(stack.getOrDefault(DataComponents.LORE, net.minecraft.world.item.component.ItemLore.EMPTY));
|
||||
+ }
|
||||
+ }
|
||||
+ return handled;
|
||||
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -217,6 +_,7 @@
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user