aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-07-29 16:14:04 +0200
committerLorenz <lo.scherf@gmail.com>2022-07-29 16:14:04 +0200
commitbc2ccc0c39495921aee82664266c1756f016b388 (patch)
tree5b4e931b96952673fc79822213b721cc8529afbb /src/main/java/at/hannibal2/skyhanni/items/abilitycooldown
parent1cacb26349e3b8bbe6c82ee7fd26782bb98f49ba (diff)
downloadskyhanni-bc2ccc0c39495921aee82664266c1756f016b388.tar.gz
skyhanni-bc2ccc0c39495921aee82664266c1756f016b388.tar.bz2
skyhanni-bc2ccc0c39495921aee82664266c1756f016b388.zip
added support for vanilla items from neu. allowing all vanilla items to be sold to npc
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/items/abilitycooldown')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/WitherImpactDetection.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/WitherImpactDetection.kt b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/WitherImpactDetection.kt
index 52caa59d0..4bc2939fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/WitherImpactDetection.kt
+++ b/src/main/java/at/hannibal2/skyhanni/items/abilitycooldown/WitherImpactDetection.kt
@@ -1,11 +1,12 @@
package at.hannibal2.skyhanni.items.abilitycooldown
import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.utils.ItemUtil.asStringSet
-import at.hannibal2.skyhanni.utils.ItemUtil.getExtraAttributes
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.client.Minecraft
import net.minecraft.init.Items
+import net.minecraft.item.ItemStack
+import net.minecraft.nbt.NBTTagCompound
+import net.minecraft.nbt.NBTTagList
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraft.network.play.server.S1CPacketEntityMetadata
import net.minecraft.network.play.server.S2APacketParticles
@@ -62,4 +63,12 @@ class WitherImpactDetection(private val itemAbilityCooldown: ItemAbilityCooldown
if (diff < 0) lastShieldUse = -1
}
}
+
+ private fun getExtraAttributes(item: ItemStack?): NBTTagCompound? {
+ return if (item == null || !item.hasTagCompound()) {
+ null
+ } else item.getSubCompound("ExtraAttributes", false)
+ }
+
+ private fun NBTTagList.asStringSet() = (0..tagCount()).mapTo(hashSetOf()) { getStringTagAt(it) }
} \ No newline at end of file