Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loot cyphers, scroll tweaks, and more #818

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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.20.1 2023-12-24T17:59:13.7584156 Item Models: hexcasting
// 1.20.1 2024-12-10T14:26:44.916295 Item Models: hexcasting
2fc68dcd6d73da3deaa6a33240dd9160a2b79592 assets/hexcasting/models/block/deco/quenched_allay_bricks_0.json
d59af7a48b20b210240b26115fb172d6202f9254 assets/hexcasting/models/block/deco/quenched_allay_bricks_1.json
a62eeebbca2d145c22f25725bd848ed4d673cefa assets/hexcasting/models/block/deco/quenched_allay_bricks_2.json
Expand All @@ -19,6 +19,22 @@ f2156b3a7041cf99891b528393db64c6b9ca1a4f assets/hexcasting/models/item/abacus.js
19730853397b109cfedd0c3bbda83d5de6cd15b9 assets/hexcasting/models/item/akashic_record.json
8c735feff09d46d00ed681311f46f61a50cfdc9b assets/hexcasting/models/item/amethyst_dust.json
fbb8706993fbc3246c56b9f3eb274ff8968b70f8 assets/hexcasting/models/item/amethyst_pillar.json
533a859174052a332de069b2ffeaf0106d132b9a assets/hexcasting/models/item/ancient_cypher.json
71a7968e43fbb872ee52315a3ee738d0b3fd1a69 assets/hexcasting/models/item/ancient_cypher_0_filled.json
0f0c627d7ed0e8a7e3666ca80ddc13b280d6ce9f assets/hexcasting/models/item/ancient_cypher_1.json
097b8ecfb34df710ca4b396d3a5df7722ecc3596 assets/hexcasting/models/item/ancient_cypher_1_filled.json
9fdde927e7e8b06221aef34a6a6b22d0b790f297 assets/hexcasting/models/item/ancient_cypher_2.json
93257ad393b751931539a5641d4430a4631e95f9 assets/hexcasting/models/item/ancient_cypher_2_filled.json
4af6234e24031ee0989282c8435fe07e85b02771 assets/hexcasting/models/item/ancient_cypher_3.json
41760f3c89d8dc94c515b0ab8220ecf996710a3c assets/hexcasting/models/item/ancient_cypher_3_filled.json
4df83ae775400ca2d480bfb3621abcf58d4d7352 assets/hexcasting/models/item/ancient_cypher_4.json
d21eb7093c0231015808a8b51b27857da1748431 assets/hexcasting/models/item/ancient_cypher_4_filled.json
e2b4e2ac4ad4fa4b490e1774a565a26fb840c474 assets/hexcasting/models/item/ancient_cypher_5.json
4555e5de80047ffa4e72a4a98eb51437a95e7291 assets/hexcasting/models/item/ancient_cypher_5_filled.json
420840b5761fcddbdd10186f3127bc7589badc46 assets/hexcasting/models/item/ancient_cypher_6.json
55c08581a2e8c7134d63b38226bddafff0fba3ae assets/hexcasting/models/item/ancient_cypher_6_filled.json
2731192f0c7a9a8d45ba4fcd8d1de60bade0b49e assets/hexcasting/models/item/ancient_cypher_7.json
7ba3015d79601f1c8238dbac4a45e525e3589f16 assets/hexcasting/models/item/ancient_cypher_7_filled.json
87e7ee44cdd0808a3dd72babfd1db716df2bcdfe assets/hexcasting/models/item/artifact.json
1cd1b4d002d1a9a044ceab7cca842e4a2b7bd2f4 assets/hexcasting/models/item/artifact_0_filled.json
4709e65d8e74cf45b3ba014bdf70373728cccc78 assets/hexcasting/models/item/artifact_1.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"parent": "minecraft:item/generated",
"overrides": [
{
"model": "hexcasting:item/ancient_cypher",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 0.0
}
},
{
"model": "hexcasting:item/ancient_cypher_0_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 0.0
}
},
{
"model": "hexcasting:item/ancient_cypher_1",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 1.0
}
},
{
"model": "hexcasting:item/ancient_cypher_1_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 1.0
}
},
{
"model": "hexcasting:item/ancient_cypher_2",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 2.0
}
},
{
"model": "hexcasting:item/ancient_cypher_2_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 2.0
}
},
{
"model": "hexcasting:item/ancient_cypher_3",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 3.0
}
},
{
"model": "hexcasting:item/ancient_cypher_3_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 3.0
}
},
{
"model": "hexcasting:item/ancient_cypher_4",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 4.0
}
},
{
"model": "hexcasting:item/ancient_cypher_4_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 4.0
}
},
{
"model": "hexcasting:item/ancient_cypher_5",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 5.0
}
},
{
"model": "hexcasting:item/ancient_cypher_5_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 5.0
}
},
{
"model": "hexcasting:item/ancient_cypher_6",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 6.0
}
},
{
"model": "hexcasting:item/ancient_cypher_6_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 6.0
}
},
{
"model": "hexcasting:item/ancient_cypher_7",
"predicate": {
"hexcasting:has_patterns": -0.01,
"hexcasting:variant": 7.0
}
},
{
"model": "hexcasting:item/ancient_cypher_7_filled",
"predicate": {
"hexcasting:has_patterns": 0.99,
"hexcasting:variant": 7.0
}
}
],
"textures": {
"layer0": "hexcasting:item/cad/0_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/0_ancient_cypher",
"layer1": "hexcasting:item/cad/0_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/1_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/1_ancient_cypher",
"layer1": "hexcasting:item/cad/1_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/2_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/2_ancient_cypher",
"layer1": "hexcasting:item/cad/2_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/3_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/3_ancient_cypher",
"layer1": "hexcasting:item/cad/3_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/4_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/4_ancient_cypher",
"layer1": "hexcasting:item/cad/4_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/5_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/5_ancient_cypher",
"layer1": "hexcasting:item/cad/5_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/6_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/6_ancient_cypher",
"layer1": "hexcasting:item/cad/6_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/7_ancient_cypher"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "hexcasting:item/cad/7_ancient_cypher",
"layer1": "hexcasting:item/cad/7_ancient_cypher_overlay"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import at.petrak.hexcasting.api.casting.SpellList;
import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
import at.petrak.hexcasting.api.mod.HexConfig;
import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
Expand Down Expand Up @@ -131,10 +132,13 @@ public Component display(Tag tag) {
out.append(IotaType.getDisplay(csub));

// only add a comma between 2 non-patterns (commas don't look good with Inline patterns)
// TODO: maybe add a config? maybe add a method on IotaType to allow it to opt out of commas
if (i < list.size() - 1 && (IotaType.getTypeFromTag(csub) != PatternIota.TYPE
|| IotaType.getTypeFromTag(HexUtils.downcast(list.get(i+1), CompoundTag.TYPE)) != PatternIota.TYPE)) {
out.append(", ");
// TODO: maybe add a method on IotaType to allow it to opt out of commas?
if (i < list.size() - 1) {
var thisIotaNeedsComma = IotaType.getTypeFromTag(csub) != PatternIota.TYPE;
var nextIotaNeedsComma = IotaType.getTypeFromTag(HexUtils.downcast(list.get(i+1), CompoundTag.TYPE)) != PatternIota.TYPE;
var alwaysShowCommas = HexConfig.client().alwaysShowListCommas();
if (thisIotaNeedsComma || nextIotaNeedsComma || alwaysShowCommas)
out.append(", ");
}
}
return Component.translatable("hexcasting.tooltip.list_contents", out).withStyle(ChatFormatting.DARK_PURPLE);
Expand Down
10 changes: 10 additions & 0 deletions Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.level.Level;
import net.minecraft.util.RandomSource;

import java.util.List;

Expand Down Expand Up @@ -49,11 +50,14 @@ public interface ClientConfigAccess {

boolean clickingTogglesDrawing();

boolean alwaysShowListCommas();

boolean DEFAULT_CTRL_TOGGLES_OFF_STROKE_ORDER = false;
boolean DEFAULT_INVERT_SPELLBOOK_SCROLL = false;
boolean DEFAULT_INVERT_ABACUS_SCROLL = false;
double DEFAULT_GRID_SNAP_THRESHOLD = 0.5;
boolean DEFAULT_CLICKING_TOGGLES_DRAWING = false;
boolean DEFAULT_ALWAYS_SHOW_LIST_COMMAS = false;
}

public interface ServerConfigAccess {
Expand All @@ -74,10 +78,16 @@ public interface ServerConfigAccess {

boolean trueNameHasAmbit();

double traderScrollChance();

List<String> getRandomLootHex(RandomSource rand);

int DEFAULT_MAX_OP_COUNT = 100_000;
int DEFAULT_MAX_SPELL_CIRCLE_LENGTH = 1024;
int DEFAULT_OP_BREAK_HARVEST_LEVEL = 3;

double DEFAULT_TRADER_SCROLL_CHANCE = 0.4;

boolean DEFAULT_VILLAGERS_DISLIKE_MIND_MURDER = true;

List<String> DEFAULT_DIM_TP_DENYLIST = List.of("twilightforest:twilight_forest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static void init() {
ItemSpellbook::isSealed);
registerVariantOverrides(HexItems.FOCUS, HexItems.FOCUS::getVariant);
registerVariantOverrides(HexItems.SPELLBOOK, HexItems.SPELLBOOK::getVariant);
registerVariantOverrides(HexItems.ANCIENT_CYPHER, HexItems.ANCIENT_CYPHER::getVariant);
registerVariantOverrides(HexItems.CYPHER, HexItems.CYPHER::getVariant);
registerVariantOverrides(HexItems.TRINKET, HexItems.TRINKET::getVariant);
registerVariantOverrides(HexItems.ARTIFACT, HexItems.ARTIFACT::getVariant);
Expand All @@ -75,6 +76,7 @@ public static void init() {
}
});

registerPackagedSpellOverrides(HexItems.ANCIENT_CYPHER);
registerPackagedSpellOverrides(HexItems.CYPHER);
registerPackagedSpellOverrides(HexItems.TRINKET);
registerPackagedSpellOverrides(HexItems.ARTIFACT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.entity.item.ItemEntity
import net.minecraft.world.item.ItemStack
import java.util.function.Predicate;

// TODO: How to handle in circles
class OpMakePackagedSpell<T : ItemPackagedHex>(val itemType: T, val cost: Long) : SpellAction {
class OpMakePackagedSpell<T : ItemPackagedHex>(val isValid: Predicate<ItemStack>, val expectedType: T, val cost: Long) : SpellAction {
override val argc = 2
override fun execute(
args: List<Iota>,
Expand All @@ -30,13 +31,13 @@ class OpMakePackagedSpell<T : ItemPackagedHex>(val itemType: T, val cost: Long)

val (handStack) = env.getHeldItemToOperateOn {
val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(it)
it.`is`(itemType) && hexHolder != null && !hexHolder.hasHex()
isValid.test(it) && hexHolder != null && !hexHolder.hasHex()
}
?: throw MishapBadOffhandItem(ItemStack.EMPTY.copy(), itemType.description) // TODO: hack
?: throw MishapBadOffhandItem(ItemStack.EMPTY.copy(), expectedType.description) // TODO: hack

val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack)
if (!handStack.`is`(itemType)) {
throw MishapBadOffhandItem(handStack, itemType.description)
if (!isValid.test(handStack)) {
throw MishapBadOffhandItem(handStack, expectedType.description)
} else if (hexHolder == null || hexHolder.hasHex()) {
throw MishapBadOffhandItem.of(handStack, "iota.write")
}
Expand Down
Loading
Loading