2018-10-16 11:49:30 +02:00
|
|
|
package de.ellpeck.naturesaura.blocks.tiles.render;
|
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.Helper;
|
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
2018-10-19 15:05:12 +02:00
|
|
|
import net.minecraft.item.Item;
|
2018-10-16 11:49:30 +02:00
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2018-10-19 15:05:12 +02:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2018-10-16 11:49:30 +02:00
|
|
|
|
|
|
|
public class RenderWoodStand extends TileEntitySpecialRenderer<TileEntityWoodStand> {
|
|
|
|
@Override
|
2018-10-17 18:41:53 +02:00
|
|
|
public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
2018-10-18 13:34:37 +02:00
|
|
|
ItemStack stack = tile.items.getStackInSlot(0);
|
2018-10-16 11:49:30 +02:00
|
|
|
if (!stack.isEmpty()) {
|
|
|
|
GlStateManager.pushMatrix();
|
2018-10-19 15:05:12 +02:00
|
|
|
Item item = stack.getItem();
|
|
|
|
if (item instanceof ItemBlock && ((ItemBlock) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
2018-10-17 18:41:53 +02:00
|
|
|
GlStateManager.translate(x + 0.5F, y + 0.9735F, z + 0.5F);
|
|
|
|
float scale = 0.65F;
|
|
|
|
GlStateManager.scale(scale, scale, scale);
|
|
|
|
} else {
|
|
|
|
GlStateManager.translate(x + 0.5F, y + 0.825F, z + 0.5F);
|
|
|
|
float scale = 0.4F;
|
|
|
|
GlStateManager.scale(scale, scale, scale);
|
|
|
|
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
|
|
|
}
|
2018-10-16 11:49:30 +02:00
|
|
|
Helper.renderItemInWorld(stack);
|
|
|
|
GlStateManager.popMatrix();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|