Hello,
I've searched and searched with no answer....
What my problem is:
When i call my Rotation with partialTick, it stays at 0 Degrees and flickers....
What i found out by other threads:
I have to call item onUpdate i entityUpdate or something, but can't seem to find a way in 1.8.9 to do this....
My codes:
TileEntity:
package dk.glazzo.mod.tileentity;
import dk.glazzo.mod.tileentity.render.GRenderer_glazzoItemStand;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IProgressUpdate;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class GTileEntity_glazzoItemStand extends TileEntity implements ITickable {
@SideOnly(Side.CLIENT)
public int rotation = 0;
@Override
public void tick() {
if(worldObj.isRemote) {
rotation++;
if(rotation > 360) {
rotation = 0;
}
}
}
}
TileRenderer:
package dk.glazzo.mod.tileentity.render;
import dk.glazzo.mod.blocks.GBlocks_glazzoItemStand;
import dk.glazzo.mod.tileentity.GTileEntity_glazzoItemStand;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class GRenderer_glazzoItemStand extends TileEntitySpecialRenderer {
EntityItem entityItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0D, 0D, 0D, new ItemStack(Items.fish));
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks, int destroyStage) {
entityItem.hoverStart = 0;
if(!(tileEntity.getBlockType() instanceof GBlocks_glazzoItemStand))
return;
GTileEntity_glazzoItemStand tileEntity_glazzoItemStand = (GTileEntity_glazzoItemStand) tileEntity;
GlStateManager.pushMatrix();
{
GlStateManager.translate(x, y, z);
GlStateManager.translate(0.5, 0, 0.5);
float rotation = (float) tileEntity_glazzoItemStand.rotation + partialTicks;
GlStateManager.rotate(rotation, 0, 1, 0);
Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
Minecraft.getMinecraft().getRenderItem();
}
GlStateManager.popMatrix();
}
}
Thanks!