Skip to content

Commit

Permalink
Some more advancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Feb 3, 2025
1 parent 3a49f4e commit fae5af4
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class InkPoweredStatusEffectInstance {

public static final Codec<InkPoweredStatusEffectInstance> CODEC = RecordCodecBuilder.create(i -> i.group(
StatusEffectInstance.CODEC.fieldOf("status_effect").forGetter(c -> c.statusEffectInstance),
StatusEffectInstance.CODEC.fieldOf("effect").forGetter(c -> c.statusEffectInstance),
InkCost.CODEC.fieldOf("ink_cost").forGetter(c -> c.cost),
Codec.INT.optionalFieldOf("custom_color", -1).forGetter(c -> c.customColor),
Codec.BOOL.optionalFieldOf("unidentifiable", false).forGetter(c -> c.unidentifiable),
Expand All @@ -38,7 +38,7 @@ public class InkPoweredStatusEffectInstance {
);

public static final String NBT_KEY = "InkPoweredStatusEffects";

private final StatusEffectInstance statusEffectInstance;
private final InkCost cost;
private final int customColor; // -1: use effect default
Expand Down Expand Up @@ -79,7 +79,7 @@ public static void buildTooltip(List<Text> tooltip, List<InkPoweredStatusEffectI
tooltip.add(Text.translatable("item.spectrum.potion.tooltip.unidentifiable"));
continue;
}

StatusEffectInstance effect = entry.getStatusEffectInstance();
InkCost cost = entry.getInkCost();

Expand All @@ -98,7 +98,7 @@ public static void buildTooltip(List<Text> tooltip, List<InkPoweredStatusEffectI
tooltip.add(mutableText);

effect.getEffectType().value().forEachAttributeModifier(effect.getAmplifier(), (attribute, modifier) ->
attributeModifiers.add(new Pair<>(attribute, modifier))
attributeModifiers.add(new Pair<>(attribute, modifier))
);
}

Expand All @@ -109,7 +109,7 @@ public static void buildTooltip(List<Text> tooltip, List<InkPoweredStatusEffectI
for (var pair : attributeModifiers) {
var translatedAttribute = Text.translatable(pair.getLeft().value().getTranslationKey());
var mutableText = pair.getRight();

double statusEffect = mutableText.value();
double d;
if (mutableText.operation() != EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE && mutableText.operation() != EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) {
Expand Down Expand Up @@ -139,7 +139,7 @@ public int getColor() {
public boolean isUnidentifiable() {
return this.unidentifiable;
}

public boolean isIncurable() {
return this.incurable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

public record PairedFoodComponent(Item item, boolean consumeAndApplyRequiredStack, FoodComponent bonusFoodComponent) {

//TODO what is bonusFoodComponent used for?
public static final Codec<PairedFoodComponent> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Registries.ITEM.getCodec().fieldOf("item").forGetter(PairedFoodComponent::item),
Codec.BOOL.fieldOf("consume_and_apply_required_stack").forGetter(PairedFoodComponent::consumeAndApplyRequiredStack),
FoodComponent.CODEC.fieldOf("bonus_food_component").forGetter(PairedFoodComponent::bonusFoodComponent)
Codec.BOOL.optionalFieldOf("consume_and_apply_required_stack", true).forGetter(PairedFoodComponent::consumeAndApplyRequiredStack),
FoodComponent.CODEC.optionalFieldOf("bonus_food_component", new FoodComponent.Builder().build()).forGetter(PairedFoodComponent::bonusFoodComponent)
).apply(instance, PairedFoodComponent::new));

public static final PacketCodec<RegistryByteBuf, PairedFoodComponent> PACKET_CODEC = PacketCodec.tuple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.dafuqs.spectrum.*;
import de.dafuqs.spectrum.api.energy.*;
import de.dafuqs.spectrum.api.energy.color.*;
import de.dafuqs.spectrum.helpers.*;
import de.dafuqs.spectrum.registries.*;
import net.minecraft.advancement.criterion.*;
import net.minecraft.item.*;
Expand Down Expand Up @@ -39,7 +40,7 @@ public record Conditions(
public static final Codec<Conditions> CODEC = RecordCodecBuilder.create(instance -> instance.group(
LootContextPredicate.CODEC.optionalFieldOf("player").forGetter(Conditions::player),
ItemPredicate.CODEC.optionalFieldOf("item", ItemPredicate.Builder.create().build()).forGetter(Conditions::itemPredicate),
Codec.simpleMap(SpectrumRegistries.INK_COLORS.getCodec(), LongRange.CODEC, SpectrumRegistries.INK_COLORS).forGetter(Conditions::colorRanges),
CodecHelper.registryMap(SpectrumRegistries.INK_COLORS, LongRange.CODEC).forGetter(Conditions::colorRanges),
ColorPredicate.CODEC.optionalFieldOf("change_color", ColorPredicate.ANY).forGetter(Conditions::changeColorPredicate),
LongRange.CODEC.optionalFieldOf("change_range", LongRange.ANY).forGetter(Conditions::changeRange)
).apply(instance, Conditions::new));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public record Conditions(
ItemPredicate.CODEC.optionalFieldOf("rod").forGetter(Conditions::rod),
LootContextPredicate.CODEC.optionalFieldOf("bobber").forGetter(Conditions::bobber),
LootContextPredicate.CODEC.optionalFieldOf("fishing").forGetter(Conditions::hookedEntity),
LootContextPredicate.CODEC.optionalFieldOf("fished_entity").forGetter(Conditions::fishedEntity),
EntityPredicate.LOOT_CONTEXT_PREDICATE_CODEC.optionalFieldOf("fished_entity").forGetter(Conditions::fishedEntity),
ItemPredicate.CODEC.optionalFieldOf("item").forGetter(Conditions::caughtItem),
FluidPredicate.CODEC.optionalFieldOf("fluid").forGetter(Conditions::fluidPredicate)
).apply(instance, Conditions::new));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"drank_any_tea_with_scone": {
"trigger": "spectrum:consumed_paired_food",
"conditions": {
"paired_item": "spectrum:scone"
"paired_item": {
"item": "spectrum:scone"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"collected_using_crystal_apothecary": {
"trigger": "spectrum:collect_using_crystal_apothecary",
"conditions": {
"item": "#spectrum:gemstone_shards"
"item": {
"items": "#spectrum:gemstone_shards"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"dipped_something_into_liquid_crystal": {
"trigger": "spectrum:fluid_dipping",
"conditions": {
"fluid": "#spectrum:liquid_crystal"
"fluid": {
"fluids": "#spectrum:liquid_crystal"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"spectrum:golden_bristle_tea"
],
"components": {
"spectrum:milk": []
"spectrum:with_milk": {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"icon": {
"id": "spectrum:ink_flask",
"components": {
"spectrum:single_ink_energy_storage": {
"spectrum:ink_storage": {
"max_energy_total": 409600,
"color": "spectrum:purple",
"amount": 409600
"max_per_color": 409600,
"stored_energy": {
"spectrum:purple": 409600
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
"icon": {
"id": "spectrum:lesser_potion_pendant",
"components": {
"spectrum:ink_powered_potion_data": {
"color": 14981690,
"effects": [
"minecraft:potion_contents": {
"custom_color": 14981690,
"custom_effects": [
{
"ink_color": "spectrum:red",
"ink_cost": 4,
"effect": {
"id": "minecraft:absorption",
"amplifier": 0,
"duration": 3600
}
"id": "minecraft:absorption",
"amplifier": 0,
"duration": 3600
}
]
}
Expand All @@ -31,7 +27,9 @@
"filled_potion_pendant": {
"trigger": "spectrum:potion_workshop_brewing",
"conditions": {
"item": "#spectrum:potion_pendants",
"item": {
"items": "#spectrum:potion_pendants"
},
"effect_count": {
"min": 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"conditions": {
"fished_entity": {
"type": "minecraft:creeper",
"type_specific": {
"type": "spectrum:creeper",
"primed": true
}
"nbt": "{\"powered\":true}"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,41 @@
"fished_in_water": {
"trigger": "spectrum:fishing_rod_hooked",
"conditions": {
"fluid": "#minecraft:water"
"fluid": {
"fluids": "#minecraft:water"
}
}
},
"fished_in_lava": {
"trigger": "spectrum:fishing_rod_hooked",
"conditions": {
"fluid": "#minecraft:lava"
"fluid": {
"fluids": "#minecraft:lava"
}
}
},
"fished_in_goo": {
"trigger": "spectrum:fishing_rod_hooked",
"conditions": {
"fluid": "#spectrum:goo"
"fluid": {
"fluids": "#spectrum:goo"
}
}
},
"fished_in_liquid_crystal": {
"trigger": "spectrum:fishing_rod_hooked",
"conditions": {
"fluid": "#spectrum:liquid_crystal"
"fluid": {
"fluids": "#spectrum:liquid_crystal"
}
}
},
"fished_in_midnight_solution": {
"trigger": "spectrum:fishing_rod_hooked",
"conditions": {
"fluid": "#spectrum:midnight_solution"
"fluid": {
"fluids": "#spectrum:midnight_solution"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"icon": {
"id": "spectrum:paintbrush",
"components": {
"spectrum:ink_colored": {
"ink_color": "spectrum:red"
}
"spectrum:ink_color": "red"
}
},
"title": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"smelted_pure_resource_in_cinderhearth": {
"trigger": "spectrum:cinderhearth_smelting",
"conditions": {
"input": "#spectrum:pure_resources"
"input": {
"items": "#spectrum:pure_resources"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"trigger": "spectrum:upgrade_place",
"conditions": {
"count": 4,
"block": "#spectrum:pedestals"
"block": {
"blocks": "#spectrum:pedestals"
}
}
},
"gotten_previous": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
{
"condition": "minecraft:location_check",
"predicate": {
"block": "#spectrum:pedestals"
"block": {
"blocks": "#spectrum:pedestals"
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"conditions": {
"items": [
{
"items": "minecraft:rabbits_foot"
"item": {
"items": "minecraft:rabbits_foot"
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"trigger": "minecraft:item_durability_changed",
"conditions": {
"item": {
"items": [
"spectrum:oblivion_pickaxe"
],
"enchantments": [
{
"enchantment": "minecraft:efficiency"
}
]
"items": "spectrum:oblivion_pickaxe",
"predicates": {
"enchantments": [
{
"enchantments": "minecraft:efficiency"
}
]
}
}
}
},
Expand Down

0 comments on commit fae5af4

Please sign in to comment.