Skip to content

Commit 0305394

Browse files
committed
Remove focus holder filling/emptying recipes, update notebook entry (close #52)
1 parent 8cfaba4 commit 0305394

File tree

20 files changed

+76
-339
lines changed

20 files changed

+76
-339
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
88

99
### Added
1010

11+
- Added (official) support for inserting iota-holding items other than foci into the Focal Frame.
1112
- Added a tag (`hexdebug:focus_holder/blacklist`) to prevent specific items from being inserted into the Focal Frame.
1213
- Added new methods to the `SplicingTableIotaRenderers` class to allow iota renderers to contain or reference other renderers.
1314
- New Splicing Table iota renderer types:
@@ -29,6 +30,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
2930

3031
- Fixed a few bugs allowing arbitrary items to be inserted into the Splicing Table and Focal Frame using hoppers or modded item transportation ([#38](https://github.com/object-Object/HexDebug/issues/38), [#53](https://github.com/object-Object/HexDebug/issues/38)).
3132

33+
### Removed
34+
35+
- Removed most recipes related to filling/emptying Focal Frames, other than the recipe to fill empty frames with new foci using stackable ingredients.
36+
3237
## `0.6.0+1.20.1` - 2025-09-29
3338

3439
### Added

Common/src/generated/resources/data/hexdebug/advancements/recipes/misc/focus_holder_filling_shaped/new_focus.json renamed to Common/src/generated/resources/data/hexdebug/advancements/recipes/misc/focus_holder_filling_shaped/focus.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"has_the_recipe": {
1717
"conditions": {
18-
"recipe": "hexdebug:focus_holder_filling_shaped/new_focus"
18+
"recipe": "hexdebug:focus_holder_filling_shaped/focus"
1919
},
2020
"trigger": "minecraft:recipe_unlocked"
2121
}
@@ -28,7 +28,7 @@
2828
],
2929
"rewards": {
3030
"recipes": [
31-
"hexdebug:focus_holder_filling_shaped/new_focus"
31+
"hexdebug:focus_holder_filling_shaped/focus"
3232
]
3333
},
3434
"sends_telemetry_event": false

Common/src/generated/resources/data/hexdebug/advancements/recipes/misc/focus_holder_filling_shaped/new_holder.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

Common/src/generated/resources/data/hexdebug/recipes/focus_holder_emptying.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

Common/src/generated/resources/data/hexdebug/recipes/focus_holder_filling_shaped/new_focus.json renamed to Common/src/generated/resources/data/hexdebug/recipes/focus_holder_filling_shaped/focus.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
"result": {
2727
"item": "hexdebug:focus_holder"
2828
},
29+
"result_inner": {
30+
"item": "hexcasting:focus"
31+
},
2932
"show_notification": true
3033
}

Common/src/generated/resources/data/hexdebug/recipes/focus_holder_filling_shaped/new_holder.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

Common/src/generated/resources/data/hexdebug/recipes/focus_holder_filling_shapeless.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

Common/src/main/kotlin/gay/object/hexdebug/datagen/recipes/FocusHolderFillingShapedRecipeBuilder.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package gay.`object`.hexdebug.datagen.recipes
33
import com.google.gson.JsonObject
44
import gay.`object`.hexdebug.registry.HexDebugBlocks
55
import gay.`object`.hexdebug.registry.HexDebugRecipeSerializers
6+
import net.minecraft.core.registries.BuiltInRegistries
67
import net.minecraft.data.recipes.FinishedRecipe
78
import net.minecraft.data.recipes.RecipeCategory
89
import net.minecraft.data.recipes.ShapedRecipeBuilder
@@ -13,24 +14,20 @@ import java.util.function.Consumer
1314
class FocusHolderFillingShapedRecipeBuilder(
1415
category: RecipeCategory,
1516
result: ItemLike,
16-
count: Int,
17+
private val resultInner: ItemLike,
18+
count: Int = 1,
1719
) : ShapedRecipeBuilder(category, result, count) {
1820
override fun save(finishedRecipeConsumer: Consumer<FinishedRecipe>, recipeId: ResourceLocation) {
1921
if (result !== HexDebugBlocks.FOCUS_HOLDER.item) {
2022
throw IllegalStateException("Expected result item to be ${HexDebugBlocks.FOCUS_HOLDER.id} but got $result")
2123
}
22-
super.save({ finishedRecipeConsumer.accept(Result(it)) }, recipeId)
24+
super.save({ finishedRecipeConsumer.accept(Result(it, resultInner)) }, recipeId)
2325
}
2426

25-
companion object {
26-
fun shaped(category: RecipeCategory, result: ItemLike): FocusHolderFillingShapedRecipeBuilder =
27-
shaped(category, result, 1)
28-
29-
fun shaped(category: RecipeCategory, result: ItemLike, count: Int): FocusHolderFillingShapedRecipeBuilder =
30-
FocusHolderFillingShapedRecipeBuilder(category, result, count)
31-
}
32-
33-
private class Result(private val inner: FinishedRecipe) : FinishedRecipe {
27+
private class Result(
28+
private val inner: FinishedRecipe,
29+
private val resultInner: ItemLike,
30+
) : FinishedRecipe {
3431
override fun getType() = HexDebugRecipeSerializers.FOCUS_HOLDER_FILLING_SHAPED.value
3532

3633
override fun getId(): ResourceLocation = inner.id
@@ -39,6 +36,9 @@ class FocusHolderFillingShapedRecipeBuilder(
3936

4037
override fun serializeRecipeData(json: JsonObject) {
4138
inner.serializeRecipeData(json)
39+
json.add("result_inner", JsonObject().also {
40+
it.addProperty("item", BuiltInRegistries.ITEM.getKey(resultInner.asItem()).toString())
41+
})
4242
}
4343

4444
override fun serializeAdvancement(): JsonObject? {

Common/src/main/kotlin/gay/object/hexdebug/interop/HexDebugEmiPlugin.kt

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,28 @@ package gay.`object`.hexdebug.interop
22

33
import at.petrak.hexcasting.common.lib.HexItems
44
import dev.emi.emi.api.EmiRegistry
5-
import dev.emi.emi.api.recipe.EmiCraftingRecipe
65
import dev.emi.emi.api.stack.Comparison
76
import dev.emi.emi.api.stack.EmiStack
87
import dev.emi.emi.api.widget.Bounds
98
import gay.`object`.hexdebug.gui.splicing.SplicingTableScreen
10-
import gay.`object`.hexdebug.items.FocusHolderBlockItem
11-
import gay.`object`.hexdebug.items.FocusHolderBlockItem.Companion.hasIotaStack
12-
import gay.`object`.hexdebug.recipes.FocusHolderEmptyingRecipe
13-
import gay.`object`.hexdebug.recipes.FocusHolderFillingShapelessRecipe
9+
import gay.`object`.hexdebug.items.FocusHolderBlockItem.Companion.getIotaStack
10+
import gay.`object`.hexdebug.items.FocusHolderBlockItem.Companion.setIotaStack
1411
import gay.`object`.hexdebug.registry.HexDebugBlocks
15-
import net.minecraft.resources.ResourceLocation
16-
import net.minecraft.world.item.crafting.RecipeType
12+
import net.minecraft.world.item.ItemStack
1713

1814
object HexDebugEmiPlugin {
1915
fun register(registry: EmiRegistry) {
2016
// if a recipe calls for an empty focus holder, disallow filled, and vice versa
2117
registry.setDefaultComparison(
2218
HexDebugBlocks.FOCUS_HOLDER.item,
23-
Comparison.compareData { it.itemStack.hasIotaStack },
19+
Comparison.compareData { it.itemStack.getIotaStack().first.item },
2420
)
2521

2622
// show filled focus holder in sidebar
27-
// necessary because otherwise there's no good way to see the recipe for a new holder with existing focus
28-
registry.addEmiStack(EmiStack.of(FocusHolderBlockItem.withFocus()))
29-
30-
// better recipes for focus holder filling/emptying
31-
for (recipe in registry.recipeManager.getAllRecipesFor(RecipeType.CRAFTING)) {
32-
val emiRecipe = when (recipe) {
33-
is FocusHolderEmptyingRecipe -> EmiCraftingRecipe(
34-
listOf(
35-
EmiStack.of(FocusHolderBlockItem.withFocus())
36-
.setRemainder(EmiStack.of(HexDebugBlocks.FOCUS_HOLDER.item)),
37-
),
38-
EmiStack.of(HexItems.FOCUS),
39-
synthetic(recipe.id),
40-
true,
41-
)
42-
43-
is FocusHolderFillingShapelessRecipe -> EmiCraftingRecipe(
44-
listOf(
45-
EmiStack.of(HexDebugBlocks.FOCUS_HOLDER.item),
46-
EmiStack.of(HexItems.FOCUS),
47-
),
48-
EmiStack.of(FocusHolderBlockItem.withFocus()),
49-
synthetic(recipe.id),
50-
true,
51-
)
52-
53-
else -> continue
54-
}
55-
registry.removeRecipes(recipe.id)
56-
registry.addRecipe(emiRecipe)
57-
}
23+
registry.addEmiStack(EmiStack.of(
24+
ItemStack(HexDebugBlocks.FOCUS_HOLDER)
25+
.setIotaStack(ItemStack(HexItems.FOCUS))
26+
))
5827

5928
// screen exclusions for splicing table
6029
registry.addExclusionArea(SplicingTableScreen::class.java) { screen, consumer ->
@@ -94,6 +63,4 @@ object HexDebugEmiPlugin {
9463
}
9564
}
9665
}
97-
98-
private fun synthetic(id: ResourceLocation) = id.withPrefix("/")
9966
}

Common/src/main/kotlin/gay/object/hexdebug/items/FocusHolderBlockItem.kt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import at.petrak.hexcasting.api.casting.iota.Iota
44
import at.petrak.hexcasting.api.item.IotaHolderItem
55
import at.petrak.hexcasting.api.utils.asTranslatedComponent
66
import at.petrak.hexcasting.api.utils.getList
7-
import at.petrak.hexcasting.common.lib.HexItems
87
import gay.`object`.hexdebug.HexDebug
98
import gay.`object`.hexdebug.blocks.focusholder.FocusHolderBlockEntity
109
import gay.`object`.hexdebug.items.base.ItemPredicateProvider
1110
import gay.`object`.hexdebug.items.base.ModelPredicateEntry
1211
import gay.`object`.hexdebug.registry.HexDebugBlockEntities
13-
import gay.`object`.hexdebug.registry.HexDebugBlocks
1412
import gay.`object`.hexdebug.utils.asItemPredicate
1513
import gay.`object`.hexdebug.utils.isNotEmpty
1614
import gay.`object`.hexdebug.utils.styledHoverName
@@ -124,13 +122,6 @@ class FocusHolderBlockItem(block: Block, properties: Properties) :
124122
companion object {
125123
val HAS_ITEM = HexDebug.id("has_item")
126124

127-
fun withFocus(stack: ItemStack? = null): ItemStack {
128-
val result = stack?.copy() ?: ItemStack(HexDebugBlocks.FOCUS_HOLDER.item)
129-
return result.apply {
130-
setIotaStack(ItemStack(HexItems.FOCUS))
131-
}
132-
}
133-
134125
val ItemStack.hasIotaStack get() = getBlockEntityData(this)
135126
?.getList("Items", Tag.TAG_COMPOUND)
136127
?.let { it.size > 0 }
@@ -146,7 +137,7 @@ class FocusHolderBlockItem(block: Block, properties: Properties) :
146137
return Pair(iotaStack, iotaStack.item as? IotaHolderItem)
147138
}
148139

149-
fun ItemStack.setIotaStack(iotaStack: ItemStack) {
140+
fun ItemStack.setIotaStack(iotaStack: ItemStack): ItemStack {
150141
val tag = if (iotaStack.isEmpty) {
151142
CompoundTag()
152143
} else {
@@ -155,6 +146,7 @@ class FocusHolderBlockItem(block: Block, properties: Properties) :
155146
}
156147

157148
setBlockEntityData(this, HexDebugBlockEntities.FOCUS_HOLDER.value, tag)
149+
return this
158150
}
159151
}
160152
}

0 commit comments

Comments
 (0)