Skip to content
Merged
Show file tree
Hide file tree
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
@@ -1,4 +1,4 @@
// 1.21.1 2026-05-31T12:41:06.4543352 Loot Tables
// 1.21.1 2026-05-31T12:33:12.8145748 Loot Tables
7e6629cf425f2397f87b1a6c439f701aa8b4fd04 data/lemonmates/loot_table/blocks/citron_button.json
5ecfcd3e41895ce2db80738f891e13845547f945 data/lemonmates/loot_table/blocks/citron_crate.json
1126754d8c95732b55490a43313d49624d070270 data/lemonmates/loot_table/blocks/citron_door.json
Expand All @@ -18,7 +18,6 @@ be56f3f3d40997839e2f5cafbdd671ad138bff15 data/lemonmates/loot_table/blocks/citro
d4e59033f364cc2b689d470b73733bcad5a931a8 data/lemonmates/loot_table/blocks/citron_wall_sign.json
4098d61de0b4bf5314926c5a4b04f366f2f7f8d2 data/lemonmates/loot_table/blocks/citron_wood.json
52b02e8a86046b0714d06d30e507355d0db80338 data/lemonmates/loot_table/blocks/lemonade_glass.json
6cec54e70429e90771526e7e9654ddf9c135eced data/lemonmates/loot_table/blocks/lemonade_glass_decorated.json
823beb259369acb4fdd376e070194ff9e62c9466 data/lemonmates/loot_table/blocks/lemonade_jug_glass.json
aed3ef01a3de02d9c3c734a23806caf4d1878430 data/lemonmates/loot_table/blocks/lemonade_jug_terracotta.json
f904d74cc3fafb07d9e23051af019f5edaebaeae data/lemonmates/loot_table/blocks/orange_button.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2026-05-31T12:41:06.4572641 Recipes
// 1.21.1 2026-05-31T13:09:44.0424189 Recipes
facd248ef881f97de28f9e5e269db79dc09c7fb3 data/lemonmates/advancement/recipes/building_blocks/citron.json
1d7c61d7aa66adee3bb6a9752e28e5b3481ff485 data/lemonmates/advancement/recipes/building_blocks/citron_crate.json
8c180e50e9625c1985dfc40e7be05f0293d92fd2 data/lemonmates/advancement/recipes/building_blocks/citron_planks.json
Expand Down Expand Up @@ -28,8 +28,6 @@ ed7cc37c657142fcfb7a9f35e05ee108279cba8f data/lemonmates/advancement/recipes/mis
3f7b9d8f197674a62374728056c3fbb0390897b6 data/lemonmates/advancement/recipes/misc/citron_slice.json
8a5ff5088292e7db5904b0488942fcdeb4f3d8b7 data/lemonmates/advancement/recipes/misc/label_empty.json
2ce38d1b0a3191d6ccf0b53638f457b5a8c0f517 data/lemonmates/advancement/recipes/misc/lemonade_glass.json
42bd069b3e8b34bf2504b8845a13f913b13a3212 data/lemonmates/advancement/recipes/misc/lemonade_jug_glass.json
07794e11bca6b3f5a4541c23ce70e184079ba7f2 data/lemonmates/advancement/recipes/misc/lemonade_jug_terracotta.json
7090289653e8095ab022c12bc87396441acb7b00 data/lemonmates/advancement/recipes/misc/orange_from_crate.json
79dda7e25b11b57791df4af5f50cd05c55a68eb6 data/lemonmates/advancement/recipes/misc/orange_slice.json
02a69065c1431db74b184acb80e738e17de6d632 data/lemonmates/advancement/recipes/misc/preform.json
Expand Down Expand Up @@ -73,8 +71,6 @@ a2e9563dd03da6f91007bce9d7f5ca443a86d2be data/lemonmates/recipe/citron_slice.jso
8a180511c751f3e23544d072d880c7d0cc60ccec data/lemonmates/recipe/citron_wood.json
f37e26b1d661dbf1d288bc4fa2a3d2590aa307d7 data/lemonmates/recipe/label_empty.json
972a1051a558fd53ff3e93e533239e7822f32984 data/lemonmates/recipe/lemonade_glass.json
cc2f7168aee3730ff80483f5ad8eeb6f43c83dec data/lemonmates/recipe/lemonade_jug_glass.json
95577366693e19041ea153ada391de14ccdca07c data/lemonmates/recipe/lemonade_jug_terracotta.json
fa5c3be35146baac35c21ac10ea3fce7aa431d80 data/lemonmates/recipe/orange.json
4fee22ae48a9903db8201e411fad82b780879c23 data/lemonmates/recipe/orange_boat.json
446643ff87c3cd0eea22285bb723163ae970c0d4 data/lemonmates/recipe/orange_button.json
Expand Down

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/net/doppelr/lemonmates/AllCreativeModeTabs.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.doppelr.lemonmates;

import net.doppelr.lemonmates.block.ModBlocks;
import net.doppelr.lemonmates.block.properties.ApplicableFluidsToFluidContainer;
import net.doppelr.lemonmates.block.properties.StrawsVariants;
import net.doppelr.lemonmates.block.properties.UmbrellaVariants;
import net.doppelr.lemonmates.fluid.ModFluids;
Expand All @@ -19,6 +20,8 @@ public class AllCreativeModeTabs {

private static ItemStack lemonadeJugStack(ItemStack stack) {
stack.set(AllDataComponents.CAN_POUR, false);
stack.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, ApplicableFluidsToFluidContainer.NONE);
stack.set(AllDataComponents.JUG_LEVEL, 0);
return stack;
}

Expand All @@ -43,6 +46,7 @@ private static ItemStack lemonadeJugStack(ItemStack stack) {
// Misc
output.accept(ModBlocks.LEMONADE_GLASS);
output.accept(lemonadeJugStack(ModItems.LEMONADE_JUG_TERRACOTTA.toStack()));
output.accept(lemonadeJugStack(ModItems.LEMONADE_JUG_GLASS.toStack()));

// Finished Lemonades
output.accept(ModItems.CITRON_LEMONADE_BOTTLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void createCustomTooltip(String id, boolean hasConditionalBehaviou
createShiftText(components);
if (Screen.hasShiftDown()) {
components.add(empty());
components.addAll(getBasicSummary(id));
components.addAll(getBasicSummary(id, args));
if (hasConditionalBehaviour) {
createConditionalBehaviourTooltip(id, 1, components, args);
}
Expand Down Expand Up @@ -63,8 +63,8 @@ public static MutableComponent empty() {
return Component.literal("");
}

public static List<Component> getBasicSummary(String id) {
return FontHelper.cutTextComponent(Component.translatable(id + ".tooltip.summary"), FontHelper.Palette.STANDARD_CREATE);
public static List<Component> getBasicSummary(String id, Object... args) {
return FontHelper.cutTextComponent(Component.translatable(id + ".tooltip.summary", args), FontHelper.Palette.STANDARD_CREATE);
}

public static List<Component> getCondition(String id, int sequence, Object... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev
int blockDrinkLevel = state.getValue(DRINK_LEVEL) == 1 ? 2 : newDrinkLevel;
ApplicableFluidsToFluidContainer pouredFluid = stack.get(AllDataComponents.JUG_LEVEL) > 0 ? stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) : state.getValue(FLUID);
if (state.getValue(FLUID) == ApplicableFluidsToFluidContainer.NONE || state.getValue(DRINK_LEVEL) == 0) {
level.setBlockAndUpdate(pos, state.setValue(FLUID, pouredFluid).setValue(DRINK_LEVEL, blockDrinkLevel));
jugItem.removeFromJugLevel(stack, player, newDrinkLevel);
if (stack.get(AllDataComponents.JUG_LEVEL) > 0)
level.playSound(player, pos, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F);
level.setBlockAndUpdate(pos, state.setValue(FLUID, pouredFluid).setValue(DRINK_LEVEL, blockDrinkLevel));
jugItem.removeFromJugLevelWithBlockStateData(stack, player, newDrinkLevel);
}
}
} else {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/net/doppelr/lemonmates/block/ModJugBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ public BlockState playerWillDestroy(Level level, BlockPos pos, BlockState state,
ItemStack itemStack = new ItemStack(this);
int jugLevel = state.getValue(JUG_LEVEL);
ApplicableFluidsToFluidContainer fluid = state.getValue(FLUID);
boolean canPour = state.getValue(CAN_POUR);

if (jugLevel > 0 || fluid != ApplicableFluidsToFluidContainer.NONE || canPour) {
if (jugLevel > 0 || fluid != ApplicableFluidsToFluidContainer.NONE) {
DataComponentMap.Builder map = DataComponentMap.builder();
map.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY
.with(AllBlockStateProperties.JUG_LEVEL, jugLevel)
.with(AllBlockStateProperties.APPLICABLE_FLUID_TO_CONTAINER, fluid)
.with(AllBlockStateProperties.CAN_POUR, canPour))
.with(AllBlockStateProperties.CAN_POUR, false))
.set(AllDataComponents.JUG_LEVEL, jugLevel)
.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, fluid)
.set(AllDataComponents.CAN_POUR, canPour);
.set(AllDataComponents.CAN_POUR, false);

itemStack.applyComponents(map.build());
}
Expand Down
31 changes: 16 additions & 15 deletions src/main/java/net/doppelr/lemonmates/datagen/ModRecipeProvider.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.doppelr.lemonmates.datagen;

import net.doppelr.lemonmates.AllDataComponents;
import net.doppelr.lemonmates.AllTags;
import net.doppelr.lemonmates.LemonMates;
import net.doppelr.lemonmates.block.ModBlocks;
Expand Down Expand Up @@ -136,13 +137,13 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.save(recipeOutput);

// Lemonade Jug/Glass
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.LEMONADE_JUG_TERRACOTTA.get())
.pattern("# #")
.pattern("# #")
.pattern(" # ")
.define('#', Tags.Items.BRICKS)
.unlockedBy("has_bricks", has(Tags.Items.BRICKS))
.save(recipeOutput);
// ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.LEMONADE_JUG_TERRACOTTA.get())
// .pattern("# #")
// .pattern("# #")
// .pattern(" # ")
// .define('#', Tags.Items.BRICKS)
// .unlockedBy("has_bricks", has(Tags.Items.BRICKS))
// .save(recipeOutput);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.LEMONADE_GLASS.get())
.pattern(" ")
Expand All @@ -153,14 +154,14 @@ protected void buildRecipes(RecipeOutput recipeOutput) {
.unlockedBy("has_glass", has(Tags.Items.GLASS_BLOCKS))
.save(recipeOutput);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.LEMONADE_JUG_GLASS.get())
.pattern("# #")
.pattern("# #")
.pattern(" B ")
.define('#', Tags.Items.GLASS_PANES)
.define('B', Tags.Items.GLASS_BLOCKS)
.unlockedBy("has_glass", has(Tags.Items.GLASS_BLOCKS))
.save(recipeOutput);
// ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.LEMONADE_JUG_GLASS.get())
// .pattern("# #")
// .pattern("# #")
// .pattern(" B ")
// .define('#', Tags.Items.GLASS_PANES)
// .define('B', Tags.Items.GLASS_BLOCKS)
// .unlockedBy("has_glass", has(Tags.Items.GLASS_BLOCKS))
// .save(recipeOutput);

// get Molds back
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.PREFORM.get(), 1)
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/doppelr/lemonmates/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public class ModItems {

/** Move registration to enum -> {@link UmbrellaVariants} **/

public static final DeferredItem<Item> LEMONADE_GLASS_DECORATED = ITEMS.register("lemonade_glass_decorated",
() -> new Item(new Item.Properties()));

public static final DeferredItem<Item> LEMONADE_JUG_TERRACOTTA = ITEMS.register("lemonade_jug_terracotta",
() -> new ModJugItem(ModBlocks.LEMONADE_JUG_TERRACOTTA.get(), new Item.Properties().stacksTo(1)));
public static final DeferredItem<Item> LEMONADE_JUG_GLASS = ITEMS.register("lemonade_jug_glass",
Expand Down
72 changes: 65 additions & 7 deletions src/main/java/net/doppelr/lemonmates/item/ModJugItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.doppelr.lemonmates.block.ModDrinkingGlassBlock;
import net.doppelr.lemonmates.block.properties.ApplicableFluidsToFluidContainer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
Expand All @@ -16,6 +18,7 @@
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.component.BlockItemStateProperties;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
Expand All @@ -25,7 +28,6 @@
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Locale;

public class ModJugItem extends BlockItem {
public ModJugItem(Block block, Properties properties) {
Expand All @@ -38,7 +40,11 @@ public void setPourAbility(ItemStack stack, boolean pour) {
}

public void setContainedFluid(ItemStack stack, ApplicableFluidsToFluidContainer fluid) {
stack.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, fluid);
if (stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) == ApplicableFluidsToFluidContainer.NONE
|| stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) == fluid)
stack.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, fluid);
else if (stack.get(AllDataComponents.JUG_LEVEL) != null && stack.get(AllDataComponents.JUG_LEVEL) == 0)
stack.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, fluid);
}

public void setJugLevel(ItemStack stack, int jugLevel) {
Expand All @@ -50,35 +56,82 @@ public void addToJugLevel(ItemStack stack, int increment) {
stack.set(AllDataComponents.JUG_LEVEL, stack.get(AllDataComponents.JUG_LEVEL) + increment);
}

public void addToJugLevelWithBlockStateData(ItemStack stack, int increment) {
if (stack.get(AllDataComponents.JUG_LEVEL) != null) {
int f = stack.get(AllDataComponents.JUG_LEVEL) + increment;
this.addToJugLevel(stack, increment);

if (stack.get(DataComponents.BLOCK_STATE) != null) {
DataComponentMap.Builder map = DataComponentMap.builder();

ApplicableFluidsToFluidContainer applicableFluid = stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) != null ? stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) : ApplicableFluidsToFluidContainer.NONE;

map.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY
.with(AllBlockStateProperties.JUG_LEVEL, f)
.with(AllBlockStateProperties.APPLICABLE_FLUID_TO_CONTAINER, applicableFluid))
.set(AllDataComponents.JUG_LEVEL, f)
.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, applicableFluid);

stack.applyComponents(map.build());
}
}
}

public void removeFromJugLevel(ItemStack stack, Player player, int decrement) {
if (!player.getAbilities().instabuild)
if (stack.get(AllDataComponents.JUG_LEVEL) != null) {
int f = stack.get(AllDataComponents.JUG_LEVEL) - decrement;
if (f >= 0 && f <= 8)
stack.set(AllDataComponents.JUG_LEVEL, stack.get(AllDataComponents.JUG_LEVEL) - decrement);
stack.set(AllDataComponents.JUG_LEVEL, f);
}
}

public void removeFromJugLevelWithBlockStateData(ItemStack stack, Player player, int decrement) {
if (!player.getAbilities().instabuild) {
if (stack.get(AllDataComponents.JUG_LEVEL) != null) {
int f = stack.get(AllDataComponents.JUG_LEVEL) - decrement;
this.removeFromJugLevel(stack, player, decrement);

if (stack.get(DataComponents.BLOCK_STATE) != null) {
DataComponentMap.Builder map = DataComponentMap.builder();

ApplicableFluidsToFluidContainer applicableFluid = stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) != null ? stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) : ApplicableFluidsToFluidContainer.NONE;

map.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY
.with(AllBlockStateProperties.JUG_LEVEL, f)
.with(AllBlockStateProperties.APPLICABLE_FLUID_TO_CONTAINER, applicableFluid))
.set(AllDataComponents.JUG_LEVEL, f)
.set(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER, applicableFluid);

if (f >= 0 && f <= 8)
stack.applyComponents(map.build());
}
}
}
}

public void jugLevelHandling(ItemStack stack, Player player, ApplicableFluidsToFluidContainer fluid) {
Level level = player.level();
if (stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) != fluid)
this.setContainedFluid(stack, fluid);

boolean checkFluid = stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) != null && (stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) == fluid || stack.get(AllDataComponents.APPLICABLE_FLUID_TO_CONTAINER) == ApplicableFluidsToFluidContainer.NONE);

if (stack.get(AllDataComponents.JUG_LEVEL) == null || stack.get(AllDataComponents.JUG_LEVEL) == 0) {
this.setJugLevel(stack, 4);
level.playSound(player, player.blockPosition(), SoundEvents.BOTTLE_FILL, SoundSource.PLAYERS, 1.0F, 1.0F);
if (!player.getAbilities().instabuild)
player.setItemInHand(InteractionHand.OFF_HAND, ModItems.BOTTLE_EMPTY.toStack());
} else if (stack.get(AllDataComponents.JUG_LEVEL) <= 4) {
this.addToJugLevel(stack, 4);
} else if (stack.get(AllDataComponents.JUG_LEVEL) <= 4 && checkFluid) {
this.addToJugLevelWithBlockStateData(stack, 4);
level.playSound(player, player.blockPosition(), SoundEvents.BOTTLE_FILL, SoundSource.PLAYERS, 1.0F, 1.0F);
if (!player.getAbilities().instabuild)
player.setItemInHand(InteractionHand.OFF_HAND, ModItems.BOTTLE_EMPTY.toStack());
} else if (stack.get(AllDataComponents.JUG_LEVEL) < 8) {
} else if (stack.get(AllDataComponents.JUG_LEVEL) < 8 && checkFluid) {
int incrementJugLevel = 4;
if (stack.get(AllDataComponents.JUG_LEVEL) > 4)
incrementJugLevel = 8 - stack.get(AllDataComponents.JUG_LEVEL);
this.addToJugLevel(stack, incrementJugLevel);
this.addToJugLevelWithBlockStateData(stack, incrementJugLevel);
level.playSound(player, player.blockPosition(), SoundEvents.BOTTLE_FILL, SoundSource.PLAYERS, 1.0F, 1.0F);
if (!player.getAbilities().instabuild)
player.setItemInHand(InteractionHand.OFF_HAND, ModItems.BOTTLE_EMPTY.toStack());
Expand All @@ -98,6 +151,11 @@ public void jugLevelHandling(ItemStack stack, Player player, ApplicableFluidsToF
.setValue(AllBlockStateProperties.CAN_POUR, canPour) : null;
}

@Override
protected boolean canPlace(BlockPlaceContext context, BlockState state) {
return super.canPlace(context, state) && !context.getItemInHand().get(AllDataComponents.CAN_POUR);
}

@Override
public InteractionResult useOn(UseOnContext context) {
ItemStack stack = context.getItemInHand();
Expand Down
Loading
Loading