mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 05:02:39 +00:00
Merge pull request #420 from BluSunrize/master
Un-derping the Casting Channels
This commit is contained in:
commit
1dfcd86fb3
5 files changed
+839
-1031
No files matched your search
@@ -30,78 +30,77 @@ public class CastingChannelBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
if (player.isSneaking())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
//int amount = 0;
|
||||
//if (tile.getFluid() != null)
|
||||
//amount = tile.getLiquidAmount();
|
||||
//player.addChatMessage("LiquidAmount: " + amount);
|
||||
tile.setActive(true);
|
||||
}
|
||||
}
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
/*
|
||||
* Debugging
|
||||
System.out.println("Side: "+side);
|
||||
System.out.println("hitting: "+hitX+", "+hitY+", "+hitZ);
|
||||
String s = "LiquidAmount "+(world.isRemote?"client side: ":"server side: ");
|
||||
int amount = 0;
|
||||
if (tile.getTankInfo(null)[0].fluid != null)
|
||||
amount = tile.getTankInfo(null)[0].fluid.amount;
|
||||
if(world.isRemote)
|
||||
player.addChatMessage("-----");
|
||||
player.addChatMessage(s + amount);
|
||||
*/
|
||||
if(stack==null)
|
||||
tile.changeOutputs(player, side, hitX, hitY, hitZ);
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.itemID == this.blockID)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
float minX = 0.3125F;
|
||||
float maxX = 0.6875F;
|
||||
float minZ = 0.3125F;
|
||||
float maxZ = 0.6875F;
|
||||
minZ = 0F;
|
||||
maxZ = 1F;
|
||||
minX = 0F;
|
||||
maxX = 1F;
|
||||
|
||||
this.setBlockBounds(minX, 0.375F, minZ, maxX, 0.625F, maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
float minX = 0.3125F;
|
||||
float maxX = 0.6875F;
|
||||
float minZ = 0.3125F;
|
||||
float maxZ = 0.6875F;
|
||||
if (tile.hasTankConnected(ForgeDirection.NORTH))
|
||||
minZ = 0F;
|
||||
if (tile.hasTankConnected(ForgeDirection.SOUTH))
|
||||
maxZ = 1F;
|
||||
if (tile.hasTankConnected(ForgeDirection.WEST))
|
||||
minX = 0F;
|
||||
if (tile.hasTankConnected(ForgeDirection.EAST))
|
||||
maxX = 1F;
|
||||
|
||||
this.setBlockBounds(minX, 0.375F, minZ, maxX, 0.625F, maxZ);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return BlockRenderCastingChannel.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("tinker:searedstone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return BlockRenderCastingChannel.renderID;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World var1)
|
||||
{
|
||||
return new CastingChannelLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("tinker:searedstone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World var1)
|
||||
{
|
||||
return new CastingChannelLogic();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -97,7 +97,7 @@ public class TControls extends TKeyHandler
|
||||
{
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor"))
|
||||
if (shoes != null && shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor"))
|
||||
{
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps = shoeTag.getInteger("Double-Jump");
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package tconstruct.client.block;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.blocks.logic.CastingChannelLogic;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
@@ -22,348 +23,222 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//Floor
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z+
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X+
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//Floor
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z+
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X+
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == renderID)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == renderID)
|
||||
{
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (!tile.hasTankConnected(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//"Guiding Borders" when tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.625D, 0.625D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
/*renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.625D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);*/
|
||||
if (tile.hasTankConnected(ForgeDirection.NORTH))//Channel to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
Set<ForgeDirection> outputs = tile.getOutputs().keySet();
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.SOUTH))//Channel to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (!outputs.contains(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//"Guiding Borders" when tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.625D, 0.625D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (outputs.contains(ForgeDirection.NORTH))//Channel to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.WEST))//Channel to X-
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (outputs.contains(ForgeDirection.SOUTH))//Channel to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.EAST))//Channel to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (outputs.contains(ForgeDirection.WEST))//Channel to X-
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (tile.liquid != null)
|
||||
{
|
||||
float height = tile.getLiquidAmount() / (tile.getCapacity() * 1.05F);
|
||||
float j = tile.liquid.amount / tile.fillMax;
|
||||
double startY = tile.tankBelow();
|
||||
//if(tile.nearbyChannel(ForgeDirection.DOWN))startY = -0.5D;
|
||||
//else if(tile.hasTankConnected(ForgeDirection.DOWN))startY = 0D;
|
||||
float liquidAmount = tile.liquid.amount / 288f * 0.125f;
|
||||
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); //Center
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
//TConstruct.logger.info(tile.recentlyFilledDelay);
|
||||
if (outputs.contains(ForgeDirection.EAST))//Channel to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
FluidTankInfo tankMain = tile.getTankInfo(null)[0];
|
||||
if (tankMain.fluid != null)
|
||||
{
|
||||
float liquidAmount = (float)tankMain.fluid.amount / (float)tankMain.capacity * 0.125f;
|
||||
double startY = tile.tankBelow();
|
||||
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); //Center
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tankMain.fluid, false);
|
||||
}
|
||||
for(ForgeDirection dir: outputs)
|
||||
{
|
||||
double[] bounds = getRenderboundsForLiquid(dir);
|
||||
if(bounds == null)
|
||||
break;
|
||||
FluidTankInfo tankSub = tile.getTankInfo(dir)[0];
|
||||
if(tankSub == null || tankSub.fluid == null)
|
||||
break;
|
||||
float liquidAmount = (float)tankSub.fluid.amount / (float)tankSub.capacity * 0.125f / 2;
|
||||
renderer.setRenderBounds(bounds[0], 0.5, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tile.hasTankConnected(ForgeDirection.NORTH))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.NORTH)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.SOUTH))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.SOUTH)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.WEST))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.WEST)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile.hasTankConnected(ForgeDirection.EAST))
|
||||
{
|
||||
if (tile.lastProvider == ForgeDirection.EAST)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tile.recentlyFilledDelay == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
private double[] getRenderboundsForLiquid(ForgeDirection dir)
|
||||
{
|
||||
switch(dir)
|
||||
{
|
||||
case NORTH:
|
||||
return new double[]{0.375,0,0.625,0.375};
|
||||
case SOUTH:
|
||||
return new double[]{0.375,0.625,0.625,1};
|
||||
case WEST:
|
||||
return new double[]{0,0.375,0.375,0.625};
|
||||
case EAST:
|
||||
return new double[]{0.625,0.375,1,0.625};
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*if(tile.lastProvider==ForgeDirection.UP && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}*/
|
||||
private void renderLiquidPart (IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer, FluidStack fluidStack, boolean useFlowingTexture)
|
||||
{
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||
float blue = (color & 0xFF) / 255.0F;
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
if (fluid.canBePlacedInWorld() && !useFlowingTexture)
|
||||
BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
|
||||
else
|
||||
if(useFlowingTexture)
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getFlowingIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
|
||||
else
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
|
||||
}
|
||||
|
||||
/*if(tile.hasTankConnected(ForgeDirection.NORTH)&&tile.lastProvider!=ForgeDirection.NORTH)//Channel to Z-
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.SOUTH)&&tile.lastProvider!=ForgeDirection.SOUTH)//Channel to Z+
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.WEST)&&tile.lastProvider!=ForgeDirection.WEST)//Channel to X-
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.hasTankConnected(ForgeDirection.EAST)&&tile.lastProvider!=ForgeDirection.EAST)//Channel to X+
|
||||
{
|
||||
if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.NORTH && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.SOUTH && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.WEST && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}
|
||||
if(tile.lastProvider==ForgeDirection.EAST && tile.recentlyFilledDelay != 0)
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tile);
|
||||
}*/
|
||||
}
|
||||
private void renderStandardBlock (Block block, int meta, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderLiquidPart (IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer, CastingChannelLogic logic)
|
||||
{
|
||||
FluidStack liquid = logic.liquid;
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||
float blue = (color & 0xFF) / 255.0F;
|
||||
Fluid fluid = liquid.getFluid();
|
||||
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);
|
||||
}
|
||||
|
||||
private void renderStandardBlock (Block block, int meta, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory ()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return renderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return renderID;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,71 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import tconstruct.blocks.logic.CastingChannelLogic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CastingChannelDataProvider implements IWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
return currenttip;
|
||||
}
|
||||
@Override
|
||||
public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
if (accessor.getTileEntity() instanceof CastingChannelLogic)
|
||||
{
|
||||
CastingChannelLogic te = (CastingChannelLogic) accessor.getTileEntity();
|
||||
if (te.liquid != null && te.liquid.amount > 0)
|
||||
{
|
||||
FluidStack fs = te.liquid;
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount + "/" + te.getCapacity());
|
||||
}
|
||||
else
|
||||
{
|
||||
currenttip.add("§o" + StatCollector.translateToLocal("tconstruct.waila.empty")); // "§o" == Italics
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
if (accessor.getTileEntity() instanceof CastingChannelLogic)
|
||||
{
|
||||
CastingChannelLogic te = (CastingChannelLogic) accessor.getTileEntity();
|
||||
FluidTankInfo internalTank = te.getTankInfo(null)[0];
|
||||
FluidTankInfo northTank = te.getTankInfo(ForgeDirection.NORTH)[0];
|
||||
FluidTankInfo southTank = te.getTankInfo(ForgeDirection.SOUTH)[0];
|
||||
FluidTankInfo westTank = te.getTankInfo(ForgeDirection.WEST)[0];
|
||||
FluidTankInfo eastTank = te.getTankInfo(ForgeDirection.EAST)[0];
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
if(internalTank.fluid != null && internalTank.fluid.amount > 0)
|
||||
{
|
||||
FluidStack fs = internalTank.fluid;
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.liquidtag") + WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount + "/" + internalTank.capacity);
|
||||
}
|
||||
else
|
||||
{
|
||||
currenttip.add("§o" + StatCollector.translateToLocal("tconstruct.waila.empty")); // "§o" == Italics
|
||||
}
|
||||
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.subtanks"));
|
||||
String s1, s2, s3, s4;
|
||||
s1 = s2 = s3 = s4 = "§o" + StatCollector.translateToLocal("tconstruct.waila.empty");
|
||||
|
||||
if(northTank.fluid != null)
|
||||
s1 = northTank.fluid.amount + " / " + northTank.capacity;
|
||||
if(southTank.fluid != null)
|
||||
s2 = southTank.fluid.amount + " / " + southTank.capacity;
|
||||
if(westTank.fluid != null)
|
||||
s3 = westTank.fluid.amount + " / " + westTank.capacity;
|
||||
if(eastTank.fluid != null)
|
||||
s4 = eastTank.fluid.amount + " / " + eastTank.capacity;
|
||||
currenttip.add(s1 +"; " + s2 +"; " + s3 +"; " + s4);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user