Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Loading