diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-20 22:15:08 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-20 22:15:08 +0100 |
commit | a66db31bd1388d411365debf2914aa686c40dae0 (patch) | |
tree | 5b9235a5f76f318d1551ba747c47927afdcdc018 /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | |
parent | 9d411375b4b493d797174512297ab57c6df54769 (diff) | |
download | skyhanni-a66db31bd1388d411365debf2914aa686c40dae0.tar.gz skyhanni-a66db31bd1388d411365debf2914aa686c40dae0.tar.bz2 skyhanni-a66db31bd1388d411365debf2914aa686c40dae0.zip |
Add items to line renderer. Used for reputationHelper.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt new file mode 100644 index 000000000..46c9c6fea --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.utils + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import io.github.moulberry.notenoughupdates.util.Utils +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.init.Items +import net.minecraft.item.ItemStack + +object NEUItems { + + private val itemCache = mutableMapOf<String, ItemStack>() + + fun readItemFromRepo(internalName: String): ItemStack { + if (itemCache.contains(internalName)) { + return itemCache[internalName]!! + } + val itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack( + NotEnoughUpdates.INSTANCE.manager.itemInformation[internalName] + ) + if (itemStack != null) { + itemCache[internalName] = itemStack + } + return itemStack + } + + fun ItemStack.renderOnScreen(x: Float, y: Float) { + GlStateManager.pushMatrix() + GlStateManager.translate(x, y, 0f) + + val scale = if (item === Items.skull) 0.8f else 0.6f + GlStateManager.scale(scale, scale, 1f) + Utils.drawItemStack(this, 0, 0) + GlStateManager.popMatrix() + } +}
\ No newline at end of file |