This commit is contained in:
Calclavia 2014-02-19 21:38:04 +08:00
parent 8d29ff451e
commit 5db13056dd
31 changed files with 506 additions and 528 deletions

View file

@ -8,15 +8,15 @@ import cpw.mods.fml.client.registry.ClientRegistry;
public class ClientProxy extends CommonProxy public class ClientProxy extends CommonProxy
{ {
@Override @Override
public void preInit() public void preInit()
{ {
ClientRegistry.bindTileEntitySpecialRenderer(TileChannel.class, RenderChannel.INSTANCE); ClientRegistry.bindTileEntitySpecialRenderer(TileChannel.class, RenderChannel.INSTANCE);
} }
@Override @Override
public void init() public void init()
{ {
MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer()); MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer());
} }
} }

View file

@ -1,11 +1,8 @@
package resonantinduction.archaic; package resonantinduction.archaic;
import resonantinduction.archaic.channel.RenderChannel;
import resonantinduction.archaic.channel.TileChannel;
import calclavia.lib.prefab.ProxyBase; import calclavia.lib.prefab.ProxyBase;
import cpw.mods.fml.client.registry.ClientRegistry;
public class CommonProxy extends ProxyBase public class CommonProxy extends ProxyBase
{ {
} }

View file

@ -11,54 +11,56 @@ import calclavia.lib.utility.FluidUtility;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
/** Early tier version of the basic pipe. Open on the top, and can't support pressure. /**
* Early tier version of the basic pipe. Open on the top, and can't support pressure.
* *
* @author Darkguardsman */ * @author Darkguardsman
*/
public class BlockChannel extends BlockFluidNetwork public class BlockChannel extends BlockFluidNetwork
{ {
public BlockChannel(int id) public BlockChannel(int id)
{ {
super(id, UniversalElectricity.machine); super(id, UniversalElectricity.machine);
setTextureName(Reference.PREFIX + "material_wood_surface"); setTextureName(Reference.PREFIX + "material_wood_surface");
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
} }
@Override @Override
public TileEntity createNewTileEntity(World world) public TileEntity createNewTileEntity(World world)
{ {
return new TileChannel(); return new TileChannel();
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getRenderType() public int getRenderType()
{ {
return RIBlockRenderingHandler.ID; return RIBlockRenderingHandler.ID;
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ) 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); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (!world.isRemote && tile instanceof TileChannel) if (!world.isRemote && tile instanceof TileChannel)
{ {
if (!((TileChannel) tile).onActivated(entityplayer)) if (!((TileChannel) tile).onActivated(entityplayer))
{ {
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side); return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
} }
} }
return true; return true;
} }
} }

View file

@ -4,7 +4,6 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;

View file

@ -7,12 +7,10 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.mechanical.fluid.IFluidConnector;
import resonantinduction.api.mechanical.fluid.IFluidNetwork; import resonantinduction.api.mechanical.fluid.IFluidNetwork;
import resonantinduction.api.mechanical.fluid.IFluidPipe; import resonantinduction.api.mechanical.fluid.IFluidPipe;
import resonantinduction.core.prefab.fluid.PipeNetwork; import resonantinduction.core.prefab.fluid.PipeNetwork;
import resonantinduction.core.prefab.fluid.TileFluidNetwork; import resonantinduction.core.prefab.fluid.TileFluidNetwork;
import resonantinduction.mechanical.fluid.tank.TileTank;
import calclavia.lib.multiblock.fake.IBlockActivate; import calclavia.lib.multiblock.fake.IBlockActivate;
import calclavia.lib.utility.WrenchUtility; import calclavia.lib.utility.WrenchUtility;

View file

@ -123,7 +123,7 @@ public class TileFirebox extends TileElectricalInventory implements IPacketRecei
String name = ((TileMaterial) dustTile).name; String name = ((TileMaterial) dustTile).name;
int meta = worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord); int meta = worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord);
if (heatEnergy >= getMeltIronEnergy(((float) meta / 8f) * 1000)) if (heatEnergy >= getMeltIronEnergy((meta / 8f) * 1000))
{ {
// TODO: Make refined dust yield more molten fluid than normal dust. // TODO: Make refined dust yield more molten fluid than normal dust.
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ResourceGenerator.getFluidMaterial(name).blockID, meta, 3); worldObj.setBlock(xCoord, yCoord + 1, zCoord, ResourceGenerator.getFluidMaterial(name).blockID, meta, 3);

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;

View file

@ -3,7 +3,6 @@ package resonantinduction.electrical;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.electrical.battery.RenderBattery; import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.battery.TileBattery; import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.charger.RenderCharger; import resonantinduction.electrical.charger.RenderCharger;

View file

@ -39,6 +39,7 @@ public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleI
public static final ResourceLocation TEXTURE_CASE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "battery/bat_case_tex.png"); public static final ResourceLocation TEXTURE_CASE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "battery/bat_case_tex.png");
public static final WavefrontObject MODEL = (WavefrontObject) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "battery/battery.obj"); public static final WavefrontObject MODEL = (WavefrontObject) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "battery/battery.obj");
@Override
public void renderInventoryItem(ItemStack itemStack) public void renderInventoryItem(ItemStack itemStack)
{ {
glPushMatrix(); glPushMatrix();

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import universalelectricity.api.UniversalElectricity; import universalelectricity.api.UniversalElectricity;
@ -13,11 +12,8 @@ import universalelectricity.api.electricity.IVoltageOutput;
import universalelectricity.api.energy.EnergyStorageHandler; import universalelectricity.api.energy.EnergyStorageHandler;
import universalelectricity.api.energy.IEnergyContainer; import universalelectricity.api.energy.IEnergyContainer;
import universalelectricity.api.energy.IEnergyInterface; import universalelectricity.api.energy.IEnergyInterface;
import universalelectricity.api.net.IConnector;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender; import calclavia.lib.network.IPacketSender;
import calclavia.lib.prefab.tile.TileElectrical;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
@ -51,7 +47,7 @@ public class TileBattery extends TileEnergyDistribution implements IVoltageInput
*/ */
public static long getEnergyForTier(int tier) public static long getEnergyForTier(int tier)
{ {
return (long) Math.pow(100000000, ((float) tier / (float) (MAX_TIER + 0.25f)) + 1); return (long) Math.pow(100000000, (tier / (MAX_TIER + 0.25f)) + 1);
} }
@Override @Override

View file

@ -8,40 +8,42 @@ import universalelectricity.api.energy.UnitDisplay.Unit;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.RenderUtility; import calclavia.lib.render.RenderUtility;
/** Renderer for electric item charger /**
* Renderer for electric item charger
* *
* @author DarkGuardsman */ * @author DarkGuardsman
*/
public class RenderCharger extends RenderItemOverlayTile public class RenderCharger extends RenderItemOverlayTile
{ {
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
{ {
if (tile instanceof TileCharger) if (tile instanceof TileCharger)
{ {
Vector3 d = new Vector3(); Vector3 d = new Vector3();
switch (((TileCharger) tile).getDirection()) switch (((TileCharger) tile).getDirection())
{ {
case NORTH: case NORTH:
d.translate(0, 0, .58); d.translate(0, 0, .58);
break; break;
case SOUTH: case SOUTH:
d.translate(0, 0, -.58); d.translate(0, 0, -.58);
break; break;
case WEST: case WEST:
d.translate(.58, 0, 0); d.translate(.58, 0, 0);
break; break;
case EAST: case EAST:
d.translate(-.58, 0, 0); d.translate(-.58, 0, 0);
break; break;
} }
this.renderItemSingleSide(tile, x + d.x, y + d.y, z + d.z, ((TileCharger) tile).getStackInSlot(0), ((TileCharger) tile).getDirection(), "IDLE"); this.renderItemSingleSide(tile, x + d.x, y + d.y, z + d.z, ((TileCharger) tile).getStackInSlot(0), ((TileCharger) tile).getDirection(), "IDLE");
if (CompatibilityModule.getMaxEnergyItem(((TileCharger) tile).getStackInSlot(0)) > 0) if (CompatibilityModule.getMaxEnergyItem(((TileCharger) tile).getStackInSlot(0)) > 0)
{ {
long energy = CompatibilityModule.getEnergyItem(((TileCharger) tile).getStackInSlot(0)); long energy = CompatibilityModule.getEnergyItem(((TileCharger) tile).getStackInSlot(0));
long maxEnergy = CompatibilityModule.getMaxEnergyItem(((TileCharger) tile).getStackInSlot(0)); long maxEnergy = CompatibilityModule.getMaxEnergyItem(((TileCharger) tile).getStackInSlot(0));
RenderUtility.renderText(UnitDisplay.getDisplay(energy, Unit.JOULES,2,true) + "/" + UnitDisplay.getDisplay(maxEnergy, Unit.JOULES,2,true), ((TileCharger) tile).getDirection(), 0.02f, x + d.x, y + d.y + 0.4, z + d.z); RenderUtility.renderText(UnitDisplay.getDisplay(energy, Unit.JOULES, 2, true) + "/" + UnitDisplay.getDisplay(maxEnergy, Unit.JOULES, 2, true), ((TileCharger) tile).getDirection(), 0.02f, x + d.x, y + d.y + 0.4, z + d.z);
} }
} }
} }
} }

View file

@ -130,8 +130,8 @@ public class TileLevitator extends TileAdvanced implements IPacketReceiver, IPac
{ {
item.setEntityItemStack(remains); item.setEntityItemStack(remains);
} }
//TODO: Add redstone pulse? // TODO: Add redstone pulse?
} }
} }
} }
@ -447,11 +447,13 @@ public class TileLevitator extends TileAdvanced implements IPacketReceiver, IPac
return null; return null;
} }
@Override
public ForgeDirection getDirection() public ForgeDirection getDirection()
{ {
return ForgeDirection.getOrientation(getBlockType() != null ? getBlockMetadata() : 0); return ForgeDirection.getOrientation(getBlockType() != null ? getBlockMetadata() : 0);
} }
@Override
public void setDirection(ForgeDirection side) public void setDirection(ForgeDirection side)
{ {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, side.ordinal(), 3); this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, side.ordinal(), 3);

View file

@ -3,7 +3,6 @@ package resonantinduction.electrical.wire.flat;
import java.util.Arrays; import java.util.Arrays;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDye; import net.minecraft.item.ItemDye;
@ -20,10 +19,8 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.core.MultipartUtility; import resonantinduction.core.MultipartUtility;
import resonantinduction.electrical.wire.EnumWireMaterial; import resonantinduction.electrical.wire.EnumWireMaterial;
import resonantinduction.electrical.wire.PartAdvancedWire; import resonantinduction.electrical.wire.PartAdvancedWire;
import calclavia.lib.render.EnumColor;
import codechicken.lib.colour.Colour; import codechicken.lib.colour.Colour;
import codechicken.lib.colour.ColourARGB; import codechicken.lib.colour.ColourARGB;
import codechicken.lib.colour.ColourRGBA;
import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput; import codechicken.lib.data.MCDataOutput;
import codechicken.lib.lighting.LazyLightMatrix; import codechicken.lib.lighting.LazyLightMatrix;
@ -903,7 +900,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
color.a = (byte) 255; color.a = (byte) 255;
return color; return color;
} }
return getMaterial().color; return getMaterial().color;
} }

View file

@ -23,7 +23,6 @@ import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyNetwork; import universalelectricity.api.energy.IEnergyNetwork;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import codechicken.lib.lighting.LazyLightMatrix; import codechicken.lib.lighting.LazyLightMatrix;
import codechicken.lib.raytracer.IndexedCuboid6;
import codechicken.lib.render.CCRenderState; import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.IconTransformation; import codechicken.lib.render.IconTransformation;
import codechicken.lib.render.RenderUtils; import codechicken.lib.render.RenderUtils;
@ -34,9 +33,7 @@ import codechicken.microblock.IHollowConnect;
import codechicken.multipart.JIconHitEffects; import codechicken.multipart.JIconHitEffects;
import codechicken.multipart.JNormalOcclusion; import codechicken.multipart.JNormalOcclusion;
import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.NormalOcclusionTest;
import codechicken.multipart.PartMap; import codechicken.multipart.PartMap;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TSlottedPart; import codechicken.multipart.TSlottedPart;
import codechicken.multipart.TileMultipart; import codechicken.multipart.TileMultipart;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -101,6 +98,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
return super.activate(player, part, item); return super.activate(player, part, item);
} }
@Override
public void preparePlacement(int meta) public void preparePlacement(int meta)
{ {
this.setMaterial(meta); this.setMaterial(meta);
@ -178,6 +176,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
return RenderFramedWire.breakIcon; return RenderFramedWire.breakIcon;
} }
@Override
protected boolean canConnectTo(TileEntity tile) protected boolean canConnectTo(TileEntity tile)
{ {
return tile instanceof IConductor || this.canConnectToObj(tile); return tile instanceof IConductor || this.canConnectToObj(tile);
@ -207,6 +206,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
return false; return false;
} }
@Override
public IConductor getConnector(TileEntity tile) public IConductor getConnector(TileEntity tile)
{ {
if (tile instanceof IConductor) if (tile instanceof IConductor)

View file

@ -13,6 +13,7 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.prefab.part.PartFramedConnection;
import resonantinduction.core.render.InvertX; import resonantinduction.core.render.InvertX;
import codechicken.lib.colour.Colour; import codechicken.lib.colour.Colour;
import codechicken.lib.colour.ColourARGB; import codechicken.lib.colour.ColourARGB;
@ -115,7 +116,7 @@ public class RenderFramedWire
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{ {
if (PartFramedWire.connectionMapContainsSide(renderSides, side)) if (PartFramedConnection.connectionMapContainsSide(renderSides, side))
renderSideShine(side, wire); renderSideShine(side, wire);
} }
CCRenderState.draw(); CCRenderState.draw();
@ -150,7 +151,7 @@ public class RenderFramedWire
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{ {
if (PartFramedWire.connectionMapContainsSide(renderSides, side)) if (PartFramedConnection.connectionMapContainsSide(renderSides, side))
{ {
renderSide(side, wire); renderSide(side, wire);
} }

View file

@ -1,7 +1,5 @@
package resonantinduction.mechanical.fluid.pipe; package resonantinduction.mechanical.fluid.pipe;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;

View file

@ -13,26 +13,26 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RenderPipe public class RenderPipe
{ {
public static final RenderPipe INSTANCE = new RenderPipe(); public static final RenderPipe INSTANCE = new RenderPipe();
public static ModelPipe MODEL_PIPE = new ModelPipe(); public static ModelPipe MODEL_PIPE = new ModelPipe();
public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel(); public static ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png"); 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) public void render(PartPipe part, double x, double y, double z, float f)
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1.0F, -1F, -1F);
render(0, part.getAllCurrentConnections()); render(0, part.getAllCurrentConnections());
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public static void render(int meta, byte sides) public static void render(int meta, byte sides)
{ {
RenderUtility.enableBlending(); RenderUtility.enableBlending();
RenderUtility.bind(TEXTURE); RenderUtility.bind(TEXTURE);
MODEL_PIPE.render(sides); MODEL_PIPE.render(sides);
RenderUtility.disableBlending(); RenderUtility.disableBlending();
} }
} }

View file

@ -22,118 +22,118 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockTank extends BlockFluidNetwork public class BlockTank extends BlockFluidNetwork
{ {
public BlockTank(int id) public BlockTank(int id)
{ {
super(id, UniversalElectricity.machine); super(id, UniversalElectricity.machine);
setHardness(1f); setHardness(1f);
setResistance(5f); setResistance(5f);
} }
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean renderAsNormalBlock() public boolean renderAsNormalBlock()
{ {
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getRenderType() public int getRenderType()
{ {
return RIBlockRenderingHandler.ID; return RIBlockRenderingHandler.ID;
} }
@Override @Override
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side)
{ {
int checkBlockID = blockAccess.getBlockId(x, y, z); int checkBlockID = blockAccess.getBlockId(x, y, z);
return super.shouldSideBeRendered(blockAccess, x, y, z, side); return super.shouldSideBeRendered(blockAccess, x, y, z, side);
} }
@Override @Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ) public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side); return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
} }
return true; return true;
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) public TileEntity createNewTileEntity(World var1)
{ {
return new TileTank(); return new TileTank();
} }
@Override @Override
public boolean hasComparatorInputOverride() public boolean hasComparatorInputOverride()
{ {
return true; return true;
} }
@Override @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int par5) public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
{ {
TileTank tileEntity = (TileTank) world.getBlockTileEntity(x, y, z); TileTank tileEntity = (TileTank) world.getBlockTileEntity(x, y, z);
if (tileEntity != null && tileEntity.getNetwork().getTank().getFluid() != null) if (tileEntity != null && tileEntity.getNetwork().getTank().getFluid() != null)
{ {
return 15 * (tileEntity.getNetwork().getTank().getFluidAmount() / tileEntity.getNetwork().getTank().getCapacity()); return 15 * (tileEntity.getNetwork().getTank().getFluidAmount() / tileEntity.getNetwork().getTank().getCapacity());
} }
return 0; return 0;
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{ {
return new ItemStack(this, 1, 0); return new ItemStack(this, 1, 0);
} }
@Override @Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
{ {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>(); ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
TileEntity entity = world.getBlockTileEntity(x, y, z); TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof TileTank) if (entity instanceof TileTank)
{ {
ret.add(new ItemStack(this, 1, 0)); ret.add(new ItemStack(this, 1, 0));
} }
return ret; return ret;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{ {
par3List.add(new ItemStack(this, 1, 0)); par3List.add(new ItemStack(this, 1, 0));
} }
@Override @Override
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
ItemStack dropStack = ItemBlockFluidContainer.getWrenchedItem(world, new Vector3(x, y, z)); ItemStack dropStack = ItemBlockFluidContainer.getWrenchedItem(world, new Vector3(x, y, z));
if (dropStack != null) if (dropStack != null)
{ {
if (entityPlayer.getHeldItem() == null) if (entityPlayer.getHeldItem() == null)
{ {
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, dropStack); entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, dropStack);
} }
else else
{ {
InventoryUtility.dropItemStack(world, new Vector3(x, y, z), dropStack); InventoryUtility.dropItemStack(world, new Vector3(x, y, z), dropStack);
} }
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
} }
} }
return true; return true;
} }
} }

View file

@ -3,7 +3,6 @@ package resonantinduction.mechanical.gear;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.multiblock.reference.IMultiBlockStructure;
import calclavia.lib.multiblock.reference.MultiBlockHandler; import calclavia.lib.multiblock.reference.MultiBlockHandler;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart; import codechicken.multipart.TileMultipart;

View file

@ -9,7 +9,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;

View file

@ -79,7 +79,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
if (adjacentMech != null && adjacent != mechanical) if (adjacentMech != null && adjacent != mechanical)
{ {
//System.out.println("UPDATING: " + mechanical + " with " + adjacentMech); // System.out.println("UPDATING: " + mechanical + " with " + adjacentMech);
float ratio = adjacentMech.getRatio(dir.getOpposite(), mechanical) / mechanical.getRatio(dir, adjacentMech); float ratio = adjacentMech.getRatio(dir.getOpposite(), mechanical) / mechanical.getRatio(dir, adjacentMech);
long torque = mechanical.getTorque(); long torque = mechanical.getTorque();

View file

@ -52,7 +52,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte
{ {
glPushMatrix(); glPushMatrix();
GL11.glScalef(0.5f, 0.5f, 0.5f); GL11.glScalef(0.5f, 0.5f, 0.5f);
glTranslatef((float) 0.5F, (float) 0.5f, (float) 1.5F); glTranslatef(0.5F, 0.5f, 1.5F);
RenderUtility.bind(TEXTURE); RenderUtility.bind(TEXTURE);
MODEL.renderAll(); MODEL.renderAll();
glPopMatrix(); glPopMatrix();

View file

@ -20,6 +20,7 @@ public class BlockWindTurbine extends BlockTurbine
rotationMask = Byte.parseByte("111111", 2); rotationMask = Byte.parseByte("111111", 2);
} }
@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
if (entityPlayer.getCurrentEquippedItem() == null) if (entityPlayer.getCurrentEquippedItem() == null)
@ -41,6 +42,7 @@ public class BlockWindTurbine extends BlockTurbine
return false; return false;
} }
@Override
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z); TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

View file

@ -1,18 +1,6 @@
package resonantinduction.mechanical.turbine; package resonantinduction.mechanical.turbine;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.api.mechanical.IMechanical;
import resonantinduction.api.mechanical.IMechanicalNetwork;
import resonantinduction.core.ResonantInduction;
import resonantinduction.mechanical.gear.PartGearShaft;
import resonantinduction.mechanical.network.MechanicalNetwork;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.prefab.turbine.TileTurbine;
/** /**
* The vertical wind turbine collects airflow. * The vertical wind turbine collects airflow.

View file

@ -3,7 +3,6 @@ package resonantinduction.mechanical.turbine;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenOcean; import net.minecraft.world.biome.BiomeGenOcean;
import net.minecraft.world.biome.BiomeGenPlains; import net.minecraft.world.biome.BiomeGenPlains;
import net.minecraftforge.common.ForgeDirection;
/** /**
* The vertical wind turbine collects airflow. * The vertical wind turbine collects airflow.

View file

@ -8,32 +8,32 @@ import calclavia.lib.prefab.block.BlockTile;
/** @author Calclavia */ /** @author Calclavia */
public abstract class BlockFluidNetwork extends BlockTile public abstract class BlockFluidNetwork extends BlockTile
{ {
public BlockFluidNetwork(int id, Material material) public BlockFluidNetwork(int id, Material material)
{ {
super(id, material); super(id, material);
} }
@Override @Override
public void onBlockAdded(World world, int x, int y, int z) public void onBlockAdded(World world, int x, int y, int z)
{ {
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileFluidNetwork) if (tile instanceof TileFluidNetwork)
{ {
((TileFluidNetwork) tile).refresh(); ((TileFluidNetwork) tile).refresh();
((TileFluidNetwork) tile).getNetwork().reconstruct(); ((TileFluidNetwork) tile).getNetwork().reconstruct();
} }
} }
@Override @Override
public void onNeighborBlockChange(World world, int x, int y, int z, int par5) public void onNeighborBlockChange(World world, int x, int y, int z, int par5)
{ {
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileFluidNetwork) if (tile instanceof TileFluidNetwork)
{ {
((TileFluidNetwork) tile).refresh(); ((TileFluidNetwork) tile).refresh();
} }
} }
} }

View file

@ -38,7 +38,7 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
@Override @Override
public void update() public void update()
{ {
//TODO change to distribute fluid // TODO change to distribute fluid
} }
@Override @Override

View file

@ -26,109 +26,109 @@ import calclavia.lib.utility.LanguageUtility;
/** @author Darkguardsman */ /** @author Darkguardsman */
public class ItemBlockFluidContainer extends ItemBlock public class ItemBlockFluidContainer extends ItemBlock
{ {
public ItemBlockFluidContainer(int id) public ItemBlockFluidContainer(int id)
{ {
super(id); super(id);
this.setMaxDamage(0); this.setMaxDamage(0);
this.setHasSubtypes(true); this.setHasSubtypes(true);
} }
@Override @Override
public int getMetadata(int damage) public int getMetadata(int damage)
{ {
return damage; return damage;
} }
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{ {
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid")) if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
{ {
FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")); FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid"));
if (fluid != null) if (fluid != null)
{ {
list.add("Fluid: " + fluid.getFluid().getLocalizedName()); list.add("Fluid: " + fluid.getFluid().getLocalizedName());
list.add("Volume: " + UnitDisplay.getDisplay(fluid.amount, Unit.LITER, UnitPrefix.MILLI)); list.add("Volume: " + UnitDisplay.getDisplay(fluid.amount, Unit.LITER, UnitPrefix.MILLI));
} }
} }
} }
public static ItemStack getWrenchedItem(World world, Vector3 vec) public static ItemStack getWrenchedItem(World world, Vector3 vec)
{ {
TileEntity entity = vec.getTileEntity(world); TileEntity entity = vec.getTileEntity(world);
if (entity instanceof TileTank && ((TileTank) entity).getInternalTank() != null && ((TileTank) entity).getInternalTank().getFluid() != null) if (entity instanceof TileTank && ((TileTank) entity).getInternalTank() != null && ((TileTank) entity).getInternalTank().getFluid() != null)
{ {
ItemStack itemStack = new ItemStack(Mechanical.blockTank); ItemStack itemStack = new ItemStack(Mechanical.blockTank);
FluidStack stack = ((TileTank) entity).getInternalTank().getFluid(); FluidStack stack = ((TileTank) entity).getInternalTank().getFluid();
if (itemStack.getTagCompound() == null) if (itemStack.getTagCompound() == null)
{ {
itemStack.setTagCompound(new NBTTagCompound()); itemStack.setTagCompound(new NBTTagCompound());
} }
if (stack != null) if (stack != null)
{ {
((TileTank) entity).drain(ForgeDirection.UNKNOWN, stack.amount, true); ((TileTank) entity).drain(ForgeDirection.UNKNOWN, stack.amount, true);
itemStack.getTagCompound().setCompoundTag("fluid", stack.writeToNBT(new NBTTagCompound())); itemStack.getTagCompound().setCompoundTag("fluid", stack.writeToNBT(new NBTTagCompound()));
} }
return itemStack; return itemStack;
} }
return null; return null;
} }
@Override @Override
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5) public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5)
{ {
if (entity instanceof EntityPlayer) if (entity instanceof EntityPlayer)
{ {
EntityPlayer player = (EntityPlayer) entity; EntityPlayer player = (EntityPlayer) entity;
if (itemStack.getTagCompound() != null && !player.capabilities.isCreativeMode && itemStack.getTagCompound().hasKey("fluid")) if (itemStack.getTagCompound() != null && !player.capabilities.isCreativeMode && itemStack.getTagCompound().hasKey("fluid"))
{ {
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0)); player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0));
} }
} }
} }
@Override @Override
public int getItemStackLimit(ItemStack stack) public int getItemStackLimit(ItemStack stack)
{ {
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid")) if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
{ {
return 1; return 1;
} }
return this.maxStackSize; return this.maxStackSize;
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) public String getUnlocalizedName(ItemStack itemStack)
{ {
String translation = LanguageUtility.getLocal(Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage()); String translation = LanguageUtility.getLocal(Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage());
if (translation == null || translation.isEmpty()) if (translation == null || translation.isEmpty())
{ {
return Block.blocksList[this.getBlockID()].getUnlocalizedName(); return Block.blocksList[this.getBlockID()].getUnlocalizedName();
} }
return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage(); return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage();
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
{ {
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (metadata / EnumPipeMaterial.spacing))) if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (metadata / EnumPipeMaterial.spacing)))
{ {
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileFluidNetwork) if (tile instanceof TileFluidNetwork)
{ {
((TileFluidNetwork) tile).setSubID(stack.getItemDamage()); ((TileFluidNetwork) tile).setSubID(stack.getItemDamage());
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid")) if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
{ {
((TileFluidNetwork) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true); ((TileFluidNetwork) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
} }
} }
return true; return true;
} }
return false; return false;
} }
} }

View file

@ -18,7 +18,6 @@ import resonantinduction.api.IInformation;
import resonantinduction.api.mechanical.fluid.IFluidConnector; import resonantinduction.api.mechanical.fluid.IFluidConnector;
import resonantinduction.api.mechanical.fluid.IFluidNetwork; import resonantinduction.api.mechanical.fluid.IFluidNetwork;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import resonantinduction.mechanical.Mechanical;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiverWithID; import calclavia.lib.network.IPacketReceiverWithID;
import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketHandler;

View file

@ -27,199 +27,199 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer
{ {
private static final ForgeDirection[] forge_sides = { ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST }; private static final ForgeDirection[] forge_sides = { ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.EAST };
private final RenderBlocks renderBlocks; private final RenderBlocks renderBlocks;
private final RenderItem renderItem; private final RenderItem renderItem;
public RenderItemOverlayTile() public RenderItemOverlayTile()
{ {
super(); super();
renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class)); renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
renderBlocks = new RenderBlocks(); renderBlocks = new RenderBlocks();
} }
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, double x, double y, double z) public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, double x, double y, double z)
{ {
renderTopOverlay(tileEntity, inventory, dir, 3, 3, x, y, z); renderTopOverlay(tileEntity, inventory, dir, 3, 3, x, y, z);
} }
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, int matrixX, int matrixZ, double x, double y, double z) public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, int matrixX, int matrixZ, double x, double y, double z)
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
/** Render the Crafting Matrix */ /** Render the Crafting Matrix */
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
boolean isLooking = false; boolean isLooking = false;
MovingObjectPosition objectPosition = player.rayTrace(8, 1); MovingObjectPosition objectPosition = player.rayTrace(8, 1);
if (objectPosition != null) if (objectPosition != null)
{ {
isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord; isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord;
} }
for (int i = 0; i < (matrixX * matrixZ); i++) for (int i = 0; i < (matrixX * matrixZ); i++)
{ {
if (inventory[i] != null) if (inventory[i] != null)
{ {
Vector3 translation = new Vector3((double) (i / matrixX) / ((double) matrixX) + (0.5 / (matrixX)), 1.1, (double) (i % matrixZ) / ((double) matrixZ) + (0.5 / (matrixZ))).translate(-0.5); Vector3 translation = new Vector3((double) (i / matrixX) / ((double) matrixX) + (0.5 / (matrixX)), 1.1, (double) (i % matrixZ) / ((double) matrixZ) + (0.5 / (matrixZ))).translate(-0.5);
translation.scale(0.9); translation.scale(0.9);
translation.translate(0, 0, 0.06); translation.translate(0, 0, 0.06);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(x + 0.5f, y + 0.5f, z + 0.5f); GL11.glTranslated(x + 0.5f, y + 0.5f, z + 0.5f);
RenderUtility.rotateBlockBasedOnDirection(dir); RenderUtility.rotateBlockBasedOnDirection(dir);
GL11.glTranslated(translation.x, translation.y, translation.z); GL11.glTranslated(translation.x, translation.y, translation.z);
GL11.glScalef(0.7f, 0.7f, 0.7f); GL11.glScalef(0.7f, 0.7f, 0.7f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
this.renderItem(tileEntity.worldObj, ForgeDirection.UP, inventory[i], new Vector3(0, 0, 0), 0, 1); this.renderItem(tileEntity.worldObj, ForgeDirection.UP, inventory[i], new Vector3(0, 0, 0), 0, 1);
GL11.glPopMatrix(); GL11.glPopMatrix();
if (isLooking) if (isLooking)
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(x, y, z); GL11.glTranslated(x, y, z);
int angle = WorldUtility.getAngleFromForgeDirection(WorldUtility.invertX(dir)); int angle = WorldUtility.getAngleFromForgeDirection(WorldUtility.invertX(dir));
RenderUtility.renderFloatingText("" + inventory[i].stackSize, translation.rotate(angle, Vector3.UP()).translate(0.5).translate(0, 0.3, 0)); RenderUtility.renderFloatingText("" + inventory[i].stackSize, translation.rotate(angle, Vector3.UP()).translate(0.5).translate(0, 0.3, 0));
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
} }
} }
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z) public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z)
{ {
renderItemOnSides(tile, itemStack, x, y, z, "No Output"); renderItemOnSides(tile, itemStack, x, y, z, "No Output");
} }
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z, String renderText)
{
/** Render the Output */
String amount = "";
if (itemStack != null) public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z, String renderText)
{ {
renderText = itemStack.getDisplayName(); /** Render the Output */
amount = Integer.toString(itemStack.stackSize); String amount = "";
}
for (ForgeDirection direction : forge_sides) if (itemStack != null)
{ {
if (tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite())) renderText = itemStack.getDisplayName();
{ amount = Integer.toString(itemStack.stackSize);
continue; }
}
this.renderItemOnSide(tile, itemStack, direction, x, y, z, renderText, amount);
RenderUtility.renderText(renderText, direction, 0.02f, x, y - 0.35f, z);
RenderUtility.renderText(amount, direction, 0.02f, x, y - 0.15f, z);
}
}
protected void renderItemSingleSide(TileEntity tile, double x, double y, double z, ItemStack itemStack, ForgeDirection direction, String renderText) for (ForgeDirection direction : forge_sides)
{ {
if (!tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite())) if (tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
{ {
String amount = ""; continue;
}
this.renderItemOnSide(tile, itemStack, direction, x, y, z, renderText, amount);
RenderUtility.renderText(renderText, direction, 0.02f, x, y - 0.35f, z);
RenderUtility.renderText(amount, direction, 0.02f, x, y - 0.15f, z);
}
}
if (itemStack != null) protected void renderItemSingleSide(TileEntity tile, double x, double y, double z, ItemStack itemStack, ForgeDirection direction, String renderText)
{ {
renderText = itemStack.getDisplayName(); if (!tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
amount = Integer.toString(itemStack.stackSize); {
} String amount = "";
this.renderItemOnSide(tile, itemStack, direction, x, y, z, renderText, amount); if (itemStack != null)
RenderUtility.renderText(renderText, direction, 0.02f, x, y - 0.35f, z); {
RenderUtility.renderText(amount, direction, 0.02f, x, y - 0.15f, z); renderText = itemStack.getDisplayName();
amount = Integer.toString(itemStack.stackSize);
}
} this.renderItemOnSide(tile, itemStack, direction, x, y, z, renderText, amount);
} RenderUtility.renderText(renderText, direction, 0.02f, x, y - 0.35f, z);
RenderUtility.renderText(amount, direction, 0.02f, x, y - 0.15f, z);
protected void renderItemOnSide(TileEntity tile, ItemStack itemStack, ForgeDirection direction, double x, double y, double z, String renderText, String amount) }
{ }
this.setupLight(tile, direction.offsetX, direction.offsetZ); protected void renderItemOnSide(TileEntity tile, ItemStack itemStack, ForgeDirection direction, double x, double y, double z, String renderText, String amount)
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); {
if (itemStack != null) this.setupLight(tile, direction.offsetX, direction.offsetZ);
{ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GL11.glPushMatrix();
switch (direction) if (itemStack != null)
{ {
case NORTH: GL11.glPushMatrix();
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
break;
case SOUTH:
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
GL11.glRotatef(180, 0, 1, 0);
break;
case WEST:
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
GL11.glRotatef(90, 0, 1, 0);
break;
case EAST:
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
GL11.glRotatef(-90, 0, 1, 0);
break;
}
float scale = 0.03125F; switch (direction)
GL11.glScalef(0.6f * scale, 0.6f * scale, -0.00001f); {
GL11.glRotatef(180, 0, 0, 1); case NORTH:
GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01);
break;
case SOUTH:
GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01);
GL11.glRotatef(180, 0, 1, 0);
break;
case WEST:
GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35);
GL11.glRotatef(90, 0, 1, 0);
break;
case EAST:
GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65);
GL11.glRotatef(-90, 0, 1, 0);
break;
}
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; float scale = 0.03125F;
GL11.glScalef(0.6f * scale, 0.6f * scale, -0.00001f);
GL11.glRotatef(180, 0, 0, 1);
GL11.glDisable(2896); TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F)) GL11.glDisable(2896);
{
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
}
GL11.glEnable(2896); if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F))
GL11.glPopMatrix(); {
} renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
} }
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference) GL11.glEnable(2896);
{ GL11.glPopMatrix();
World world = tileEntity.worldObj; }
}
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference)) private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
{ {
return; World world = tileEntity.worldObj;
}
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0); if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference))
int var11 = br % 65536; {
int var12 = br / 65536; return;
float scale = 0.6F; }
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
}
private void renderItem(World world, ForgeDirection dir, ItemStack itemStack, Vector3 position, float rotationYaw, int angle) int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
{ int var11 = br % 65536;
if (itemStack != null) int var12 = br / 65536;
{ float scale = 0.6F;
EntityItem entityItem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemStack.copy()); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
entityItem.getEntityItem().stackSize = 1; }
entityItem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslated(-0.453125F * dir.offsetX + position.x, position.y, -0.453125F * dir.offsetZ + position.z);
GL11.glRotatef(180.0F + rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90 * angle, 1, 0, 0);
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class)); private void renderItem(World world, ForgeDirection dir, ItemStack itemStack, Vector3 position, float rotationYaw, int angle)
{
if (itemStack != null)
{
EntityItem entityItem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemStack.copy());
entityItem.getEntityItem().stackSize = 1;
entityItem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslated(-0.453125F * dir.offsetX + position.x, position.y, -0.453125F * dir.offsetZ + position.z);
GL11.glRotatef(180.0F + rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90 * angle, 1, 0, 0);
boolean fancyGraphics = RenderManager.instance.options.fancyGraphics; RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
RenderManager.instance.options.fancyGraphics = true;
renderItem.doRenderItem(entityItem, 0, 0, 0, 0, 0);
RenderManager.instance.options.fancyGraphics = fancyGraphics;
GL11.glPopMatrix(); boolean fancyGraphics = RenderManager.instance.options.fancyGraphics;
} RenderManager.instance.options.fancyGraphics = true;
} renderItem.doRenderItem(entityItem, 0, 0, 0, 0, 0);
RenderManager.instance.options.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
}
} }

View file

@ -14,6 +14,7 @@ import resonantinduction.core.resource.TileMaterial;
/** /**
* NO-OP. Not yet properly implemented. We're not using TEs for now. * NO-OP. Not yet properly implemented. We're not using TEs for now.
*
* @author Calclavia * @author Calclavia
* *
*/ */