Merge pull request #94 from mlus-asuka/backport-90-to-1.20.4
[Backport 1.20.4] unify item creation in curios and normal inventory
This commit is contained in:
commit
d657c7a819
|
|
@ -70,9 +70,7 @@ public class ModsSupport {
|
||||||
}
|
}
|
||||||
String serialized = entry.getValue();
|
String serialized = entry.getValue();
|
||||||
try {
|
try {
|
||||||
String nbtString = VanillaSync.deserializeString(serialized);
|
ItemStack stack = VanillaSync.deserializeAndCreatePlaceholderIfNeeded(serialized);
|
||||||
CompoundTag tag = VanillaSync.snbtToFixedCompoundTag(nbtString);
|
|
||||||
ItemStack stack = ItemStack.of(tag);
|
|
||||||
if (handler.getCurios().containsKey(slotType)) {
|
if (handler.getCurios().containsKey(slotType)) {
|
||||||
ICurioStacksHandler stacksHandler = handler.getCurios().get(slotType);
|
ICurioStacksHandler stacksHandler = handler.getCurios().get(slotType);
|
||||||
IDynamicStackHandler dynStacks = stacksHandler.getStacks();
|
IDynamicStackHandler dynStacks = stacksHandler.getStacks();
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ public class VanillaSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
// deserialize item and potentially create placeholders
|
// deserialize item and potentially create placeholders
|
||||||
private static ItemStack deserializeAndCreatePlaceholderIfNeeded(String serializedNbt)
|
public static ItemStack deserializeAndCreatePlaceholderIfNeeded(String serializedNbt)
|
||||||
throws CommandSyntaxException {
|
throws CommandSyntaxException {
|
||||||
if (serializedNbt == null || serializedNbt.isEmpty() || serializedNbt.equals("B64:e30=")) {
|
if (serializedNbt == null || serializedNbt.isEmpty() || serializedNbt.equals("B64:e30=")) {
|
||||||
// Check for empty NBT (Base64 encoded '{}')
|
// Check for empty NBT (Base64 encoded '{}')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user