9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-03 14:12:23 +00:00

Add stackable milk buckets

This commit is contained in:
Samsuik
2025-02-13 16:26:09 +00:00
parent d3e886a5c8
commit 8a1aeca928
7 changed files with 95 additions and 22 deletions

View File

@@ -1,23 +1,5 @@
--- a/net/minecraft/world/item/BucketItem.java
+++ b/net/minecraft/world/item/BucketItem.java
@@ -112,6 +_,17 @@
return !player.hasInfiniteMaterials() ? new ItemStack(Items.BUCKET) : bucketStack;
}
+ // Sakura start - modify bucket stack size
+ @Override
+ public void verifyComponentsAfterLoad(ItemStack stack) {
+ me.samsuik.sakura.configuration.GlobalConfiguration config = me.samsuik.sakura.configuration.GlobalConfiguration.get();
+ int customItemSize = config == null || !config.players.bucketStackSize.isDefined() ? -1 : config.players.bucketStackSize.intValue();
+ if (customItemSize > 0 && customItemSize < 100) {
+ stack.set(net.minecraft.core.component.DataComponents.MAX_STACK_SIZE, customItemSize);
+ }
+ }
+ // Sakura end - modify bucket stack size
+
@Override
public void checkExtraContent(@Nullable Player player, Level level, ItemStack containerStack, BlockPos pos) {
}
@@ -147,7 +_,7 @@
// CraftBukkit end
if (!flag) {

View File

@@ -4,7 +4,31 @@
public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE));
public static final Item ENCHANTED_GOLDEN_APPLE = registerItem(
"enchanted_golden_apple",
+ me.samsuik.sakura.player.combat.CustomGoldenApple::new, // Sakura - old enchanted golden apples
+ me.samsuik.sakura.player.item.LegacyGoldenAppleItem::new, // Sakura - old enchanted golden apples
new Item.Properties()
.rarity(Rarity.RARE)
.food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE)
@@ -1295,12 +_,12 @@
(block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties),
new Item.Properties().stacksTo(16)
);
- public static final Item BUCKET = registerItem("bucket", properties -> new BucketItem(Fluids.EMPTY, properties), new Item.Properties().stacksTo(16));
+ public static final Item BUCKET = registerItem("bucket", properties -> new me.samsuik.sakura.player.item.StackableBucketItem(Fluids.EMPTY, properties), new Item.Properties().stacksTo(16)); // Sakura - modify bucket stack size
public static final Item WATER_BUCKET = registerItem(
- "water_bucket", properties -> new BucketItem(Fluids.WATER, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1)
+ "water_bucket", properties -> new me.samsuik.sakura.player.item.StackableBucketItem(Fluids.WATER, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1) // Sakura - modify bucket stack size
);
public static final Item LAVA_BUCKET = registerItem(
- "lava_bucket", properties -> new BucketItem(Fluids.LAVA, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1)
+ "lava_bucket", properties -> new me.samsuik.sakura.player.item.StackableBucketItem(Fluids.LAVA, properties), new Item.Properties().craftRemainder(BUCKET).stacksTo(1) // Sakura - modify bucket stack size
);
public static final Item POWDER_SNOW_BUCKET = registerItem(
"powder_snow_bucket",
@@ -1311,6 +_,7 @@
public static final Item LEATHER = registerItem("leather");
public static final Item MILK_BUCKET = registerItem(
"milk_bucket",
+ me.samsuik.sakura.player.item.MilkBucketItem::new, // Sakura - modify bucket stack size
new Item.Properties().craftRemainder(BUCKET).component(DataComponents.CONSUMABLE, Consumables.MILK_BUCKET).usingConvertsTo(BUCKET).stacksTo(1)
);
public static final Item PUFFERFISH_BUCKET = registerItem(