ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderCompost.java

40 lines
1.6 KiB
Java
Raw Normal View History

2016-02-20 15:23:03 +01:00
/*
* This file ("GuiBooklet.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense/
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.blocks.render;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
public class RenderCompost extends TileEntitySpecialRenderer{
@Override
2016-02-20 16:16:41 +01:00
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage){
2016-02-20 15:23:03 +01:00
if(te instanceof TileEntityCompost){
2016-02-20 16:16:41 +01:00
TileEntityCompost compost = (TileEntityCompost)te;
2016-02-20 15:23:03 +01:00
if(compost.getStackInSlot(0) != null){
2016-02-20 16:16:41 +01:00
float i = compost.getAmount()/TileEntityCompost.AMOUNT;
2016-02-20 15:23:03 +01:00
GlStateManager.pushMatrix();
2016-02-20 16:16:41 +01:00
GlStateManager.translate((float)x+0.5F, (float)y+(i/3F)+0.01F, (float)z+0.5F);
2016-02-20 15:23:03 +01:00
GlStateManager.scale(1.5F, i, 1.5F);
int meta = compost.getStackInSlot(0).getItem() == InitItems.itemFertilizer ? 1 : 0;
AssetUtil.renderBlockInWorld(Blocks.dirt, meta);
GlStateManager.popMatrix();
}
}
}
}