remove pca

This commit is contained in:
zly2006 committed 2024-07-11 12:14:02 +08:00
1 parent cb3443d37f
commit 4ba22176bc
24 files changed
+389 -1070

No files matched your search

@@ -2,6 +2,9 @@ package com.github.zly2006.carpetslsaddition.util;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.component.ComponentType;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
@@ -13,11 +16,10 @@ public class ShulkerBoxItemUtil {
public static boolean isEmptyShulkerBoxItem(ItemStack itemStack) {
if (itemStack.getItem() instanceof BlockItem &&
((BlockItem) itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) {
NbtCompound nbt = itemStack.getNbt();
if (nbt != null && nbt.contains("BlockEntityTag", 10)) {
NbtCompound tag = nbt.getCompound("BlockEntityTag");
if (tag.contains("Items", 9)) {
NbtList tagList = tag.getList("Items", 10);
NbtComponent tag = itemStack.getComponents().get(DataComponentTypes.BLOCK_ENTITY_DATA);
if (tag != null) {
if (tag.contains("Items")) {
NbtList tagList = tag.getNbt().getList("Items", 10);
return tagList.size() <= 0;
}
}
@@ -38,4 +40,4 @@ public class ShulkerBoxItemUtil {
public static boolean isStackable(ItemStack itemStack) {
return getMaxCount(itemStack) > 1 && (!itemStack.isDamageable() || !itemStack.isDamaged());
}
}
}