Skip to content

Commit

Permalink
mülk
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Jan 30, 2025
1 parent 499fcd6 commit a36c3b6
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 87 deletions.
15 changes: 0 additions & 15 deletions src/main/java/de/dafuqs/spectrum/commands/SanityCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ private static int execute(ServerCommandSource source, String modId) {
&& !blockState.isIn(BlockTags.AXE_MINEABLE)
&& !blockState.isIn(BlockTags.SHOVEL_MINEABLE)
&& !blockState.isIn(BlockTags.HOE_MINEABLE)
&& !blockState.isIn(FabricMineableTags.SHEARS_MINEABLE)
&& !blockState.isIn(FabricMineableTags.SWORD_MINEABLE)
&& !blockState.isIn(BlockTags.SWORD_EFFICIENT)
&& !blockState.isIn(SpectrumBlockTags.EXEMPT_FROM_MINEABLE_DEBUG_CHECK)) {
SpectrumCommon.logWarning("[SANITY: Mineable Tags] Block " + registryKey.getValue() + " is not contained in a any vanilla mineable tag.");
Expand Down Expand Up @@ -340,19 +338,6 @@ private static int execute(ServerCommandSource source, String modId) {
}
}

// ExtendedEnchantables with enchantability <= 0 (unable to be enchanted) or not set to be enchantable
for (Map.Entry<RegistryKey<Item>, Item> item : Registries.ITEM.getEntrySet()) {
Item i = item.getValue();
if (i instanceof ExtendedEnchantable) {
if (!new ItemStack(i).isEnchantable()) {
SpectrumCommon.logWarning("[SANITY: Enchantability] Item '" + item.getKey().getValue() + "' is not set to be enchantable.");
}
if (i.getEnchantability() < 1) {
SpectrumCommon.logWarning("[SANITY: Enchantability] Item '" + item.getKey().getValue() + "' is ExtendedEnchantable, but has enchantability of < 1");
}
}
}

// Enchantments without recipe
Map<RegistryEntry<Enchantment>, DyeColor> craftingColors = new HashMap<>();
Map<RegistryEntry<Enchantment>, DyeColor> upgradeColors = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public record ConditionalFoodComponent(ItemPredicate itemPredicate, boolean cons
).apply(instance, ConditionalFoodComponent::new));

public static final PacketCodec<RegistryByteBuf, ConditionalFoodComponent> PACKET_CODEC = PacketCodec.tuple(
ItemPredicate.PACKET_CODEC, ConditionalFoodComponent::itemPredicate,
ItemPredicate.PACKET_CODEC, ConditionalFoodComponent::itemPredicate, // TODO: that feels like it cannot work somehow. Hmmmmm
PacketCodecs.BOOL, ConditionalFoodComponent::consumeAndApplyRequiredStack,
FoodComponent.PACKET_CODEC, ConditionalFoodComponent::bonusFoodComponent,
ConditionalFoodComponent::new
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/de/dafuqs/spectrum/components/WithMilkComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.dafuqs.spectrum.components;

import com.mojang.serialization.*;
import io.netty.buffer.*;
import net.minecraft.item.*;
import net.minecraft.item.tooltip.*;
import net.minecraft.network.codec.*;
import net.minecraft.text.*;

import java.util.function.*;

public record WithMilkComponent() implements TooltipAppender {

public static final Codec<WithMilkComponent> CODEC = Codec.unit(WithMilkComponent::new);
public static final PacketCodec<ByteBuf, WithMilkComponent> PACKET_CODEC = PacketCodec.unit(new WithMilkComponent());

@Override
public void appendTooltip(Item.TooltipContext context, Consumer<Text> tooltip, TooltipType type) {
tooltip.accept(Text.translatable("item.spectrum.restoration_tea.tooltip_milk"));
}

}
19 changes: 9 additions & 10 deletions src/main/java/de/dafuqs/spectrum/items/food/AzaleaTeaItem.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package de.dafuqs.spectrum.items.food;

import net.minecraft.component.type.FoodComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.item.*;
import net.minecraft.item.tooltip.*;
import net.minecraft.text.*;
import net.minecraft.util.*;

import java.util.List;
import java.util.*;

public class AzaleaTeaItem extends TeaItem {

public AzaleaTeaItem(Settings settings, FoodComponent bonusFoodComponentWithScone) {
super(settings, bonusFoodComponentWithScone);
public class AzaleaTeaItem extends DrinkItem {
public AzaleaTeaItem(Settings settings) {
super(settings);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import java.util.*;

public class RestorationTeaItem extends TeaItem {
public class RestorationTeaItem extends DrinkItem {

public RestorationTeaItem(Settings settings) {
super(settings);
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/de/dafuqs/spectrum/items/food/TeaItem.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public class SpectrumDataComponentTypes {
public static final ComponentType<Unit> UNIDENTIFIABLE = register("unidentifiable", builder -> builder.codec(Codec.unit(Unit.INSTANCE)).packetCodec(PacketCodec.unit(Unit.INSTANCE)));
public static final ComponentType<WorkstaffComponent> WORKSTAFF = register("workstaff", builder -> builder.codec(WorkstaffComponent.CODEC).packetCodec(WorkstaffComponent.PACKET_CODEC));
public static final ComponentType<WrappedPresentComponent> WRAPPED_PRESENT = register("wrapped_present", builder -> builder.codec(WrappedPresentComponent.CODEC).packetCodec(WrappedPresentComponent.PACKET_CODEC).cache());
public static final ComponentType<ConditionalFoodComponent> CONDITIONAL_FOOD_COMPONENT = register("conditional_food_component", builder -> builder.codec(ConditionalFoodComponent.CODEC).packetCodec(ConditionalFoodComponent.PACKET_CODEC).cache());
public static final ComponentType<ConditionalFoodComponent> CONDITIONAL_FOOD_COMPONENT = register("conditional_food_component", builder -> builder.codec(ConditionalFoodComponent.CODEC).packetCodec(ConditionalFoodComponent.PACKET_CODEC));
public static final ComponentType<WithMilkComponent> WITH_MILK = register("with_milk", builder -> builder.codec(WithMilkComponent.CODEC).packetCodec(WithMilkComponent.PACKET_CODEC));

public static <T> ComponentType<T> register(String id, UnaryOperator<ComponentType.Builder<T>> builderOperator) {
return DEFERRER.defer(builderOperator.apply(ComponentType.builder()).build(),
Expand Down
23 changes: 8 additions & 15 deletions src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,15 @@ public Map<RegistryKey<Enchantment>, Integer> getDefaultEnchantments() {
public static final Item FISSURE_PLUM = new AliasedTooltipItem(SpectrumBlocks.ABYSSAL_VINES, IS.of().food(SpectrumFoodComponents.FISSURE_PLUM), "item.spectrum.fissure_plum.tooltip");
public static final Item NIGHTDEW_SPROUT = new AliasedTooltipItem(SpectrumBlocks.NIGHTDEW, IS.of().food(SpectrumFoodComponents.NIGHTDEW_SPROUT), "item.spectrum.nightdew_sprout.tooltip");
public static final Item NECTARDEW_BURGEON = new NectardewBurgeonItem(IS.of().food(SpectrumFoodComponents.NECTARDEW_BURGEON), "item.spectrum.nectardew_burgeon.tooltip", SpectrumAdvancements.COLLECT_NECTARDEW, SpectrumItems.NIGHTDEW_SPROUT);
public static final Item RESTORATION_TEA = new RestorationTeaItem(IS.of(16).food(SpectrumFoodComponents.RESTORATION_TEA).recipeRemainder(Items.GLASS_BOTTLE)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.RESTORATION_TEA_SCONE_BONUS)));
public static final Item RESTORATION_TEA = new RestorationTeaItem(IS.of(16).food(SpectrumFoodComponents.RESTORATION_TEA).recipeRemainder(Items.GLASS_BOTTLE).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.RESTORATION_TEA_SCONE_BONUS)));
public static final Item KIMCHI = new KimchiItem(IS.of().food(SpectrumFoodComponents.KIMCHI));
public static final Item CLOTTED_CREAM = new ClottedCreamItem(IS.of().food(SpectrumFoodComponents.CLOTTED_CREAM), new String[]{"item.spectrum.clotted_cream.tooltip", "item.spectrum.clotted_cream.tooltip2"});
public static final Item FRESH_CHOCOLATE = new Item(IS.of().food(SpectrumFoodComponents.FRESH_CHOCOLATE));
public static final Item HOT_CHOCOLATE = new TeaItem(IS.of(16).food(SpectrumFoodComponents.HOT_CHOCOLATE)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.HOT_CHOCOLATE_SCONE_BONUS)));
public static final Item KARAK_CHAI = new TeaItem(IS.of(16).food(SpectrumFoodComponents.KARAK_CHAI)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.KARAK_CHAI_SCONE_BONUS)));
public static final Item AZALEA_TEA = new AzaleaTeaItem(IS.of(16).food(SpectrumFoodComponents.AZALEA_TEA), SpectrumFoodComponents.AZALEA_TEA_SCONE_BONUS);
public static final Item HOT_CHOCOLATE = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.HOT_CHOCOLATE).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.HOT_CHOCOLATE_SCONE_BONUS)));
public static final Item KARAK_CHAI = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.KARAK_CHAI).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.KARAK_CHAI_SCONE_BONUS)));
public static final Item AZALEA_TEA = new AzaleaTeaItem(IS.of(16).food(SpectrumFoodComponents.AZALEA_TEA).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.AZALEA_TEA_SCONE_BONUS)));
public static final Item BODACIOUS_BERRY_BAR = new Item(IS.of().food(SpectrumFoodComponents.BODACIOUS_BERRY_BAR));
public static final Item DEMON_TEA = new TeaItem(IS.of(16).food(SpectrumFoodComponents.DEMON_TEA)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.DEMON_TEA_SCONE_BONUS)));
public static final Item DEMON_TEA = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.DEMON_TEA).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.DEMON_TEA_SCONE_BONUS)));
public static final Item SCONE = new Item(IS.of().food(SpectrumFoodComponents.SCONE));

public static final Item CHEONG = new ItemWithTooltip(IS.of().food(SpectrumFoodComponents.CHEONG), "item.spectrum.cheong.tooltip");
Expand All @@ -340,8 +336,7 @@ public Map<RegistryKey<Enchantment>, Integer> getDefaultEnchantments() {
public static final Item HONEY_PASTRY = new Item(IS.of().food(SpectrumFoodComponents.HONEY_PASTRY));
public static final Item LUCKY_ROLL = new Item(IS.of(16).food(SpectrumFoodComponents.LUCKY_ROLL));
public static final Item TRIPLE_MEAT_POT_PIE = new Item(IS.of(8).food(SpectrumFoodComponents.TRIPLE_MEAT_POT_PIE));
public static final Item GLISTERING_JELLY_TEA = new TeaItem(IS.of(16).food(SpectrumFoodComponents.GLISTERING_JELLY_TEA).recipeRemainder(Items.GLASS_BOTTLE)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.GLISTERING_JELLY_TEA_SCONE_BONUS)));
public static final Item GLISTERING_JELLY_TEA = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.GLISTERING_JELLY_TEA).recipeRemainder(Items.GLASS_BOTTLE).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.GLISTERING_JELLY_TEA_SCONE_BONUS)));
public static final Item FREIGEIST = new FreigeistItem(IS.of(16).food(SpectrumFoodComponents.FREIGEIST).recipeRemainder(Items.GLASS_BOTTLE));
public static final Item DIVINATION_HEART = new Item(IS.of().food(SpectrumFoodComponents.DIVINATION_HEART));

Expand Down Expand Up @@ -398,8 +393,7 @@ public Map<RegistryKey<Enchantment>, Integer> getDefaultEnchantments() {
public static final Item FISHCAKE = new Item(IS.of().food(SpectrumFoodComponents.FISHCAKE));
public static final Item LIZARD_MEAT = new Item(IS.of().food(SpectrumFoodComponents.LIZARD_MEAT));
public static final Item COOKED_LIZARD_MEAT = new Item(IS.of().food(SpectrumFoodComponents.COOKED_LIZARD_MEAT));
public static final Item GOLDEN_BRISTLE_TEA = new TeaItem(IS.of(16).food(SpectrumFoodComponents.GOLDEN_BRISTLE_TEA)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.GOLDEN_BRISTLE_TEA_SCONE_BONUS)));
public static final Item GOLDEN_BRISTLE_TEA = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.GOLDEN_BRISTLE_TEA).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.GOLDEN_BRISTLE_TEA_SCONE_BONUS)));
public static final Item HARE_ROAST = new Item(IS.of().food(SpectrumFoodComponents.HARE_ROAST));
public static final Item JUNKET = new Item(IS.of().food(SpectrumFoodComponents.JUNKET));
public static final Item KOI = new Item(IS.of().food(SpectrumFoodComponents.KOI));
Expand All @@ -409,8 +403,7 @@ public Map<RegistryKey<Enchantment>, Integer> getDefaultEnchantments() {
public static final Item MORCHELLA = new BeverageItem(IS.of(16).food(SpectrumFoodComponents.BEVERAGE).component(DataComponentTypes.POTION_CONTENTS, PotionContentsComponent.DEFAULT));
public static final Item NECTERED_VIOGNIER = new JadeWineItem(IS.of(16).food(SpectrumFoodComponents.NECTERED_VIOGNIER));
public static final Item PEACHES_FLAMBE = new Item(IS.of().food(SpectrumFoodComponents.PEACHES_FLAMBE));
public static final Item PEACH_CREAM = new TeaItem(IS.of(16).food(SpectrumFoodComponents.PEACH_CREAM)
.component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.PEACH_CREAM_SCONE_BONUS)));
public static final Item PEACH_CREAM = new DrinkItem(IS.of(16).food(SpectrumFoodComponents.PEACH_CREAM).component(SpectrumDataComponentTypes.CONDITIONAL_FOOD_COMPONENT, teaSconeBonus(SpectrumFoodComponents.PEACH_CREAM_SCONE_BONUS)));
public static final Item PEACH_JAM = new Item(IS.of().food(SpectrumFoodComponents.PEACH_JAM));
public static final Item RABBIT_CREAM_PIE = new ItemWithTooltip(IS.of().food(SpectrumFoodComponents.RABBIT_CREAM_PIE), "item.spectrum.rabbit_cream_pie.tooltip");
public static final Item SEDATIVES = new SedativesItem(IS.of().food(SpectrumFoodComponents.SEDATIVES), "item.spectrum.sedatives.tooltip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
"spectrum:golden_bristle_tea"
],
"components": {
"spectrum:tea": {
"milk": true
}
"spectrum:milk": []
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ingredient3": "#c:milk",
"result": {
"id": "spectrum:azalea_tea",
"nbt": {
"Milk": true
}
"components": {
"spectrum:with_milk": {}
}
},
"required_advancement": "spectrum:unlocks/food/azalea_tea"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ingredient3": "#c:milk",
"result": {
"id": "spectrum:demon_tea",
"nbt": {
"Milk": true
}
"components": {
"spectrum:with_milk": {}
}
},
"required_advancement": "spectrum:unlocks/food/demon_tea"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ingredient3": "#c:milk",
"result": {
"id": "spectrum:glistering_jelly_tea",
"nbt": {
"Milk": true
},
"components": {
"spectrum:with_milk": {}
},
"count": 1
},
"required_advancement": "spectrum:unlocks/food/glistering_jelly_tea"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ingredient3": "#c:milk",
"result": {
"id": "spectrum:golden_bristle_tea",
"nbt": {
"Milk": true
},
"components": {
"spectrum:with_milk": {}
},
"count": 1
},
"required_advancement": "spectrum:hidden/collect_cookbooks/brewers_handbook"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ingredient3": "#c:milk",
"result": {
"id": "spectrum:restoration_tea",
"nbt": {
"Milk": true
},
"components": {
"spectrum:with_milk": {}
},
"count": 1
},
"required_advancement": "spectrum:unlocks/food/restoration_tea"
Expand Down

0 comments on commit a36c3b6

Please sign in to comment.