diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java index d3eb9455bf..b0dd49eab3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/ListIota.java @@ -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; @@ -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); diff --git a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java index b6e6d952bc..769d51693d 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/mod/HexConfig.java @@ -49,11 +49,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 { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java index 5d38b52bda..cb4cee9211 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/loot/HexLootHandler.java @@ -45,6 +45,8 @@ public class HexLootHandler { // if you manage to find one of these things you deserve a lot of scrolls new ScrollInjection(new ResourceLocation("minecraft", "chests/woodland_mansion"), 5), new ScrollInjection(new ResourceLocation("minecraft", "chests/stronghold_library"), 5) + + // you can use the table hexcasting:random_scroll to get exactly 1 scroll and nothing else ); public static final ImmutableList DEFAULT_LORE_INJECTS = ImmutableList.of( @@ -69,6 +71,7 @@ public class HexLootHandler { new ResourceLocation("minecraft", "chests/desert_pyramid"), new ResourceLocation("minecraft", "chests/ancient_city"), new ResourceLocation("minecraft", "chests/nether_bridge") + // you can use the table hexcasting:random_cypher to get exactly 1 cypher and nothing else ); public static int getScrollCount(int range, RandomSource random) { diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index af284b7a69..d2ba5ce14b 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -350,6 +350,10 @@ "": "Clicking Toggles Drawing", "@Tooltip": "Whether you click to start and stop drawing instead of clicking and dragging to draw", }, + alwaysShowListCommas: { + "": "Always Show List Commas", + "@Tooltip": "Whether all iota types should be comma-separated when displayed in lists (by default, pattern iotas do not use commas)", + }, }, server: { @@ -1968,7 +1972,7 @@ conjure_light: "Conjure a magical light that softly glows with my pigment at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", bonemeal: "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", edify: "Forcibly infuse _media into the sapling at the target position, causing it to grow into an $(l:items/edified)$(thing)Edified Tree/$. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", - ignite: "Start a fire on top of the given location, as if a $(item)Fire Charge/$ was applied, or sets fire to a creature. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", + ignite: "Start a fire on top of the given location, as if a $(item)Fire Charge/$ was applied, or set fire to an entity. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", extinguish: "Extinguish blocks in a large area. Costs about six $(l:items/amethyst)$(item)Amethyst Dust/$.", }, @@ -2018,7 +2022,7 @@ "range.2": "The second argument is a horizontal radius, in meters, in which the spell is stable. Moving outside of that radius will end the spell, dropping me out of the sky. As long as I stay inside the safe zone, however, the spell lasts indefinitely. An additional shimmer of _media marks the origin point of the safe zone. $(br2)Costs about 1 $(l:items/amethyst)$(item)Amethyst Dust/$ per meter of safety.", "time.1": "A flight limited in its duration.", - "time.2": "The second argument is an amount of time in seconds for which the spell is stable. After that time, the spell ends and I am dropped from the sky. $(br2)It is relatively expensive at about 1 $(l:items/amethyst)$(item)Charged Crystal/$ per second of flight; I believe it is best suited for travel.", + "time.2": "The second argument is an amount of time in seconds for which the spell is stable. After that time, the spell ends and I am dropped from the sky. $(br2)It is relatively expensive at about 1 $(l:items/amethyst)$(item)Amethyst Shard/$ per second of flight; I believe it is best suited for travel.", // Putting this in this category instead of elsewhere -- see sentinel chapter also containing some reflections/nonspells "can_fly.1": "Returns whether the given player is under the effects of $(l:patterns/spells/flight#hexcasting:flight/range)Anchorite's/$ or $(l:patterns/spells/flight#hexcasting:flight/time)Wayfarer's Flight/$.", diff --git a/Common/src/main/resources/data/hexcasting/loot_tables/random_cypher.json b/Common/src/main/resources/data/hexcasting/loot_tables/random_cypher.json new file mode 100644 index 0000000000..ea2aebc786 --- /dev/null +++ b/Common/src/main/resources/data/hexcasting/loot_tables/random_cypher.json @@ -0,0 +1,3 @@ +{ + "pools": [] +} \ No newline at end of file diff --git a/Common/src/main/resources/data/hexcasting/loot_tables/random_scroll.json b/Common/src/main/resources/data/hexcasting/loot_tables/random_scroll.json new file mode 100644 index 0000000000..ea2aebc786 --- /dev/null +++ b/Common/src/main/resources/data/hexcasting/loot_tables/random_scroll.json @@ -0,0 +1,3 @@ +{ + "pools": [] +} \ No newline at end of file diff --git a/Fabric/src/generated/resources/.cache/19f2b40f78e342d65a8cb499a41e3fcb2eadaca3 b/Fabric/src/generated/resources/.cache/19f2b40f78e342d65a8cb499a41e3fcb2eadaca3 index a2a95b576a..ceae82807f 100644 --- a/Fabric/src/generated/resources/.cache/19f2b40f78e342d65a8cb499a41e3fcb2eadaca3 +++ b/Fabric/src/generated/resources/.cache/19f2b40f78e342d65a8cb499a41e3fcb2eadaca3 @@ -1,4 +1,4 @@ -// 1.20.1 2025-01-23T15:50:44.3944222 Hex Casting/Loot Tables +// 1.20.1 2025-02-03T18:26:54.5093046 Hex Casting/Loot Tables 4efd95d408d050c36ff21b18f3c37116491fef92 data\hexcasting\loot_tables\blocks\directrix\redstone.json c81a5cb81141ab1fe09dd5dd3a0968b69dfffbd7 data\hexcasting\loot_tables\blocks\stripped_edified_log.json a62ffbcec2aa40172e05cd9fcd8e70e295d008e9 data\hexcasting\loot_tables\blocks\edified_fence_gate.json diff --git a/Fabric/src/generated/resources/.cache/2ba8da2cf2d44ff18dc72cc891b094eca6836a5c b/Fabric/src/generated/resources/.cache/2ba8da2cf2d44ff18dc72cc891b094eca6836a5c index 0e1d57cba2..db861524a2 100644 --- a/Fabric/src/generated/resources/.cache/2ba8da2cf2d44ff18dc72cc891b094eca6836a5c +++ b/Fabric/src/generated/resources/.cache/2ba8da2cf2d44ff18dc72cc891b094eca6836a5c @@ -1,4 +1,4 @@ -// 1.20.1 2025-01-23T15:50:44.4049409 Hex Casting/Tags for minecraft:item +// 1.20.1 2025-02-03T18:26:54.5110333 Hex Casting/Tags for minecraft:item e5df19a1dc6eadf14cd9b0f0fe45a74330b745e9 data\minecraft\tags\items\planks.json c562b4be24d0b6b13f3c65599d3bfa3bf2c4ce21 data\minecraft\tags\items\logs.json 20183cd61968ff6548df2dde1100b6378d68d64b data\minecraft\tags\items\wooden_buttons.json diff --git a/Fabric/src/generated/resources/.cache/3cb4ab563deee432e7d307024048f57946bafb1c b/Fabric/src/generated/resources/.cache/3cb4ab563deee432e7d307024048f57946bafb1c index c7442d4c4d..18725871e7 100644 --- a/Fabric/src/generated/resources/.cache/3cb4ab563deee432e7d307024048f57946bafb1c +++ b/Fabric/src/generated/resources/.cache/3cb4ab563deee432e7d307024048f57946bafb1c @@ -1,4 +1,4 @@ -// 1.20.1 2025-01-23T15:50:44.4152906 Hex Casting/Tags for hexcasting:action +// 1.20.1 2025-02-03T18:26:54.5270686 Hex Casting/Tags for hexcasting:action 6fe30f41e2bcd48589caab26d210a513dce1ab7c data\hexcasting\tags\action\per_world_pattern.json 6fe30f41e2bcd48589caab26d210a513dce1ab7c data\hexcasting\tags\action\can_start_enlighten.json 6fe30f41e2bcd48589caab26d210a513dce1ab7c data\hexcasting\tags\action\requires_enlightenment.json diff --git a/Fabric/src/generated/resources/.cache/812fdb58b7018b2d5c5af7da57a2b1857fa66794 b/Fabric/src/generated/resources/.cache/812fdb58b7018b2d5c5af7da57a2b1857fa66794 index 657625c00a..f94b01b7af 100644 --- a/Fabric/src/generated/resources/.cache/812fdb58b7018b2d5c5af7da57a2b1857fa66794 +++ b/Fabric/src/generated/resources/.cache/812fdb58b7018b2d5c5af7da57a2b1857fa66794 @@ -1,4 +1,4 @@ -// 1.20.1 2025-01-23T15:50:44.400399 Hex Casting/Tags for minecraft:block +// 1.20.1 2025-02-03T18:26:54.5110333 Hex Casting/Tags for minecraft:block e8d5ef7eabb567228b279b2419e4f042082d7491 data\minecraft\tags\blocks\fences.json 7e1e353cb7f561f086898f991ece48e047991934 data\minecraft\tags\blocks\fence_gates.json fdb48f194d7937ab6b423fa4b90a4d438bf6dd90 data\minecraft\tags\blocks\doors.json diff --git a/Fabric/src/generated/resources/.cache/c70ef2fe5da52437c1f53bcc9ea0e416f16bcc0b b/Fabric/src/generated/resources/.cache/c70ef2fe5da52437c1f53bcc9ea0e416f16bcc0b index c845076e2a..19e34aed28 100644 --- a/Fabric/src/generated/resources/.cache/c70ef2fe5da52437c1f53bcc9ea0e416f16bcc0b +++ b/Fabric/src/generated/resources/.cache/c70ef2fe5da52437c1f53bcc9ea0e416f16bcc0b @@ -1,4 +1,4 @@ -// 1.20.1 2025-01-23T15:50:44.4089311 Hex Casting/Recipes +// 1.20.1 2025-02-03T18:26:54.5110333 Hex Casting/Recipes 1d1e73244fb3da633d8a5f84bad93c6022a94368 data\hexcasting\advancements\recipes\misc\pride_colorizer_demiboy.json 49e706193bb57a957091e419bd0d8aa58135da1f data\hexcasting\recipes\dye_colorizer_green.json 071e5875b13b60aac33bc97e408d2ca710ac5d02 data\hexcasting\advancements\recipes\building_blocks\stonecutting\amethyst_tiles.json @@ -105,8 +105,8 @@ bc729ac7cf84d29a99cd34d50c152c0b9d20bd7a data\hexcasting\advancements\recipes\br d7de5d626fd799a2522af36f0c62c52fe490e6d2 data\hexcasting\recipes\edified_door.json c3f7b03fe184ed5e54a8ae06d130adf507b7683d data\hexcasting\recipes\staff\bamboo.json 6f2634e5588aede8e29157ecc859652d8a9f4065 data\hexcasting\advancements\recipes\misc\dye_colorizer_orange.json -b10d590e918e35b16578a8b739a1c4e7e2202e16 data\hexcasting\advancements\recipes\misc\dye_colorizer_cyan.json 0e792d49c81d2164e827d1bdedaa0fa358dfc437 data\hexcasting\advancements\recipes\misc\pride_colorizer_aromantic.json +b10d590e918e35b16578a8b739a1c4e7e2202e16 data\hexcasting\advancements\recipes\misc\dye_colorizer_cyan.json afb422ad4a918ee0161bf077f09475bb1da2b4eb data\hexcasting\recipes\amethyst_dust_unpacking.json 98c0843e6a83b91820f1c720e206295eec20ff95 data\hexcasting\recipes\ancient_scroll_paper.json 011f8daf15148d4b77686c6d382d8f5c288a333d data\hexcasting\advancements\recipes\building_blocks\ancient_scroll_paper.json diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java index c4d365cb17..7ffab20ebc 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/FabricHexConfig.java @@ -136,6 +136,8 @@ public static final class Client implements HexConfig.ClientConfigAccess, Config private double gridSnapThreshold = DEFAULT_GRID_SNAP_THRESHOLD; @ConfigEntry.Gui.Tooltip private boolean clickingTogglesDrawing = DEFAULT_CLICKING_TOGGLES_DRAWING; + @ConfigEntry.Gui.Tooltip + private boolean alwaysShowListCommas = DEFAULT_ALWAYS_SHOW_LIST_COMMAS; @Override public void validatePostLoad() throws ValidationException { @@ -166,6 +168,11 @@ public double gridSnapThreshold() { public boolean clickingTogglesDrawing() { return clickingTogglesDrawing; } + + @Override + public boolean alwaysShowListCommas() { + return alwaysShowListCommas; + } } @Config(name = "server") diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java index 75b4410e43..2cc402058f 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/loot/FabricHexLootModJankery.java @@ -22,10 +22,18 @@ public class FabricHexLootModJankery { public static final ResourceLocation FUNC_AMETHYST_SHARD_REDUCER = modLoc("amethyst_shard_reducer"); + public static final ResourceLocation RANDOM_SCROLL_TABLE = modLoc("random_scroll"); + public static final ResourceLocation RANDOM_CYPHER_TABLE = modLoc("random_cypher"); public static void lootLoad(ResourceLocation id, Consumer addPool) { if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) { addPool.accept(makeAmethystInjectPool()); + } else if (id.equals(RANDOM_SCROLL_TABLE)) { + // -1 weight = guaranteed spawn + addPool.accept(makeScrollAddPool(-1)); + } else if (id.equals(RANDOM_CYPHER_TABLE)) { + // 1 chance = guaranteed spawn + addPool.accept(makeCypherAddPool(1)); } int countRange = FabricHexInitializer.CONFIG.server.scrollRangeForLootTable(id); @@ -50,7 +58,7 @@ private static LootPool.Builder makeAmethystInjectPool() { private static LootPool.Builder makeScrollAddPool(int range) { return LootPool.lootPool() - .setRolls(UniformGenerator.between(-range, range)) + .setRolls(range < 0 ? ConstantValue.exactly(1) : UniformGenerator.between(-range, range)) .add(LootItem.lootTableItem(HexItems.SCROLL_LARGE)) .apply(() -> new AddPerWorldPatternToScrollFunc(new LootItemCondition[0])); } diff --git a/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac index af96c4a883..7e9cc6b47f 100644 --- a/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac +++ b/Forge/src/generated/resources/.cache/d4b3e6634c30118e1127c02b727ea285752e5aac @@ -1,6 +1,7 @@ -// 1.20.1 2025-01-23T15:52:03.6220728 Global Loot Modifiers : hexcasting -ff299d5fca3672c5ca0684cf9db095de2bae279f data/forge/loot_modifiers/global_loot_modifiers.json +// 1.20.1 2024-12-11T19:01:35.255688 Global Loot Modifiers : hexcasting +aea957ba78a93cace2c9959df83ed396b66d732f data/forge/loot_modifiers/global_loot_modifiers.json 28ca895a27221312c2451f26646111a68aadbf6c data/hexcasting/loot_modifiers/amethyst_cluster.json +5dd05e6f8f0e406b529bc209b393410553584fdf data/hexcasting/loot_modifiers/cypher/hexcasting/random_cypher.json 009da1f70c3aaaa4f8474eb08217821638d8c02c data/hexcasting/loot_modifiers/cypher/minecraft/chests/abandoned_mineshaft.json 27481d7099d4914cd97e4ed7da8fd69327bb376a data/hexcasting/loot_modifiers/cypher/minecraft/chests/ancient_city.json 9cc4deb22f8d70d600587a48f2a1243a8040cb94 data/hexcasting/loot_modifiers/cypher/minecraft/chests/desert_pyramid.json @@ -18,6 +19,7 @@ d1b282c57a8f5d1a37f3b87fbdba408b2a1b1415 data/hexcasting/loot_modifiers/lore/min e52b9cba9d685a2ca7ea7db629c7c0990f12be26 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_snowy_house.json a59a9c55b02b76c0e3f6a2ee4fa7bcf3ab538595 data/hexcasting/loot_modifiers/lore/minecraft/chests/village/village_taiga_house.json 348688be7af2a3ea62c605428c958e62e449252d data/hexcasting/loot_modifiers/lore/minecraft/chests/woodland_mansion.json +479260c4206a3f664f5077a7c43e3ac93e3fdc87 data/hexcasting/loot_modifiers/scroll/hexcasting/random_scroll.json a89a9e3113b83c6eb978f101aad42a6b37e7c1d8 data/hexcasting/loot_modifiers/scroll/minecraft/chests/abandoned_mineshaft.json bfac0ff9e84cd974ccfb47edc9dce78476470103 data/hexcasting/loot_modifiers/scroll/minecraft/chests/ancient_city.json 0fcb299789a1b0162ab81a025a06b1aab5eb504b data/hexcasting/loot_modifiers/scroll/minecraft/chests/bastion_other.json diff --git a/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json index 46e71c9b97..5c64c0663d 100644 --- a/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json +++ b/Forge/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json @@ -15,10 +15,12 @@ "hexcasting:lore/minecraft/chests/stronghold_library", "hexcasting:scroll/minecraft/chests/bastion_other", "hexcasting:lore/minecraft/chests/woodland_mansion", + "hexcasting:scroll/hexcasting/random_scroll", "hexcasting:lore/minecraft/chests/village/village_desert_house", "hexcasting:scroll/minecraft/chests/end_city_treasure", "hexcasting:scroll/minecraft/chests/jungle_temple", "hexcasting:scroll/minecraft/chests/bastion_treasure", + "hexcasting:cypher/hexcasting/random_cypher", "hexcasting:lore/minecraft/chests/village/village_savanna_house", "hexcasting:scroll/minecraft/chests/pillager_outpost", "hexcasting:scroll/minecraft/chests/desert_pyramid", diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/cypher/hexcasting/random_cypher.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/cypher/hexcasting/random_cypher.json new file mode 100644 index 0000000000..e5586b3adb --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/cypher/hexcasting/random_cypher.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_cyphers", + "chance": 1.0, + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "hexcasting:random_cypher" + } + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/hexcasting/random_scroll.json b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/hexcasting/random_scroll.json new file mode 100644 index 0000000000..742f92dfd9 --- /dev/null +++ b/Forge/src/generated/resources/data/hexcasting/loot_modifiers/scroll/hexcasting/random_scroll.json @@ -0,0 +1,10 @@ +{ + "type": "hexcasting:inject_scrolls", + "conditions": [ + { + "condition": "forge:loot_table_id", + "loot_table_id": "hexcasting:random_scroll" + } + ], + "countRange": -1 +} \ No newline at end of file diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java index bacdece12a..b6ec37b8fb 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/ForgeHexConfig.java @@ -84,6 +84,7 @@ public static class Client implements HexConfig.ClientConfigAccess { private static ForgeConfigSpec.BooleanValue invertAbacusScrollDirection; private static ForgeConfigSpec.DoubleValue gridSnapThreshold; private static ForgeConfigSpec.BooleanValue clickingTogglesDrawing; + private static ForgeConfigSpec.BooleanValue alwaysShowListCommas; public Client(ForgeConfigSpec.Builder builder) { ctrlTogglesOffStrokeOrder = builder.comment( @@ -103,6 +104,9 @@ public Client(ForgeConfigSpec.Builder builder) { clickingTogglesDrawing = builder.comment( "Whether you click to start and stop drawing instead of clicking and dragging") .define("clickingTogglesDrawing", DEFAULT_CLICKING_TOGGLES_DRAWING); + alwaysShowListCommas = builder.comment( + "Whether all iota types should be comma-separated in lists (by default, pattern iotas don't use commas)") + .define("alwaysShowListCommas", DEFAULT_ALWAYS_SHOW_LIST_COMMAS); } @Override @@ -129,6 +133,11 @@ public double gridSnapThreshold() { public boolean clickingTogglesDrawing() { return clickingTogglesDrawing.get(); } + + @Override + public boolean alwaysShowListCommas() { + return alwaysShowListCommas.get(); + } } public static class Server implements HexConfig.ServerConfigAccess { @@ -141,10 +150,7 @@ public static class Server implements HexConfig.ServerConfigAccess { private static ForgeConfigSpec.ConfigValue> tpDimDenyList; private static ForgeConfigSpec.BooleanValue doesTrueNameHaveAmbit; private static ForgeConfigSpec.DoubleValue traderScrollChance; - - private static ForgeConfigSpec.ConfigValue> fewScrollTables; - private static ForgeConfigSpec.ConfigValue> someScrollTables; - private static ForgeConfigSpec.ConfigValue> manyScrollTables; + // scroll/lore/cypher pools and chances should go here public Server(ForgeConfigSpec.Builder builder) { @@ -172,6 +178,10 @@ public Server(ForgeConfigSpec.Builder builder) { traderScrollChance = builder.comment("The chance for wandering traders to sell an Ancient Scroll") .defineInRange("traderScrollChance", DEFAULT_TRADER_SCROLL_CHANCE, 0.0, 1.0); + // builders for scroll/lore/cypher pools and chances should go here + + builder.pop(); + actionDenyList = builder.comment( "Resource locations of disallowed actions. Trying to cast one of these will result in a mishap.") .defineList("actionDenyList", List.of(), Server::isValidReslocArg); @@ -184,7 +194,7 @@ public Server(ForgeConfigSpec.Builder builder) { .defineList("tpDimDenyList", DEFAULT_DIM_TP_DENYLIST, Server::isValidReslocArg); doesTrueNameHaveAmbit = builder.comment( - "when false makes player reference iotas behave as normal entity reference iotas") + "When false, makes player reference iotas behave as normal entity reference iotas") .define("doesTrueNameHaveAmbit", DEFAULT_TRUE_NAME_HAS_AMBIT); } diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java index 26840ca6b6..521996ab29 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/ForgeHexLootModGen.java @@ -13,7 +13,12 @@ import net.minecraftforge.common.data.GlobalLootModifierProvider; import net.minecraftforge.common.loot.LootTableIdCondition; +import static at.petrak.hexcasting.api.HexAPI.modLoc; + public class ForgeHexLootModGen extends GlobalLootModifierProvider { + public static final ResourceLocation RANDOM_SCROLL_TABLE = modLoc("random_scroll"); + public static final ResourceLocation RANDOM_CYPHER_TABLE = modLoc("random_cypher"); + public ForgeHexLootModGen(PackOutput output) { super(output, HexAPI.MOD_ID); } @@ -41,6 +46,14 @@ protected void start() { }, HexLootHandler.DEFAULT_CYPHER_CHANCE)); } + add("scroll/hexcasting/random_scroll", new ForgeHexScrollLootMod(new LootItemCondition[]{ + LootTableIdCondition.builder(RANDOM_SCROLL_TABLE).build() + }, -1)); // -1 weight = guaranteed spawn + + add("cypher/hexcasting/random_cypher", new ForgeHexCypherLootMod(new LootItemCondition[]{ + LootTableIdCondition.builder(RANDOM_CYPHER_TABLE).build() + }, 1)); // 1 chance = guaranteed spawn + add("amethyst_cluster", new ForgeHexAmethystLootMod(new LootItemCondition[]{ LootTableIdCondition.builder(Blocks.AMETHYST_CLUSTER.getLootTable()).build() }, HexLootHandler.DEFAULT_SHARD_MODIFICATION)); diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java index fe1a2dda87..114a19b2b5 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/loot/ForgeHexScrollLootMod.java @@ -35,7 +35,7 @@ public ForgeHexScrollLootMod(LootItemCondition[] conditionsIn, int countRange) { @Override protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - int count = HexLootHandler.getScrollCount(this.countRange, context.getRandom()); + var count = this.countRange < 0 ? 1 : HexLootHandler.getScrollCount(this.countRange, context.getRandom()); for (int i = 0; i < count; i++) { var newStack = new ItemStack(HexItems.SCROLL_LARGE); AddPerWorldPatternToScrollFunc.doStatic(newStack, context.getRandom(), context.getLevel().getServer().overworld());