Skip to content

Commit b0daf39

Browse files
Fix broken lang on casting items with certain addons (#919)
2 parents 7c5fffa + a7556ea commit b0daf39

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpMakePackagedSpell.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ import net.minecraft.world.entity.item.ItemEntity
1919
import net.minecraft.world.item.ItemStack
2020
import net.minecraft.network.chat.Component
2121
import java.util.function.Predicate;
22+
import java.util.function.Supplier;
2223

2324
// TODO: How to handle in circles
24-
class OpMakePackagedSpell(val isValid: Predicate<ItemStack>, val expectedTypeDesc: Component, val cost: Long) : SpellAction {
25-
constructor(itemType: ItemPackagedHex, cost: Long) : this({s -> s.`is`(itemType)}, itemType.description, cost) {}
25+
class OpMakePackagedSpell(val isValid: Predicate<ItemStack>, val expectedTypeDesc: Supplier<Component>, val cost: Long) : SpellAction {
26+
constructor(itemType: ItemPackagedHex, cost: Long) : this({s -> s.`is`(itemType)}, itemType::getDescription, cost) {}
2627

2728
override val argc = 2
2829
override fun execute(
@@ -36,11 +37,11 @@ class OpMakePackagedSpell(val isValid: Predicate<ItemStack>, val expectedTypeDes
3637
val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(it)
3738
isValid.test(it) && hexHolder != null && !hexHolder.hasHex()
3839
}
39-
?: throw MishapBadOffhandItem(ItemStack.EMPTY.copy(), expectedTypeDesc) // TODO: hack
40+
?: throw MishapBadOffhandItem(ItemStack.EMPTY.copy(), expectedTypeDesc.get()) // TODO: hack
4041

4142
val hexHolder = IXplatAbstractions.INSTANCE.findHexHolder(handStack)
4243
if (!isValid.test(handStack)) {
43-
throw MishapBadOffhandItem(handStack, expectedTypeDesc)
44+
throw MishapBadOffhandItem(handStack, expectedTypeDesc.get())
4445
} else if (hexHolder == null || hexHolder.hasHex()) {
4546
throw MishapBadOffhandItem.of(handStack, "iota.write")
4647
}

Common/src/main/java/at/petrak/hexcasting/common/lib/hex/HexActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public class HexActions {
275275

276276
public static final ActionRegistryEntry CRAFT$CYPHER = make("craft/cypher", new ActionRegistryEntry(
277277
HexPattern.fromAngles("waqqqqq", HexDir.EAST),
278-
new OpMakePackagedSpell(s -> (s.is(HexItems.CYPHER)||s.is(HexItems.ANCIENT_CYPHER)), HexItems.CYPHER.getDescription(), MediaConstants.CRYSTAL_UNIT)
278+
new OpMakePackagedSpell(s -> (s.is(HexItems.CYPHER)||s.is(HexItems.ANCIENT_CYPHER)), HexItems.CYPHER::getDescription, MediaConstants.CRYSTAL_UNIT)
279279
));
280280
public static final ActionRegistryEntry CRAFT$TRINKET = make("craft/trinket", new ActionRegistryEntry(
281281
HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),

0 commit comments

Comments
 (0)