mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
fix incompability with xenondev anvil UI
This commit is contained in:
parent
053ab2b943
commit
bf7a158c95
1 changed files with 20 additions and 6 deletions
|
|
@ -9,15 +9,29 @@ interface ExternGuiTester {
|
||||||
fun getContainerClass(inventory: InventoryView): Class<Any>?
|
fun getContainerClass(inventory: InventoryView): Class<Any>?
|
||||||
|
|
||||||
fun testIfGui(inventory: InventoryView): Boolean {
|
fun testIfGui(inventory: InventoryView): Boolean {
|
||||||
val clazz = getContainerClass(inventory)
|
val clazz = getContainerClass(inventory) ?: return false
|
||||||
if(clazz == null) return false
|
|
||||||
|
|
||||||
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
|
|
||||||
|
|
||||||
val clazzName = clazz.name
|
val clazzName = clazz.name
|
||||||
val isWejdsGui = clazzName.contains(expectedWesjdGuiPath)
|
if (expectWesjd(clazzName)) return true
|
||||||
|
if (expectXenondevUI(clazzName)) return true
|
||||||
|
|
||||||
return isWejdsGui
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun expectWesjd(name: String): Boolean {
|
||||||
|
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
|
||||||
|
|
||||||
|
return name.contains(expectedWesjdGuiPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val XenondevUIPrefix: String
|
||||||
|
get() = "xyz.xenondevs.inventoryaccess."
|
||||||
|
private val XenondevUISufix: String
|
||||||
|
get() = ".AnvilInventoryImpl"
|
||||||
|
|
||||||
|
fun expectXenondevUI(name: String): Boolean {
|
||||||
|
return name.startsWith(XenondevUIPrefix)
|
||||||
|
&& name.endsWith(XenondevUISufix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue