mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 03:39:07 +00:00
Fix exception with milk buckets
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
package me.samsuik.sakura.player.item;
|
||||
|
||||
import me.samsuik.sakura.configuration.GlobalConfiguration;
|
||||
import net.minecraft.core.component.DataComponentMap;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
|
||||
public final class DataComponentHelper {
|
||||
public static int bucketMaxStackSize() {
|
||||
me.samsuik.sakura.configuration.GlobalConfiguration config = me.samsuik.sakura.configuration.GlobalConfiguration.get();
|
||||
GlobalConfiguration config = GlobalConfiguration.get();
|
||||
return config == null || !config.players.bucketStackSize.isDefined() ? -1 : config.players.bucketStackSize.intValue();
|
||||
}
|
||||
|
||||
public static boolean stackableMilkBuckets() {
|
||||
GlobalConfiguration config = GlobalConfiguration.get();
|
||||
return config != null && config.players.stackableMilkBuckets;
|
||||
}
|
||||
|
||||
public static DataComponentMap copyComponentsAndModifyMaxStackSize(DataComponentMap componentMap, int maxItemSize) {
|
||||
if (maxItemSize > 0 && maxItemSize <= 99) {
|
||||
return DataComponentMap.builder()
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class MilkBucketItem extends Item {
|
||||
@Override
|
||||
public void verifyComponentsAfterLoad(ItemStack stack) {
|
||||
int maxStackSize = DataComponentHelper.bucketMaxStackSize();
|
||||
if (GlobalConfiguration.get().players.stackableMilkBuckets && maxStackSize > 0 && maxStackSize < 100) {
|
||||
if (DataComponentHelper.stackableMilkBuckets() && maxStackSize > 0 && maxStackSize < 100) {
|
||||
stack.set(DataComponents.MAX_STACK_SIZE, maxStackSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user