diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-05 19:36:55 -0500 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-05 19:36:55 -0500 |
commit | 1527fb6882d22e2668daafd366d3b33369c00acf (patch) | |
tree | 4413071034eede465fe02e6979be864263a83b70 /src/main/java/me/Danker | |
parent | 012e3dc70ff72590019d3f07602b0371c3b6f778 (diff) | |
download | SkyblockMod-1527fb6882d22e2668daafd366d3b33369c00acf.tar.gz SkyblockMod-1527fb6882d22e2668daafd366d3b33369c00acf.tar.bz2 SkyblockMod-1527fb6882d22e2668daafd366d3b33369c00acf.zip |
Add renderItem function from SBA
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 9d460bc..e0a7454 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderManager; @@ -18,6 +19,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.util.*; import org.lwjgl.opengl.GL11; @@ -363,6 +365,22 @@ public class Utils { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } + + public static void renderItem(ItemStack item, float x, float y, float z) { + + GlStateManager.enableRescaleNormal(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.enableDepth(); + + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, z); + Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(item, 0, 0); + GlStateManager.popMatrix(); + + GlStateManager.disableDepth(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + } public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) { double x = pos2.xCoord - pos1.xCoord; |