Initial test of Gradle (not working yet)

This commit is contained in:
Sunstrike committed 2013-11-21 16:13:51 +00:00
1 parent e8b7378831
commit cb87c836c8
519 files changed
+351

No files matched your search

@@ -0,0 +1,83 @@
package tconstruct.client.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.TankAirLogic;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class TankAirRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
private static final double capacity = TConstruct.ingotLiquidValue * 18;
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//No inventory block
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
if (modelID == model)
{
TankAirLogic logic = (TankAirLogic) world.getBlockTileEntity(x, y, z);
if (logic.hasItem())
{
ItemStack item = logic.getStackInSlot(0);
if (item.getItem() instanceof ItemBlock)
{
Block inv = Block.blocksList[item.itemID];
renderer.setOverrideBlockTexture(inv.getIcon(1, item.getItemDamage()));
renderer.renderBlockByRenderType(inv, x, y, z);
renderer.clearOverrideBlockTexture();
}
}
else if (logic.hasFluids())
{
int base = 0;
for (FluidStack fluidstack : logic.getFluids())
{
Fluid fluid = fluidstack.getFluid();
//System.out.println("Base: "+getBaseAmount(base)+", Height: "+getHeightAmount(base, fluidstack.amount)+", fluid amount: "+fluidstack.amount);
renderer.setRenderBounds(0.0, getBaseAmount(base), 0.0, 1.0, getHeightAmount(base, fluidstack.amount), 1.0);
if (fluid.canBePlacedInWorld())
BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
else
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
base += fluidstack.amount;
}
}
}
return true;
}
private double getBaseAmount (int base)
{
return base / capacity;
}
private double getHeightAmount (int base, int amount)
{
return (base + amount) / capacity;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return model;
}
}