Skip to content

Commit 3b60e93

Browse files
committed
Add support for querying aspects in Thaumcraft wands, close #3524
1 parent 15eb13a commit 3b60e93

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Fixes/improvements
22

3+
* (1.7.10) [#3524] Add support for reading Thaumcraft aspect information from Wands. (repo-alt)
34
* (1.12.2) [#3659] Fixed bug when programatically transferring fluids from specific tanks. (yut23)
45
* [#3664] Fixed client-side errors when using third-party mod energy integration on an integrated server.
56
* [#3677] Fixed crash when showing error containing a percent sign with the Analyzer item.
@@ -9,4 +10,4 @@
910

1011
## List of contributors
1112

12-
asie, Computerdores, Glease, Hawk777, yut23
13+
asie, Computerdores, Glease, Hawk777, repo-alt, yut23
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
package li.cil.oc.integration.thaumcraft
22

3-
import java.util
4-
53
import li.cil.oc.api.driver.Converter
64
import net.minecraft.item.ItemStack
75
import thaumcraft.api.aspects.AspectList
86

7+
import java.util
98
import scala.collection.convert.WrapAsScala._
109

1110
object ConverterAspectItem extends Converter {
1211
override def convert(value: scala.Any, output: util.Map[AnyRef, AnyRef]): Unit = value match {
1312
case stack: ItemStack if stack.hasTagCompound =>
13+
stack.getItem.getClass.getName match {
14+
case "thaumcraft.common.items.wands.ItemWandCasting" =>
15+
try {
16+
stack.getItem.getClass.getMethod("getAllVis", classOf[ItemStack]).invoke(stack.getItem, stack) match {
17+
case aspects: AspectList =>
18+
if (aspects.size() > 0)
19+
output += "aspects" -> aspects
20+
return
21+
case _ => return
22+
}
23+
} catch {
24+
case _: Throwable =>
25+
}
26+
case _ =>
27+
}
28+
1429
val aspects = new AspectList()
1530
aspects.readFromNBT(stack.getTagCompound)
16-
output += "aspects" -> aspects
31+
if (aspects.size() > 0)
32+
output += "aspects" -> aspects
1733
case _ =>
1834
}
1935
}

0 commit comments

Comments
 (0)