Fixed render and block bounds for gutter

This commit is contained in:
Calclavia 2014-02-25 21:05:37 +08:00
parent 500eca7ea6
commit 1442b683c7
15 changed files with 233 additions and 696 deletions

View file

@ -5,8 +5,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import resonantinduction.archaic.blocks.BlockTurntable;
import resonantinduction.archaic.channel.BlockChannel;
import resonantinduction.archaic.channel.TileChannel;
import resonantinduction.archaic.crate.BlockCrate;
import resonantinduction.archaic.crate.ItemBlockCrate;
import resonantinduction.archaic.crate.TileCrate;
@ -17,6 +15,8 @@ import resonantinduction.archaic.firebox.BlockFirebox;
import resonantinduction.archaic.firebox.BlockHotPlate;
import resonantinduction.archaic.firebox.TileFirebox;
import resonantinduction.archaic.firebox.TileHotPlate;
import resonantinduction.archaic.gutter.BlockGutter;
import resonantinduction.archaic.gutter.TileGutter;
import resonantinduction.archaic.imprint.BlockImprinter;
import resonantinduction.archaic.imprint.TileImprinter;
import resonantinduction.archaic.process.BlockCastingMold;
@ -96,7 +96,7 @@ public class Archaic
blockHotPlate = contentRegistry.createTile(BlockHotPlate.class, TileHotPlate.class);
blockMillstone = contentRegistry.createTile(BlockMillstone.class, TileMillstone.class);
blockCast = contentRegistry.createTile(BlockCastingMold.class, TileCastingMold.class);
blockChannel = contentRegistry.createTile(BlockChannel.class, TileChannel.class);
blockChannel = contentRegistry.createTile(BlockGutter.class, TileGutter.class);
itemImprint = contentRegistry.createItem(ItemImprint.class);
itemHammer = contentRegistry.createItem(ItemHammer.class);

View file

@ -1,22 +1,6 @@
package resonantinduction.archaic;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.archaic.channel.ItemChannelRenderer;
import resonantinduction.archaic.channel.RenderChannel;
import resonantinduction.archaic.channel.TileChannel;
import cpw.mods.fml.client.registry.ClientRegistry;
public class ClientProxy extends CommonProxy
{
@Override
public void preInit()
{
ClientRegistry.bindTileEntitySpecialRenderer(TileChannel.class, RenderChannel.INSTANCE);
}
@Override
public void init()
{
MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer());
}
}

View file

@ -1,66 +0,0 @@
package resonantinduction.archaic.channel;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonantinduction.core.Reference;
import resonantinduction.core.prefab.fluid.BlockFluidNetwork;
import resonantinduction.core.render.RIBlockRenderingHandler;
import universalelectricity.api.UniversalElectricity;
import calclavia.lib.utility.FluidUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Early tier version of the basic pipe. Open on the top, and can't support pressure.
*
* @author Darkguardsman
*/
public class BlockChannel extends BlockFluidNetwork
{
public BlockChannel(int id)
{
super(id, UniversalElectricity.machine);
setTextureName(Reference.PREFIX + "material_wood_surface");
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileChannel();
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return RIBlockRenderingHandler.ID;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (!world.isRemote && tile instanceof TileChannel)
{
if (!((TileChannel) tile).onActivated(entityplayer))
{
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
}
}
return true;
}
}

View file

@ -1,60 +0,0 @@
package resonantinduction.archaic.channel;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ItemChannelRenderer implements IItemRenderer
{
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
GL11.glRotatef(180f, 0f, 0f, 1f);
int meta = item.getItemDamage();
if (type == ItemRenderType.ENTITY)
{
GL11.glTranslatef(-.5F, -1F, -.5F);
RenderChannel.render(meta, Byte.parseByte("001100", 2));
}
else if (type == ItemRenderType.INVENTORY)
{
GL11.glTranslatef(0F, -1F, 0F);
RenderChannel.render(meta, Byte.parseByte("001100", 2));
}
else if (type == ItemRenderType.EQUIPPED)
{
GL11.glTranslatef(-1F, -1.2F, 0.5F);
RenderChannel.render(meta, Byte.parseByte("000011", 2));
}
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(-2F, -1.5F, 0.2F);
RenderChannel.render(meta, Byte.parseByte("001100", 2));
}
else
{
RenderChannel.render(item.getItemDamage(), Byte.parseByte("000011", 2));
}
GL11.glPopMatrix();
}
}

View file

@ -1,424 +0,0 @@
// Date: 12/30/2013 5:50:34 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package resonantinduction.archaic.channel;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.common.ForgeDirection;
import calclavia.lib.render.RenderUtility;
public class ModelChannel extends ModelBase
{
// fields
ModelRenderer base;
ModelRenderer leftBase;
ModelRenderer leftBaseB;
ModelRenderer rightBaseB;
ModelRenderer rightBase;
ModelRenderer frontBase;
ModelRenderer frontBaseB;
ModelRenderer backBase;
ModelRenderer backBaseB;
ModelRenderer frontA;
ModelRenderer frontB;
ModelRenderer backA;
ModelRenderer backB;
ModelRenderer rightA;
ModelRenderer rightB;
ModelRenderer leftB;
ModelRenderer leftA;
ModelRenderer centerA;
ModelRenderer centerB;
ModelRenderer centerC;
ModelRenderer centerD;
ModelRenderer frontDoorA;
ModelRenderer frontDoorB;
ModelRenderer frontDoorC;
ModelRenderer backDoorA;
ModelRenderer backDoorB;
ModelRenderer backDoorC;
ModelRenderer leftDoorA;
ModelRenderer leftDoorB;
ModelRenderer leftDoorC;
ModelRenderer rightDoorA;
ModelRenderer rightDoorB;
ModelRenderer rightDoorC;
ModelRenderer cornerBackLeft;
ModelRenderer cornerBackRight;
ModelRenderer cornerFrontLeft;
ModelRenderer cornerFrontRight;
public ModelChannel()
{
textureWidth = 128;
textureHeight = 128;
base = new ModelRenderer(this, 0, 0);
base.addBox(-4F, 0F, -4F, 8, 2, 8);
base.setRotationPoint(0F, 22F, 0F);
base.setTextureSize(64, 32);
base.mirror = true;
setRotation(base, 0F, 0F, 0F);
leftBase = new ModelRenderer(this, 32, 0);
leftBase.addBox(-4F, 0F, -4F, 4, 1, 8);
leftBase.setRotationPoint(8F, 22F, 0F);
leftBase.setTextureSize(64, 32);
leftBase.mirror = true;
setRotation(leftBase, 0F, 0F, 0F);
leftBaseB = new ModelRenderer(this, 36, 10);
leftBaseB.addBox(-4F, 0F, -3F, 4, 1, 6);
leftBaseB.setRotationPoint(8F, 23F, 0F);
leftBaseB.setTextureSize(64, 32);
leftBaseB.mirror = true;
setRotation(leftBaseB, 0F, 0F, 0F);
rightBaseB = new ModelRenderer(this, 36, 10);
rightBaseB.addBox(-4F, 0F, -3F, 4, 1, 6);
rightBaseB.setRotationPoint(-4F, 23F, 0F);
rightBaseB.setTextureSize(64, 32);
rightBaseB.mirror = true;
setRotation(rightBaseB, 0F, 0F, 0F);
rightBase = new ModelRenderer(this, 32, 0);
rightBase.addBox(-4F, 0F, -4F, 4, 1, 8);
rightBase.setRotationPoint(-4F, 22F, 0F);
rightBase.setTextureSize(64, 32);
rightBase.mirror = true;
setRotation(rightBase, 0F, 0F, 0F);
frontBase = new ModelRenderer(this, 60, 6);
frontBase.addBox(-3F, 0F, -4F, 6, 1, 4);
frontBase.setRotationPoint(0F, 23F, -4F);
frontBase.setTextureSize(64, 32);
frontBase.mirror = true;
setRotation(frontBase, 0F, 0F, 0F);
frontBaseB = new ModelRenderer(this, 58, 0);
frontBaseB.addBox(-4F, 0F, -4F, 8, 1, 4);
frontBaseB.setRotationPoint(0F, 22F, -4F);
frontBaseB.setTextureSize(64, 32);
frontBaseB.mirror = true;
setRotation(frontBaseB, 0F, 0F, 0F);
backBase = new ModelRenderer(this, 58, 0);
backBase.addBox(-4F, 0F, -4F, 8, 1, 4);
backBase.setRotationPoint(0F, 22F, 8F);
backBase.setTextureSize(64, 32);
backBase.mirror = true;
setRotation(backBase, 0F, 0F, 0F);
backBaseB = new ModelRenderer(this, 60, 6);
backBaseB.addBox(-3F, 0F, -4F, 6, 1, 4);
backBaseB.setRotationPoint(0F, 23F, 8F);
backBaseB.setTextureSize(64, 32);
backBaseB.mirror = true;
setRotation(backBaseB, 0F, 0F, 0F);
frontA = new ModelRenderer(this, 0, 12);
frontA.addBox(-4F, 0F, -4F, 2, 7, 4);
frontA.setRotationPoint(0F, 15F, -4F);
frontA.setTextureSize(64, 32);
frontA.mirror = true;
setRotation(frontA, 0F, 0F, 0F);
frontB = new ModelRenderer(this, 0, 12);
frontB.addBox(-4F, 0F, -4F, 2, 7, 4);
frontB.setRotationPoint(6F, 15F, -4F);
frontB.setTextureSize(64, 32);
frontB.mirror = true;
setRotation(frontB, 0F, 0F, 0F);
backA = new ModelRenderer(this, 0, 12);
backA.addBox(-4F, 0F, -4F, 2, 7, 4);
backA.setRotationPoint(0F, 15F, 8F);
backA.setTextureSize(64, 32);
backA.mirror = true;
setRotation(backA, 0F, 0F, 0F);
backB = new ModelRenderer(this, 0, 12);
backB.addBox(-4F, 0F, -4F, 2, 7, 4);
backB.setRotationPoint(6F, 15F, 8F);
backB.setTextureSize(64, 32);
backB.mirror = true;
setRotation(backB, 0F, 0F, 0F);
rightA = new ModelRenderer(this, 13, 12);
rightA.addBox(-8F, 0F, 0F, 4, 7, 2);
rightA.setRotationPoint(0F, 15F, -4F);
rightA.setTextureSize(64, 32);
rightA.mirror = true;
setRotation(rightA, 0F, 0F, 0F);
rightB = new ModelRenderer(this, 13, 12);
rightB.addBox(-8F, 0F, 6F, 4, 7, 2);
rightB.setRotationPoint(0F, 15F, -4F);
rightB.setTextureSize(64, 32);
rightB.mirror = true;
setRotation(rightB, 0F, 0F, 0F);
leftB = new ModelRenderer(this, 13, 12);
leftB.addBox(4F, 0F, 6F, 4, 7, 2);
leftB.setRotationPoint(0F, 15F, -4F);
leftB.setTextureSize(64, 32);
leftB.mirror = true;
setRotation(leftB, 0F, 0F, 0F);
leftA = new ModelRenderer(this, 13, 12);
leftA.addBox(4F, 0F, 0F, 4, 7, 2);
leftA.setRotationPoint(0F, 15F, -4F);
leftA.setTextureSize(64, 32);
leftA.mirror = true;
setRotation(leftA, 0F, 0F, 0F);
centerA = new ModelRenderer(this, 27, 12);
centerA.addBox(-4F, 0F, -4F, 2, 7, 2);
centerA.setRotationPoint(6F, 15F, 6F);
centerA.setTextureSize(64, 32);
centerA.mirror = true;
setRotation(centerA, 0F, 0F, 0F);
centerB = new ModelRenderer(this, 27, 12);
centerB.addBox(-4F, 0F, -4F, 2, 7, 2);
centerB.setRotationPoint(6F, 15F, 0F);
centerB.setTextureSize(64, 32);
centerB.mirror = true;
setRotation(centerB, 0F, 0F, 0F);
centerC = new ModelRenderer(this, 27, 12);
centerC.addBox(-4F, 0F, -4F, 2, 7, 2);
centerC.setRotationPoint(0F, 15F, 0F);
centerC.setTextureSize(64, 32);
centerC.mirror = true;
setRotation(centerC, 0F, 0F, 0F);
centerD = new ModelRenderer(this, 27, 12);
centerD.addBox(-4F, 0F, -4F, 2, 7, 2);
centerD.setRotationPoint(0F, 15F, 6F);
centerD.setTextureSize(64, 32);
centerD.mirror = true;
setRotation(centerD, 0F, 0F, 0F);
frontDoorA = new ModelRenderer(this, 0, 25);
frontDoorA.addBox(-4F, 0F, -4F, 4, 7, 2);
frontDoorA.setRotationPoint(2F, 15F, -4F);
frontDoorA.setTextureSize(64, 32);
frontDoorA.mirror = true;
setRotation(frontDoorA, 0F, 0F, 0F);
frontDoorB = new ModelRenderer(this, 0, 25);
frontDoorB.addBox(-4F, 0F, -4F, 4, 7, 2);
frontDoorB.setRotationPoint(2F, 15F, -2F);
frontDoorB.setTextureSize(64, 32);
frontDoorB.mirror = true;
setRotation(frontDoorB, 0F, 0F, 0F);
frontDoorC = new ModelRenderer(this, 0, 25);
frontDoorC.addBox(-4F, 0F, -4F, 4, 7, 2);
frontDoorC.setRotationPoint(2F, 15F, 0F);
frontDoorC.setTextureSize(64, 32);
frontDoorC.mirror = true;
setRotation(frontDoorC, 0F, 0F, 0F);
backDoorA = new ModelRenderer(this, 0, 25);
backDoorA.addBox(-4F, 0F, -4F, 4, 7, 2);
backDoorA.setRotationPoint(2F, 15F, 10F);
backDoorA.setTextureSize(64, 32);
backDoorA.mirror = true;
setRotation(backDoorA, 0F, 0F, 0F);
backDoorB = new ModelRenderer(this, 0, 25);
backDoorB.addBox(-4F, 0F, -4F, 4, 7, 2);
backDoorB.setRotationPoint(2F, 15F, 8F);
backDoorB.setTextureSize(64, 32);
backDoorB.mirror = true;
setRotation(backDoorB, 0F, 0F, 0F);
backDoorC = new ModelRenderer(this, 0, 25);
backDoorC.addBox(-4F, 0F, -4F, 4, 7, 2);
backDoorC.setRotationPoint(2F, 15F, 6F);
backDoorC.setTextureSize(64, 32);
backDoorC.mirror = true;
setRotation(backDoorC, 0F, 0F, 0F);
leftDoorA = new ModelRenderer(this, 16, 24);
leftDoorA.addBox(4F, 0F, 6F, 2, 7, 4);
leftDoorA.setRotationPoint(2F, 15F, -8F);
leftDoorA.setTextureSize(64, 32);
leftDoorA.mirror = true;
setRotation(leftDoorA, 0F, 0F, 0F);
leftDoorB = new ModelRenderer(this, 16, 24);
leftDoorB.addBox(4F, 0F, 6F, 2, 7, 4);
leftDoorB.setRotationPoint(0F, 15F, -8F);
leftDoorB.setTextureSize(64, 32);
leftDoorB.mirror = true;
setRotation(leftDoorB, 0F, 0F, 0F);
leftDoorC = new ModelRenderer(this, 16, 24);
leftDoorC.addBox(4F, 0F, 6F, 2, 7, 4);
leftDoorC.setRotationPoint(-2F, 15F, -8F);
leftDoorC.setTextureSize(64, 32);
leftDoorC.mirror = true;
setRotation(leftDoorC, 0F, 0F, 0F);
rightDoorA = new ModelRenderer(this, 16, 24);
rightDoorA.addBox(4F, 0F, 6F, 2, 7, 4);
rightDoorA.setRotationPoint(-12F, 15F, -8F);
rightDoorA.setTextureSize(64, 32);
rightDoorA.mirror = true;
setRotation(rightDoorA, 0F, 0F, 0F);
rightDoorB = new ModelRenderer(this, 16, 24);
rightDoorB.addBox(4F, 0F, 6F, 2, 7, 4);
rightDoorB.setRotationPoint(-10F, 15F, -8F);
rightDoorB.setTextureSize(64, 32);
rightDoorB.mirror = true;
setRotation(rightDoorB, 0F, 0F, 0F);
rightDoorC = new ModelRenderer(this, 16, 24);
rightDoorC.addBox(4F, 0F, 6F, 2, 7, 4);
rightDoorC.setRotationPoint(-8F, 15F, -8F);
rightDoorC.setTextureSize(64, 32);
rightDoorC.mirror = true;
setRotation(rightDoorC, 0F, 0F, 0F);
cornerBackLeft = new ModelRenderer(this, 0, 37);
cornerBackLeft.addBox(-4F, 0F, -4F, 4, 10, 4);
cornerBackLeft.setRotationPoint(8F, 14F, 8F);
cornerBackLeft.setTextureSize(64, 32);
cornerBackLeft.mirror = true;
setRotation(cornerBackLeft, 0F, 0F, 0F);
cornerBackRight = new ModelRenderer(this, 0, 37);
cornerBackRight.addBox(-4F, 0F, -4F, 4, 10, 4);
cornerBackRight.setRotationPoint(-4F, 14F, 8F);
cornerBackRight.setTextureSize(64, 32);
cornerBackRight.mirror = true;
setRotation(cornerBackRight, 0F, 0F, 0F);
cornerFrontLeft = new ModelRenderer(this, 0, 37);
cornerFrontLeft.addBox(-4F, 0F, -4F, 4, 10, 4);
cornerFrontLeft.setRotationPoint(8F, 14F, -4F);
cornerFrontLeft.setTextureSize(64, 32);
cornerFrontLeft.mirror = true;
setRotation(cornerFrontLeft, 0F, 0F, 0F);
cornerFrontRight = new ModelRenderer(this, 0, 37);
cornerFrontRight.addBox(-4F, 0F, -4F, 4, 10, 4);
cornerFrontRight.setRotationPoint(-4F, 14F, -4F);
cornerFrontRight.setTextureSize(64, 32);
cornerFrontRight.mirror = true;
setRotation(cornerFrontRight, 0F, 0F, 0F);
}
public void render(byte side, boolean stone)
{
renderMiddle(RenderUtility.canRenderSide(side, ForgeDirection.DOWN), stone);
renderBack(RenderUtility.canRenderSide(side, ForgeDirection.NORTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderFront(RenderUtility.canRenderSide(side, ForgeDirection.SOUTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderRight(RenderUtility.canRenderSide(side, ForgeDirection.WEST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderLeft(RenderUtility.canRenderSide(side, ForgeDirection.EAST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
}
public void renderMiddle(boolean bottom, boolean corners)
{
if (bottom)
base.render(0.0625F);
centerA.render(0.0625F);
centerB.render(0.0625F);
centerC.render(0.0625F);
centerD.render(0.0625F);
if (corners)
{
cornerBackLeft.render(0.0625F);
cornerBackRight.render(0.0625F);
cornerFrontLeft.render(0.0625F);
cornerFrontRight.render(0.0625F);
}
}
public void renderLeft(PipeType type)
{
if (type != PipeType.MID_CAP)
{
leftBase.render(0.0625F);
leftBaseB.render(0.0625F);
leftB.render(0.0625F);
leftA.render(0.0625F);
if (type == PipeType.CAP || type == PipeType.SOLID)
{
leftDoorA.render(0.0625F);
if (type == PipeType.SOLID)
{
leftDoorB.render(0.0625F);
leftDoorC.render(0.0625F);
}
}
}
else
{
leftDoorC.render(0.0625F);
}
}
public void renderRight(PipeType type)
{
if (type != PipeType.MID_CAP)
{
rightBaseB.render(0.0625F);
rightBase.render(0.0625F);
rightA.render(0.0625F);
rightB.render(0.0625F);
if (type == PipeType.CAP || type == PipeType.SOLID)
{
rightDoorA.render(0.0625F);
if (type == PipeType.SOLID)
{
rightDoorB.render(0.0625F);
rightDoorC.render(0.0625F);
}
}
}
else
{
rightDoorC.render(0.0625F);
}
}
public void renderBack(PipeType type)
{
if (type != PipeType.MID_CAP)
{
backBase.render(0.0625F);
backBaseB.render(0.0625F);
backA.render(0.0625F);
backB.render(0.0625F);
if (type == PipeType.CAP || type == PipeType.SOLID)
{
backDoorA.render(0.0625F);
if (type == PipeType.SOLID)
{
backDoorB.render(0.0625F);
backDoorC.render(0.0625F);
}
}
}
else
{
backDoorC.render(0.0625F);
}
}
public void renderFront(PipeType type)
{
if (type != PipeType.MID_CAP)
{
frontBase.render(0.0625F);
frontBaseB.render(0.0625F);
frontA.render(0.0625F);
frontB.render(0.0625F);
if (type == PipeType.CAP || type == PipeType.SOLID)
{
frontDoorA.render(0.0625F);
if (type == PipeType.SOLID)
{
frontDoorB.render(0.0625F);
frontDoorC.render(0.0625F);
}
}
}
else
{
frontDoorC.render(0.0625F);
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public static enum PipeType
{
/** When there is no connection */
MID_CAP,
/** Pipe to pipe connection */
NORMAL,
/** Pipe to wall */
CAP,
/** No pipe, used only by stone through */
SOLID;
}
}

View file

@ -0,0 +1,112 @@
package resonantinduction.archaic.gutter;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import resonantinduction.core.Reference;
import resonantinduction.core.prefab.fluid.BlockFluidNetwork;
import resonantinduction.core.render.RIBlockRenderingHandler;
import universalelectricity.api.UniversalElectricity;
import calclavia.lib.utility.FluidUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Early tier version of the basic pipe. Open on the top, and can't support pressure.
*
* @author Darkguardsman
*/
public class BlockGutter extends BlockFluidNetwork
{
public BlockGutter(int id)
{
super(id, UniversalElectricity.machine);
setTextureName(Reference.PREFIX + "material_wood_surface");
}
@Override
public void addCollisionBoxesToList(World par1World, int x, int y, int z, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity entity)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
super.addCollisionBoxesToList(par1World, x, y, z, par5AxisAlignedBB, par6List, entity);
float thickness = 0.125F;
this.setBlockBounds(0.0F, 0.0F, 0.0F, thickness, 1.0F, 1.0F);
super.addCollisionBoxesToList(par1World, x, y, z, par5AxisAlignedBB, par6List, entity);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, thickness);
super.addCollisionBoxesToList(par1World, x, y, z, par5AxisAlignedBB, par6List, entity);
this.setBlockBounds(1.0F - thickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(par1World, x, y, z, par5AxisAlignedBB, par6List, entity);
this.setBlockBounds(0.0F, 0.0F, 1.0F - thickness, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(par1World, x, y, z, par5AxisAlignedBB, par6List, entity);
this.setBlockBoundsForItemRender();
}
public void setBlockBoundsForItemRender()
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@Override
public void fillWithRain(World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (!world.isRemote && tile instanceof TileGutter)
{
((TileGutter) tile).fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 10), true);
}
}
@Override
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity entity)
{
entity.attackEntityFrom(DamageSource.cactus, 1.0F);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (!world.isRemote && tile instanceof TileGutter)
{
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
}
return true;
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileGutter();
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return RIBlockRenderingHandler.ID;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
}

View file

@ -1,8 +1,11 @@
package resonantinduction.archaic.channel;
package resonantinduction.archaic.gutter;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@ -11,29 +14,35 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import resonantinduction.core.render.RenderFluidHelper;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.item.ISimpleItemRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderChannel extends TileEntitySpecialRenderer
public class RenderGutter extends TileEntitySpecialRenderer implements ISimpleItemRenderer
{
public static final RenderChannel INSTANCE = new RenderChannel();
public static final RenderGutter INSTANCE = new RenderGutter();
public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "white.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "gutter.tcn");
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "gutter.png");
public static void render(int meta, byte sides)
{
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
MODEL_TROUGH_PIPE.render(sides, meta == 0 ? true : false);
RenderUtility.bind(TEXTURE);
MODEL.renderAll();
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
FluidStack liquid = ((TileChannel) tile).getInternalTank().getFluid();
int capacity = ((TileChannel) tile).getInternalTank().getCapacity();
byte renderSides = (tile instanceof TileChannel ? ((TileChannel) tile).renderSides : (byte) 0);
TileGutter tile = ((TileGutter) tileEntity);
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FluidStack liquid = tile.getInternalTank().getFluid();
int capacity = tile.getInternalTank().getCapacity();
byte renderSides = (tile instanceof TileGutter ? tile.renderSides : (byte) 0);
if (liquid != null && liquid.amount > 0)
{
@ -48,7 +57,7 @@ public class RenderChannel extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.1F, (float) z + 0.3F);
GL11.glTranslatef((float) 0F, (float) 0F, (float) 0.3F);
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glCallList(displayList[(int) (percentage * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
@ -92,10 +101,16 @@ public class RenderChannel extends TileEntitySpecialRenderer
}
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
render(0, renderSides);
GL11.glPopMatrix();
}
@Override
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0.5, 0.5);
render(itemStack.getItemDamage(), Byte.parseByte("000011", 2));
GL11.glPopMatrix();
}
}

View file

@ -1,4 +1,4 @@
package resonantinduction.archaic.channel;
package resonantinduction.archaic.gutter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@ -15,13 +15,13 @@ import calclavia.lib.multiblock.fake.IBlockActivate;
import calclavia.lib.utility.WrenchUtility;
/** @author Darkguardsman */
public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFluidPipe
public class TileGutter extends TileFluidNetwork implements IFluidPipe
{
private boolean isExtracting = false;
private int pressure;
public TileChannel()
public TileGutter()
{
this.getInternalTank().setCapacity(1 * FluidContainerRegistry.BUCKET_VOLUME);
getInternalTank().setCapacity(FluidContainerRegistry.BUCKET_VOLUME);
}
@Override
@ -31,39 +31,10 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
if (!worldObj.isRemote)
{
if (isExtracting && getNetwork().getTank().getFluidAmount() < getNetwork().getTank().getCapacity())
{
for (int i = 0; i < this.getConnections().length; i++)
{
Object obj = this.getConnections()[i];
if (obj instanceof IFluidHandler)
{
FluidStack drain = ((IFluidHandler) obj).drain(ForgeDirection.getOrientation(i).getOpposite(), getMaxFlowRate(), true);
fill(null, drain, true);
}
}
}
}
}
@Override
public boolean onActivated(EntityPlayer player)
{
if (WrenchUtility.isUsableWrench(player, player.getCurrentEquippedItem(), xCoord, yCoord, zCoord))
{
if (!this.worldObj.isRemote)
{
isExtracting = !isExtracting;
player.addChatMessage("Pipe extraction mode: " + isExtracting);
WrenchUtility.damageWrench(player, player.getCurrentEquippedItem(), xCoord, yCoord, zCoord);
}
return true;
}
return false;
}
@Override
public void validateConnectionSide(TileEntity tileEntity, ForgeDirection side)
{
@ -71,9 +42,9 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
{
if (tileEntity instanceof IFluidPipe)
{
if (tileEntity instanceof TileChannel)
if (tileEntity instanceof TileGutter)
{
getNetwork().merge(((TileChannel) tileEntity).getNetwork());
getNetwork().merge(((TileGutter) tileEntity).getNetwork());
this.setRenderSide(side, true);
connectedBlocks[side.ordinal()] = tileEntity;
}
@ -89,7 +60,7 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
@Override
public boolean canFlow()
{
return !isExtracting;
return true;
}
@Override
@ -129,18 +100,19 @@ public class TileChannel extends TileFluidNetwork implements IBlockActivate, IFl
@Override
public int getPressure(ForgeDirection dir)
{
return 0;
}
@Override
public int getMaxFlowRate()
{
return 500;
return pressure;
}
@Override
public void setPressure(int amount)
{
pressure = amount;
}
@Override
public int getMaxFlowRate()
{
return 10;
}
}

View file

@ -0,0 +1,56 @@
package resonantinduction.archaic.piston;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import resonantinduction.core.render.RenderFluidHelper;
import calclavia.lib.render.RenderUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPiston extends TileEntitySpecialRenderer
{
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "piston.png");
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
// Angle in radians of the rotor.
float angle = 0;
float radius = 0;
// Length of piston arm
float length = 0.8f;
double beta = Math.asin((radius * Math.sin(angle)) / length);
/**
* Render Piston Arm
*/
GL11.glPushMatrix();
double pistonTranslateX = 2 * length * Math.cos(beta);
double pistonTranslateY = 2 * length * Math.sin(beta);
GL11.glTranslated(pistonTranslateX, 0, pistonTranslateY);
GL11.glRotated(Math.toDegrees(beta), 0, 0, 1);
GL11.glPopMatrix();
/**
* Render Piston Rotor
*/
GL11.glPushMatrix();
GL11.glRotated(Math.toDegrees(angle), 0, 0, 1);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}

View file

@ -1,7 +1,7 @@
package resonantinduction.mechanical;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.mechanical.fluid.pipe.ItemPipeRenderer;
import resonantinduction.mechanical.fluid.pipe.RenderPipe;
import resonantinduction.mechanical.fluid.tank.ItemTankRenderer;
import resonantinduction.mechanical.gear.RenderGear;
import resonantinduction.mechanical.gear.RenderGearShaft;
@ -14,12 +14,12 @@ public class ClientProxy extends CommonProxy
{
GlobalItemRenderer.register(Mechanical.itemGear.itemID, RenderGear.INSTANCE);
GlobalItemRenderer.register(Mechanical.itemGearShaft.itemID, RenderGearShaft.INSTANCE);
GlobalItemRenderer.register(Mechanical.itemPipe.itemID, RenderPipe.INSTANCE);
}
@Override
public void init()
{
MinecraftForgeClient.registerItemRenderer(Mechanical.blockTank.blockID, new ItemTankRenderer());
MinecraftForgeClient.registerItemRenderer(Mechanical.itemPipe.itemID, new ItemPipeRenderer());
}
}

View file

@ -1,60 +0,0 @@
package resonantinduction.mechanical.fluid.pipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ItemPipeRenderer implements IItemRenderer
{
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
GL11.glRotatef(180f, 0f, 0f, 1f);
int meta = item.getItemDamage();
if (type == ItemRenderType.ENTITY)
{
GL11.glTranslatef(-.5F, -1F, -.5F);
RenderPipe.render(meta, Byte.parseByte("001100", 2));
}
else if (type == ItemRenderType.INVENTORY)
{
GL11.glTranslatef(0F, -1F, 0F);
RenderPipe.render(meta, Byte.parseByte("001100", 2));
}
else if (type == ItemRenderType.EQUIPPED)
{
GL11.glTranslatef(-1F, -1.2F, 0.5F);
RenderPipe.render(meta, Byte.parseByte("000011", 2));
}
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(-2F, -1.5F, 0.2F);
RenderPipe.render(meta, Byte.parseByte("001100", 2));
}
else
{
RenderPipe.render(item.getItemDamage(), Byte.parseByte("000011", 2));
}
GL11.glPopMatrix();
}
}

View file

@ -1,26 +1,25 @@
package resonantinduction.mechanical.fluid.pipe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import resonantinduction.archaic.channel.ModelChannel;
import resonantinduction.archaic.channel.TileChannel;
import resonantinduction.core.Reference;
import resonantinduction.core.render.RenderFluidHelper;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.item.ISimpleItemRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPipe
public class RenderPipe implements ISimpleItemRenderer
{
public static final RenderPipe INSTANCE = new RenderPipe();
public static ModelPipe MODEL_PIPE = new ModelPipe();
public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
public void render(PartPipe part, double x, double y, double z, float f)
@ -109,4 +108,12 @@ public class RenderPipe
MODEL_PIPE.render(sides);
RenderUtility.disableBlending();
}
@Override
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glPushMatrix();
render(itemStack.getItemDamage(), Byte.parseByte("000011", 2));
GL11.glPopMatrix();
}
}

View file

@ -20,7 +20,8 @@ item.resonantinduction\:oreRubble.name=%v Rubble
### Archaic Module
## machineMaterials
tile.resonantinduction\:channel.name=Fluid Channel
tile.resonantinduction\:gutter.name=Gutter
tile.resonantinduction\:gutter.tooltip=A primitive way of transfering liquid.
tile.resonantinduction\:machineMaterial.0.name=Industrial Brick
tile.resonantinduction\:machineMaterial.1.name=Industrial Brick
tile.resonantinduction\:machineMaterial.2.name=Industrial Chiseled Brick

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB