diff --git a/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java b/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java index 876d2abd92..94615497af 100644 --- a/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java +++ b/src/main/java/com/simibubi/create/content/legacy/ChromaticCompoundItem.java @@ -2,6 +2,8 @@ import com.simibubi.create.AllDataComponents; +import net.minecraft.core.component.DataComponentMap; + import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllItems; @@ -45,6 +47,10 @@ public int getLight(ItemStack stack) { return stack.getOrDefault(AllDataComponents.CHROMATIC_COMPOUND_COLLECTING_LIGHT, 0); } + public int getLight(DataComponentMap components) { + return components.getOrDefault(AllDataComponents.CHROMATIC_COMPOUND_COLLECTING_LIGHT, 0); + } + @Override public boolean isBarVisible(ItemStack stack) { return getLight(stack) > 0; @@ -218,8 +224,9 @@ public boolean checkLight(ItemStack stack, ItemEntity entity, Level world, ItemS .getBlockPos())) return false; + DataComponentMap components = itemStack.getComponents(); ItemStack newStack = stack.split(1); - newStack.set(AllDataComponents.CHROMATIC_COMPOUND_COLLECTING_LIGHT, getLight(itemStack) + 1); + newStack.set(AllDataComponents.CHROMATIC_COMPOUND_COLLECTING_LIGHT, getLight(components) + 1); ItemEntity newEntity = new ItemEntity(world, entity.getX(), entity.getY(), entity.getZ(), newStack); newEntity.setDeltaMovement(entity.getDeltaMovement()); newEntity.setDefaultPickUpDelay();