Получить текстуру блока (предмета) в стаке

Версия Minecraft
1.7.10
1,976
68
220
Здравствуйте,
Я делаю что-то вроде полочки, на которую можно положить предмет(ы).
Нужно получить текстуру блока или предмета из ItemStack'а на этой полочке. Хотел обычным геттером protected String getIconString() (из предмета) - не даёт - пишет "The method getIconString() from the type Item is not visible ". Тоже самое с геттером блока. Сделал рефлексией. Теперь консоль кричит про "java.lang.NoSuchFieldException" (iconString для предметов или textureName для блоков). Помогите, что делать?
Код:
Field icon = Block.getBlockFromItem(tileentity.getItem().getItem()).getClass().getDeclaredField("textureName");
				icon.setAccessible(true);
				GL11.glBindTexture(GL11.GL_TEXTURE_2D, (minecraft.renderEngine.getTexture(new ResourceLocation((String)icon.get(Block.getBlockFromItem(tileentity.getItem().getItem()))))).getGlTextureId());

Field icon = tileentity.getItem().getItem().getClass().getDeclaredField("iconString");
				icon.setAccessible(true);
				GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.renderEngine.getTexture(new ResourceLocation((String)icon.get(tileentity.getItem().getItem()))).getGlTextureId());
// Да, знаю, код упоротый. Может и где-то в нём проблема...
 
Решение
Либо убрать:
Код:
GL11.glTranslated(tile.xCoord - mc.thePlayer.posX + 0.5, tile.yCoord - mc.thePlayer.posY + 0.5, tile.zCoord - mc.thePlayer.posZ + 0.5);
с
Код:
    private void renderShelfAt(ShelfTileEntity tile, double x, double y, double z, float f) {
        if(tile.item == null) return;
        renderDisplayedName(tile, x, y, z);
        renderItem(tile);
    }
на
Код:
	private void renderShelfAt(ShelfTileEntity tile, double x, double y, double z, float f) {
		if(tile.getItemStack() == null) return;
		renderDisplayedName(tile, x, y, z);
		GL11.glPushMatrix();
		GL11.glTranslated(x, y, z);
		GL11.glTranslatef(0.5F, 0.5F, 0.5F);
		renderItem(tile);
		GL11.glPopMatrix();
	}


Если хочешь нормально все предметы были видны...

timaxa007

Модератор
5,831
409
672
Если я правельно понял, то наверное тебе нужно что-то вроде этого:
Код:
ItemStack item = new ItemStack(Blocks.tnt);
IIcon icon = item.getItem().getIconIndex(item);
String path = icon.getIconName();
 
1,976
68
220
Крашит с NPE с указателем на нижнюю строчку (засунул блок)
Код:
IIcon icon = Block.getBlockFromItem(tileentity.getItem().getItem()).getIcon(1, tileentity.getItem().getItemDamage());
GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.renderEngine.getTexture(new ResourceLocation(icon.getIconName())).getGlTextureId());
 

timaxa007

Модератор
5,831
409
672
Нужно сначала нужно биндить эту текстуру, затем брать у неё ид текстуры.


Код:
ResourceLocation rl = new ResourceLocation(path);
Minecraft.getMinecraft().renderEngine.bindTexture(rl);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().renderEngine.getTexture(rl).getGlTextureId());


Но всё-же не хорошо каждый цикл создавать новый объект ResourceLocation'а.


icon.getIconName(); - получаешь имя которое ты регистрировал в блоке или предмете, но не путь к текстуре.


Создать метод, который из icon.getIconName() превращал путь к текстуре.
 
1,976
68
220
Это как? Нужно же modID знать, папку с текстурой и т.д. Это физически нереально (я таких способов не знаю)


Наверное, стоит скопировать код из рамки. Но там для рендера используется свой эвент, а я не уверен, что смогу качественно его скопировать и зарегистрировать
 

timaxa007

Модератор
5,831
409
672
В icon.getIconName() есть его как-бы сокращённый вид пути, modid:texture  которую нужно (вроде как) привести к:
modid:textures/blocks/texture.png - если это блок,
modid:textures/items/texture.png - если это предмет.
 
2,505
81
397
Ух, костыли. Лучше бы сразу сказал, что ты хочешь. Я то думаю, зачем тебе строки...

Лучше капни в эту сторону
Код:
mc.getTextureManager().bindTexture(mc.getTextureManager().getResourceLocation(1));
drawTexturedModelRectFromIcon(pos, pos, stack.getItem().getIconFromDamage(0), 16, 16);
 

timaxa007

Модератор
5,831
409
672
Код:
		ItemStack item = new ItemStack(Blocks.tnt);
		IIcon icon = item.getItem().getIconIndex(item);
		String path = icon.getIconName();
		String[] spl = path.split(":");
		path = "";
		if (spl.length > 1) path += spl[0] + ":";
		path += "textures/";
		if (item.getItem() instanceof ItemBlock)
			path += "blocks";
		else 
			path += "items";
		path += "/" + spl[spl.length > 1 ? 1 : 0] + ".png";
		ResourceLocation rl = new ResourceLocation(path);
		Minecraft.getMinecraft().renderEngine.bindTexture(rl);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().renderEngine.getTexture(rl).getGlTextureId());
 

timaxa007

Модератор
5,831
409
672
1,976
68
220
Сам рендер я и так взял из другого мода - SCPCraft на 1.4.6 (я, собственно, его на 1.7.10 переношу... снова :D)
Но вот там текстура искалась проще


Не-а, не работает. Просто серый кубик (у травы верх зелёный, как будто слетели текстуркарты)


Хотя... оно как будто просто берёт основной цвет стороны блока и лепит его вместо текстуры на эту сторону
 
1,976
68
220
Оп-па. А руническая матрица из таума полностью отрендерилась о_О


Все блоки с моделями из таумкрафта рендерятся нормально. Вот это поворот о_О


Код:
package alexsocol.scprein.blocks.render;
 
import java.lang.reflect.Field;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import alexsocol.scprein.blocks.tileentity.ShelfTileEntity;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;

public class ShelfRender extends TileEntitySpecialRenderer {

 public RenderBlocks renderBlocksInstance = new RenderBlocks();
 private Minecraft minecraft = Minecraft.getMinecraft();
 
 public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
 renderShelfAt((ShelfTileEntity)tileentity, d, d1, d2, f); 
 }
 
 private void renderShelfAt(ShelfTileEntity tileentity, double d, double d1, double d2, float f) {
 if(tileentity.item == null) return;
 GL11.glPushMatrix();
 int facing1 = (tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) & 3);
 float pos = 0F;
 if(facing1 == 0 )pos = 180F;
 else if (facing1 == 1) pos = 90F;
 else if (facing1 == 2) pos = 0F;
 else if (facing1 == 3) pos = 270F;
 if(tileentity.item.getMaxDamage() > 1){
 renderLivingLabel(tileentity.item.getDisplayName(), d + 0.5D, d1 + 0.95D, d2 + 0.5D, pos);
 renderLivingLabel(tileentity.item.getMaxDamage() - tileentity.item.getItemDamage() + "/" + tileentity.item.getMaxDamage(), d + 0.5D, d1 + 0.85D, d2 + 0.5D, pos);
 } else if (tileentity.item.isStackable()) {
 renderLivingLabel(tileentity.item.getDisplayName() + " (" + tileentity.item.stackSize + ")", d + 0.5D, d1 + 0.85D, d2 + 0.5D, pos);
 } else {
 renderLivingLabel(tileentity.item.getDisplayName(), d + 0.5D, d1 + 0.85D, d2 + 0.5D, pos); 
 }
 if ((tileentity.item.getItem() instanceof ItemBlock) && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(tileentity.getItem().getItem()).getRenderType())) {
 float blockScale = 0.35F;
 float offset = 0.5F;
 int s = 0;
 int facing = (tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) & 3);
 if(facing == 0) facing = 2;
 else if (facing == 2) facing = 0;
 facing = (facing + 2) % 4;
 if(facing == 1 || facing == 3) s = 1;
 boolean isSCP151 = false; // TODO: get rid of this or reuse Block.getBlockFromItem(tileentity.getItem().getItem()) == mod_SCP.SCP151;
 if(!isSCP151) GL11.glTranslatef((float)d + offset, (float)d1 + offset, (float)d2 + offset);
 else if (s == 1) GL11.glTranslatef((float)d + 0.66F, (float)d1 + 0.6F, (float)d2 + 0.33F);
 else GL11.glTranslatef((float)d + 0.33F, (float)d1 + 0.6F, (float)d2 + 0.33F);
 
 if(!isSCP151) GL11.glRotatef(90F * facing, 0.0F, 1.0F, 0F);
 else if(s == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0F);
 else GL11.glRotatef(180F, 0.0F, 1.0F, 0F);
 
 GL11.glScalef(blockScale,blockScale,blockScale);
 
 IIcon icon = Block.getBlockFromItem(tileentity.getItem().getItem()).getIcon(1, tileentity.getItem().getItemDamage());
 String path = icon.getIconName();
 String[] spl = path.split(":");
 path = "";
 if (spl.length > 1) path += spl[0] + ":";
 path += "textures/";
 path += "blocks";
 path += "/" + spl[spl.length > 1 ? 1 : 0] + ".png";
 ResourceLocation rl = new ResourceLocation(path);
 Minecraft.getMinecraft().renderEngine.bindTexture(rl);
 GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().renderEngine.getTexture(rl).getGlTextureId());
 
 this.renderBlocksInstance.renderBlockAsItem(Block.getBlockFromItem(tileentity.getItem().getItem()), tileentity.item.getItemDamage(), 1F);
 } else {
 try {
 Field icon = tileentity.getItem().getItem().getClass().getDeclaredField("iconString");
 icon.setAccessible(true);
 GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.renderEngine.getTexture(new ResourceLocation((String)icon.get(tileentity.getItem().getItem()))).getGlTextureId());
 } catch (NoSuchFieldException e) {
 e.printStackTrace();
 } catch (SecurityException e) {
 e.printStackTrace();
 } catch (IllegalArgumentException e) {
 e.printStackTrace();
 } catch (IllegalAccessException e) {
 e.printStackTrace();
 }
 
 Tessellator tessellator = Tessellator.instance;
 IIcon i = tileentity.item.getIconIndex();
 float f0 = i.getMinU();
 float f1 = i.getMaxU();
 float f2 = i.getMinV();
 float f3 = i.getMaxV();

 GL11.glEnable(GL12.GL_RESCALE_NORMAL);
 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
 GL11.glTranslatef((float)d, (float)d1, (float)d2);
 GL11.glTranslatef(0.5F, 0.25F, 0.5F);
 int var15;
 
 int facing = (tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) & 3);
 if(facing == 0) facing = 2;
 else if (facing == 2) facing = 0;
 GL11.glRotatef(90F * facing, 0.0F, 1.0F, 0F);
 
 GL11.glTranslatef(-0.2F, 0F, 0F);
 GL11.glScalef(0.4F, 0.4F, 1.0F);
 
 this.renderItem(tessellator, f1, f2, f0, f3);
 
 if (tileentity.item.getItem().requiresMultipleRenderPasses()) {
                for (var15 = 0; var15 < tileentity.item.getItem().getRenderPasses(tileentity.item.getItemDamage()); ++var15) {
                    IIcon var16 = tileentity.item.getItem().getIconFromDamageForRenderPass(tileentity.getItem().getItemDamage(), var15);
         f0 = var16.getMinU();
         f1 = var16.getMaxU();
         f2 = var16.getMinV();
         f3 = var16.getMaxV();
                    float var17 = 1.0F;
                    int var18 = tileentity.getItem().getItem().getColorFromItemStack(tileentity.item, var15);
                    float var19 = (float)(var18 >> 16 & 255) / 255.0F;
                    float var20 = (float)(var18 >> 8 & 255) / 255.0F;
                    float var21 = (float)(var18 & 255) / 255.0F;
                    GL11.glColor4f(var19 * var17, var20 * var17, var21 * var17, 1.0F);
         this.renderItem(tessellator, f1, f2, f0, f3);
                }
            }
 
 if(tileentity.getItem().isItemEnchanted()) {
 GL11.glDepthFunc(GL11.GL_EQUAL);
 GL11.glDisable(GL11.GL_LIGHTING);
 minecraft.renderEngine.bindTexture(new ResourceLocation("minecraft/textures/misc/enchanted_item_glint.png"));
 GL11.glEnable(GL11.GL_BLEND);
 GL11.glColor4f(0.5F, 0.25F, 0.8F, 0.175F);
 GL11.glMatrixMode(GL11.GL_TEXTURE);
 GL11.glPushMatrix();
 float f8 = 0.325F;
 GL11.glScalef(f8, f8, f8);
 float f9 = ((float)(System.currentTimeMillis() % 3000L) / 3000F) * 4F;
 GL11.glTranslatef(f9, 0.0F, 0.0F);
 GL11.glRotatef(-50F, 0.0F, 0.0F, 1.0F);
 this.renderItem(tessellator, 0.0F, 0.0F, 1.0F, 1.0F);
 GL11.glPopMatrix();
 GL11.glPushMatrix();
 GL11.glScalef(f8, f8, f8);
 f9 = ((float)(System.currentTimeMillis() % 4873L) / 4873F) * 4F;
 GL11.glTranslatef(-f9, 0.0F, 0.0F);
 GL11.glRotatef(10F, 0.0F, 0.0F, 1.0F);
 this.renderItem(tessellator, 0.0F, 0.0F, 1.0F, 1.0F);
 GL11.glPopMatrix();
 GL11.glMatrixMode(GL11.GL_MODELVIEW);
 GL11.glDisable(GL11.GL_BLEND);
 GL11.glEnable(GL11.GL_LIGHTING);
 GL11.glDepthFunc(GL11.GL_LEQUAL);
 }

 }
        GL11.glPopMatrix();
 }
 
    protected void renderLivingLabel(String par2Str, double par3, double par5, double par7, float position) {
 FontRenderer var12 = this.minecraft.fontRenderer;
 float var13 = 0.75F;
 float var14 = 0.012666668F * var13;
 float var17 = 0F;
 if (var12.getStringWidth(par2Str) > 70) {
 var17 = 0.9F / var12.getStringWidth(par2Str);
 } else {
 var17 = var14;
 }
 GL11.glPushMatrix();
 GL11.glTranslatef((float) par3, (float) par5, (float) par7);
 GL11.glNormal3f(0.0F, 0.0F, 0.0F);
 GL11.glRotatef(position, 0.0F, 1.0F, 0.0F);
 GL11.glScalef(-var17, -var14, var17);
 GL11.glDisable(GL11.GL_LIGHTING);
 GL11.glDepthMask(false);
 byte var16 = 0;
 var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, 553648127);
 GL11.glDepthMask(true);
 GL11.glEnable(GL11.GL_LIGHTING);
 GL11.glPopMatrix();
 }
 
 public void renderItem(Tessellator par1Tessellator, float par2, float par3, float par4, float par5) {
        float f = 1.0F;
        float f1 = 0.0625F;
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(0.0F, 0.0F, 1.0F);
        par1Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, par2, par5);
        par1Tessellator.addVertexWithUV(f, 0.0D, 0.0D, par4, par5);
        par1Tessellator.addVertexWithUV(f, 1.0D, 0.0D, par4, par3);
        par1Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, par2, par3);
        par1Tessellator.draw();
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(0.0F, 0.0F, -1F);
        par1Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0F - f1, par2, par3);
        par1Tessellator.addVertexWithUV(f, 1.0D, 0.0F - f1, par4, par3);
        par1Tessellator.addVertexWithUV(f, 0.0D, 0.0F - f1, par4, par5);
        par1Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F - f1, par2, par5);
        par1Tessellator.draw();
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(-1F, 0.0F, 0.0F);

        for (int i = 0; i < 16; i++) {
            float f2 = (float)i / 16F;
            float f6 = (par2 + (par4 - par2) * f2) - 0.001953125F;
            float f10 = f * f2;
            par1Tessellator.addVertexWithUV(f10, 0.0D, 0.0F - f1, f6, par5);
            par1Tessellator.addVertexWithUV(f10, 0.0D, 0.0D, f6, par5);
            par1Tessellator.addVertexWithUV(f10, 1.0D, 0.0D, f6, par3);
            par1Tessellator.addVertexWithUV(f10, 1.0D, 0.0F - f1, f6, par3);
        }

        par1Tessellator.draw();
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(1.0F, 0.0F, 0.0F);

        for (int j = 0; j < 16; j++) {
            float f3 = (float)j / 16F;
            float f7 = (par2 + (par4 - par2) * f3) - 0.001953125F;
            float f11 = f * f3 + 0.0625F;
            par1Tessellator.addVertexWithUV(f11, 1.0D, 0.0F - f1, f7, par3);
            par1Tessellator.addVertexWithUV(f11, 1.0D, 0.0D, f7, par3);
            par1Tessellator.addVertexWithUV(f11, 0.0D, 0.0D, f7, par5);
            par1Tessellator.addVertexWithUV(f11, 0.0D, 0.0F - f1, f7, par5);
        }

        par1Tessellator.draw();
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);

        for (int k = 0; k < 16; k++) {
            float f4 = (float)k / 16F;
            float f8 = (par5 + (par3 - par5) * f4) - 0.001953125F;
            float f12 = f * f4 + 0.0625F;
            par1Tessellator.addVertexWithUV(0.0D, f12, 0.0D, par2, f8);
            par1Tessellator.addVertexWithUV(f, f12, 0.0D, par4, f8);
            par1Tessellator.addVertexWithUV(f, f12, 0.0F - f1, par4, f8);
            par1Tessellator.addVertexWithUV(0.0D, f12, 0.0F - f1, par2, f8);
        }

        par1Tessellator.draw();
        par1Tessellator.startDrawingQuads();
        par1Tessellator.setNormal(0.0F, -1F, 0.0F);

        for (int l = 0; l < 16; l++) {
            float f5 = (float)l / 16F;
            float f9 = (par5 + (par3 - par5) * f5) - 0.001953125F;
            float f13 = f * f5;
            par1Tessellator.addVertexWithUV(f, f13, 0.0D, par4, f9);
            par1Tessellator.addVertexWithUV(0.0D, f13, 0.0D, par2, f9);
            par1Tessellator.addVertexWithUV(0.0D, f13, 0.0F - f1, par2, f9);
            par1Tessellator.addVertexWithUV(f, f13, 0.0F - f1, par4, f9);
        }

        par1Tessellator.draw();
    }
 
 public static String getModId(ItemStack stack) {
 GameRegistry.UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(stack.getItem());
    return id == null || id.modId.equals("") ? "minecraft" : id.modId;
 }
}


Напоминаю, он взят из SCPCraft для 1.4.6. Исходники брал с гитхаба
 
1,976
68
220
Решил особо не копать, а скопировать код из RenderItemFrame.
Код:
public void renderItem(ShelfTileEntity tile) {
		ItemStack itemstack = tile.getItem();
		if (itemstack != null) {
			EntityItem entityitem = new EntityItem(tile.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack);
			Item item = entityitem.getEntityItem().getItem();
			entityitem.getEntityItem().stackSize = tile.getItem().stackSize;
			entityitem.hoverStart = 0.0F;
			GL11.glPushMatrix();
			GL11.glTranslated(tile.xCoord - minecraft.thePlayer.posX + 0.5, tile.yCoord - minecraft.thePlayer.posY + 0.5, tile.zCoord - minecraft.thePlayer.posZ + 0.5); // Вот этот чудо-код, отвечающий за позицию
			int rotation = tile.blockMetadata == 0 ? 2 : tile.blockMetadata == 1 ? 1 : tile.blockMetadata == 2 ? 0 : tile.blockMetadata == 3 ? -1 : 0;
			GL11.glRotatef(180.0F + 90 * rotation, 0.0F, 1.0F, 0.0F); // А вот эта фигня вращает предмет в зависимости от того, как я его положил, чтобы всегда смотреть "лицом" в нужную сторону
			if (item == Items.compass) {
				TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
				texturemanager.bindTexture(TextureMap.locationItemsTexture);
				TextureAtlasSprite textureatlassprite1 = ((TextureMap) texturemanager.getTexture(TextureMap.locationItemsTexture)).getAtlasSprite(Items.compass.getIconIndex(entityitem.getEntityItem()).getIconName());

				if (textureatlassprite1 instanceof TextureCompass) {
					TextureCompass texturecompass = (TextureCompass) textureatlassprite1;
					double d0 = texturecompass.currentAngle;
					double d1 = texturecompass.angleDelta;
					texturecompass.currentAngle = 0.0D;
					texturecompass.angleDelta = 0.0D;
					texturecompass.updateCompass(tile.getWorldObj(), tile.xCoord, tile.zCoord, (double) MathHelper.wrapAngleTo180_float((float) (180 + tile.blockMetadata * 90)), false, true);
					texturecompass.currentAngle = d0;
					texturecompass.angleDelta = d1;
				}

				RenderItem.renderInFrame = true;
				RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
				RenderItem.renderInFrame = false;

				if (item == Items.compass) {
					TextureAtlasSprite textureatlassprite = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationItemsTexture)).getAtlasSprite(Items.compass.getIconIndex(entityitem.getEntityItem()).getIconName());

					if (textureatlassprite.getFrameCount() > 0) {
						textureatlassprite.updateAnimation();
					}
				}
			}

			GL11.glPopMatrix();
        }
    }
Всё хорошо, осталась одна маленькая деталь - предмет "привязывается" к координатам игрока и находится на голове. Я задал ему позицию простыми математическими вычислениями, но при движении игрока он дёргается. Подскажите, пожалуйста, как этого можно избежать?
 

timaxa007

Модератор
5,831
409
672
Ты для позиции использовал переменную parTicks, если да - то убери, если нет - то подставь типа так:
Код:
double x_fix = -(mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * event.parTicks);
double y_fix = -(mc.thePlayer.lastTickPosY + (mc.thePlayer.posY - mc.thePlayer.lastTickPosY) * event.parTicks);
double z_fix = -(mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * event.parTicks);


Код:
EntityItem entityitem = new EntityItem(tile.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack);
entityitem.hoverStart = 0.0F;
renderManager.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
 
Сверху