Applied-Energistics-2-tiler.../src/main/java/appeng/client/render/blocks/RendererCableBus.java

77 lines
2.5 KiB
Java
Raw Normal View History

2014-11-14 12:02:52 +01:00
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
2014-09-24 02:26:27 +02:00
package appeng.client.render.blocks;
2014-09-24 02:26:27 +02:00
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
2014-12-29 21:59:05 +01:00
import appeng.block.networking.BlockCableBus;
2014-09-24 02:26:27 +02:00
import appeng.client.render.BaseBlockRender;
import appeng.client.render.BusRenderHelper;
import appeng.client.render.BusRenderer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBus>
2014-09-24 02:26:27 +02:00
{
public RendererCableBus()
{
2014-09-24 02:26:27 +02:00
super( true, 30 );
}
@Override
public void renderInventory( BlockCableBus blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
2014-09-24 02:26:27 +02:00
{
// nothing.
}
@Override
public boolean renderInWorld( BlockCableBus block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
2014-09-24 02:26:27 +02:00
{
AEBaseTile t = block.getTileEntity( world, x, y, z );
if( t instanceof TileCableBus )
2014-09-24 02:26:27 +02:00
{
2015-01-01 22:13:10 +01:00
BusRenderer.INSTANCE.renderer.renderAllFaces = true;
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
BusRenderer.INSTANCE.renderer.overrideBlockTexture = renderer.overrideBlockTexture;
( (TileCableBus) t ).cb.renderStatic( x, y, z );
2015-01-01 22:13:10 +01:00
BusRenderer.INSTANCE.renderer.renderAllFaces = false;
2014-09-24 02:26:27 +02:00
}
2015-01-01 22:13:10 +01:00
return BusRenderHelper.INSTANCE.getItemsRendered() > 0;
2014-09-24 02:26:27 +02:00
}
@Override
public void renderTile( BlockCableBus block, TileCableBus t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
2014-09-24 02:26:27 +02:00
{
if( t instanceof TileCableBus )
2014-09-24 02:26:27 +02:00
{
2015-01-01 22:13:10 +01:00
BusRenderer.INSTANCE.renderer.overrideBlockTexture = null;
( (TileCableBus) t ).cb.renderDynamic( x, y, z );
2014-09-24 02:26:27 +02:00
}
}
}