mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-27 10:49:06 +00:00
Configure powdered snow bucket stack size
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
new Item.Properties()
|
||||
.rarity(Rarity.RARE)
|
||||
.food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE)
|
||||
@@ -1422,12 +_,12 @@
|
||||
@@ -1422,22 +_,23 @@
|
||||
(block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties),
|
||||
new Item.Properties().stacksTo(16)
|
||||
);
|
||||
@@ -66,7 +66,11 @@
|
||||
);
|
||||
public static final Item POWDER_SNOW_BUCKET = registerItem(
|
||||
"powder_snow_bucket",
|
||||
@@ -1438,6 +_,7 @@
|
||||
- properties -> new SolidBucketItem(Blocks.POWDER_SNOW, SoundEvents.BUCKET_EMPTY_POWDER_SNOW, properties),
|
||||
+ me.samsuik.sakura.player.item.PowderedSnowBucketItem::new, // Sakura - modify bucket stack size
|
||||
new Item.Properties().stacksTo(1).useItemDescriptionPrefix()
|
||||
);
|
||||
public static final Item SNOWBALL = registerItem("snowball", SnowballItem::new, new Item.Properties().stacksTo(16));
|
||||
public static final Item LEATHER = registerItem("leather");
|
||||
public static final Item MILK_BUCKET = registerItem(
|
||||
"milk_bucket",
|
||||
|
||||
@@ -67,6 +67,7 @@ public final class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
public IntOr.Default bucketStackSize = IntOr.Default.USE_DEFAULT;
|
||||
public boolean stackableMilkBuckets = false;
|
||||
public boolean stackablePowderedSnowBuckets = false;
|
||||
}
|
||||
|
||||
public Environment environment;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package me.samsuik.sakura.player.item;
|
||||
|
||||
import me.samsuik.sakura.configuration.GlobalConfiguration;
|
||||
import net.minecraft.core.component.DataComponentMap;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.component.PatchedDataComponentMap;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.SolidBucketItem;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public final class PowderedSnowBucketItem extends SolidBucketItem {
|
||||
public PowderedSnowBucketItem(final Properties properties) {
|
||||
super(Blocks.POWDER_SNOW, SoundEvents.BUCKET_EMPTY_POWDER_SNOW, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataComponentMap components() {
|
||||
final DataComponentMap components = super.components();
|
||||
return stackablePowderedSnowBuckets()
|
||||
? DataComponentHelper.updateBucketMaxStackSize(components)
|
||||
: components;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyComponentsSentToClient(final PatchedDataComponentMap components) {
|
||||
if (stackablePowderedSnowBuckets()) {
|
||||
components.set(DataComponents.MAX_STACK_SIZE, DataComponentHelper.bucketMaxStackSize());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean stackablePowderedSnowBuckets() {
|
||||
final GlobalConfiguration config = GlobalConfiguration.get();
|
||||
return config != null && config.players.stackablePowderedSnowBuckets;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user