Jump to content

Recommended Posts

Posted

Hi

 

Problem:

 

Code:

public class StoneItemRenderer extends TileEntitySpecialRenderer {

private final RenderItem renderItem;

public StoneItemRenderer() {
	renderItem = new RenderItem() {
		@Override
		public boolean shouldBob() {
			return false;
		}
	};
	renderItem.setRenderManager(RenderManager.instance);
}

@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1,
		double d2, float f) {
	if (tileEntity instanceof MazerTile) {
		add(tileEntity, d0 + 1.3, d1, d2 + 1.3, f, 0);
		add(tileEntity, d0 - 1.3, d1, d2 - 1.3, f, 1);
		add(tileEntity, d0 + 1.3, d1, d2 - 1.3, f, 2);
		add(tileEntity, d0 - 1.3, d1, d2 + 1.3, f, 3);
	}
}

private void add(TileEntity tileEntity, double d0, double d1, double d2,
		float f, int slot) {
	MazerTile tile = (MazerTile) tileEntity;
	GL11.glPushMatrix();
	if (tile.getStackInSlot(slot) != null) {
		float scaleFactor = 0.85F;
		float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System
				.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
		EntityItem ghostEntityItem = new EntityItem(tile.getWorldObj());
		ghostEntityItem.hoverStart = 0.0F;
		ghostEntityItem.setEntityItemStack(tile.getStackInSlot(slot));
		float displacement = 0.2F;

		if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) {
			GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement
					+ 0.7F, (float) d2 + 0.5F);
		} else {
			GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement
					+ 0.6F, (float) d2 + 0.5F);
		}
		GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
		GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
		renderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
	}

	GL11.glPopMatrix();
}

}

 

thanks

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.