mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Call BlockEntity#load in new child types (#9340)
BlockEntity#load is responsible for loading the pdc data for block entities. Some of the new block entities added by mojang do not call their super method, preventing paper from loading the PDC, which leads to a loss of data. This commit adds the super calls to prevent this.
This commit is contained in:
parent
01297f5079
commit
529fb86efd
1 changed files with 48 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bjarne Koll <git@lynxplay.dev>
|
||||
Date: Wed, 14 Jun 2023 12:52:29 +0200
|
||||
Subject: [PATCH] Call BlockEntity#load in new child types
|
||||
|
||||
BlockEntity#load is responsible for loading the pdc data for block
|
||||
entities. Some of the new block entities added by mojang do not call
|
||||
their super method, preventing paper from loading the PDC, which
|
||||
leads to a loss of data.
|
||||
|
||||
This patch adds the super calls to prevent this.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class BrushableBlockEntity extends BlockEntity {
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag nbt) {
|
||||
+ super.load(nbt); // Paper - invoke super to load additional, bukkit managed data
|
||||
if (!this.tryLoadLootTable(nbt) && nbt.contains("item")) {
|
||||
this.item = ItemStack.of(nbt.getCompound("item"));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class ChiseledBookShelfBlockEntity extends BlockEntity implements Contain
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag nbt) {
|
||||
+ super.load(nbt); // Paper - invoke super to load additional, bukkit managed data
|
||||
this.items.clear();
|
||||
ContainerHelper.loadAllItems(nbt, this.items);
|
||||
this.lastInteractedSlot = nbt.getInt("last_interacted_slot");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag nbt) {
|
||||
+ super.load(nbt); // Paper - invoke super to load additional, bukkit managed data
|
||||
this.catalystListener.sculkSpreader.load(nbt);
|
||||
}
|
||||
|
Loading…
Reference in a new issue