Clean up
This commit is contained in:
parent
8d29ff451e
commit
5db13056dd
31 changed files with 506 additions and 528 deletions
|
@ -8,15 +8,15 @@ 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 preInit()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileChannel.class, RenderChannel.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer());
|
||||
}
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
MinecraftForgeClient.registerItemRenderer(Archaic.blockChannel.blockID, new ItemChannelRenderer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package resonantinduction.archaic;
|
||||
|
||||
import resonantinduction.archaic.channel.RenderChannel;
|
||||
import resonantinduction.archaic.channel.TileChannel;
|
||||
import calclavia.lib.prefab.ProxyBase;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class CommonProxy extends ProxyBase
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,54 +11,56 @@ 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.
|
||||
/**
|
||||
* 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 BlockChannel(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setTextureName(Reference.PREFIX + "material_wood_surface");
|
||||
}
|
||||
public BlockChannel(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setTextureName(Reference.PREFIX + "material_wood_surface");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileChannel();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ 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.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
|
|
@ -7,12 +7,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidConnector;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidNetwork;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidPipe;
|
||||
import resonantinduction.core.prefab.fluid.PipeNetwork;
|
||||
import resonantinduction.core.prefab.fluid.TileFluidNetwork;
|
||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||
import calclavia.lib.multiblock.fake.IBlockActivate;
|
||||
import calclavia.lib.utility.WrenchUtility;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TileFirebox extends TileElectricalInventory implements IPacketRecei
|
|||
String name = ((TileMaterial) dustTile).name;
|
||||
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.
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ResourceGenerator.getFluidMaterial(name).blockID, meta, 3);
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.Reference;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
|
|
@ -3,7 +3,6 @@ package resonantinduction.electrical;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import resonantinduction.electrical.battery.RenderBattery;
|
||||
import resonantinduction.electrical.battery.TileBattery;
|
||||
import resonantinduction.electrical.charger.RenderCharger;
|
||||
|
|
|
@ -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 WavefrontObject MODEL = (WavefrontObject) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "battery/battery.obj");
|
||||
|
||||
@Override
|
||||
public void renderInventoryItem(ItemStack itemStack)
|
||||
{
|
||||
glPushMatrix();
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
|
@ -13,11 +12,8 @@ import universalelectricity.api.electricity.IVoltageOutput;
|
|||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
import universalelectricity.api.net.IConnector;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
import calclavia.lib.network.IPacketSender;
|
||||
import calclavia.lib.prefab.tile.TileElectrical;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -51,7 +47,7 @@ public class TileBattery extends TileEnergyDistribution implements IVoltageInput
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -8,40 +8,42 @@ import universalelectricity.api.energy.UnitDisplay.Unit;
|
|||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
|
||||
/** Renderer for electric item charger
|
||||
/**
|
||||
* Renderer for electric item charger
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
* @author DarkGuardsman
|
||||
*/
|
||||
public class RenderCharger extends RenderItemOverlayTile
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
|
||||
{
|
||||
if (tile instanceof TileCharger)
|
||||
{
|
||||
Vector3 d = new Vector3();
|
||||
switch (((TileCharger) tile).getDirection())
|
||||
{
|
||||
case NORTH:
|
||||
d.translate(0, 0, .58);
|
||||
break;
|
||||
case SOUTH:
|
||||
d.translate(0, 0, -.58);
|
||||
break;
|
||||
case WEST:
|
||||
d.translate(.58, 0, 0);
|
||||
break;
|
||||
case EAST:
|
||||
d.translate(-.58, 0, 0);
|
||||
break;
|
||||
}
|
||||
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)
|
||||
{
|
||||
long energy = CompatibilityModule.getEnergyItem(((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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
|
||||
{
|
||||
if (tile instanceof TileCharger)
|
||||
{
|
||||
Vector3 d = new Vector3();
|
||||
switch (((TileCharger) tile).getDirection())
|
||||
{
|
||||
case NORTH:
|
||||
d.translate(0, 0, .58);
|
||||
break;
|
||||
case SOUTH:
|
||||
d.translate(0, 0, -.58);
|
||||
break;
|
||||
case WEST:
|
||||
d.translate(.58, 0, 0);
|
||||
break;
|
||||
case EAST:
|
||||
d.translate(-.58, 0, 0);
|
||||
break;
|
||||
}
|
||||
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)
|
||||
{
|
||||
long energy = CompatibilityModule.getEnergyItem(((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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,8 +130,8 @@ public class TileLevitator extends TileAdvanced implements IPacketReceiver, IPac
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(getBlockType() != null ? getBlockMetadata() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(ForgeDirection side)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, side.ordinal(), 3);
|
||||
|
|
|
@ -3,7 +3,6 @@ package resonantinduction.electrical.wire.flat;
|
|||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDye;
|
||||
|
@ -20,10 +19,8 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonantinduction.core.MultipartUtility;
|
||||
import resonantinduction.electrical.wire.EnumWireMaterial;
|
||||
import resonantinduction.electrical.wire.PartAdvancedWire;
|
||||
import calclavia.lib.render.EnumColor;
|
||||
import codechicken.lib.colour.Colour;
|
||||
import codechicken.lib.colour.ColourARGB;
|
||||
import codechicken.lib.colour.ColourRGBA;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
|
@ -903,7 +900,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
color.a = (byte) 255;
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
return getMaterial().color;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import universalelectricity.api.energy.IConductor;
|
|||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.lib.lighting.LazyLightMatrix;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.IconTransformation;
|
||||
import codechicken.lib.render.RenderUtils;
|
||||
|
@ -34,9 +33,7 @@ import codechicken.microblock.IHollowConnect;
|
|||
import codechicken.multipart.JIconHitEffects;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.NormalOcclusionTest;
|
||||
import codechicken.multipart.PartMap;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TSlottedPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -101,6 +98,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
|
|||
return super.activate(player, part, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
|
@ -178,6 +176,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
|
|||
return RenderFramedWire.breakIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canConnectTo(TileEntity tile)
|
||||
{
|
||||
return tile instanceof IConductor || this.canConnectToObj(tile);
|
||||
|
@ -207,6 +206,7 @@ public class PartFramedWire extends PartFramedConnection<EnumWireMaterial, ICond
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConductor getConnector(TileEntity tile)
|
||||
{
|
||||
if (tile instanceof IConductor)
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.lwjgl.BufferUtils;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.prefab.part.PartFramedConnection;
|
||||
import resonantinduction.core.render.InvertX;
|
||||
import codechicken.lib.colour.Colour;
|
||||
import codechicken.lib.colour.ColourARGB;
|
||||
|
@ -115,7 +116,7 @@ public class RenderFramedWire
|
|||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (PartFramedWire.connectionMapContainsSide(renderSides, side))
|
||||
if (PartFramedConnection.connectionMapContainsSide(renderSides, side))
|
||||
renderSideShine(side, wire);
|
||||
}
|
||||
CCRenderState.draw();
|
||||
|
@ -150,7 +151,7 @@ public class RenderFramedWire
|
|||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (PartFramedWire.connectionMapContainsSide(renderSides, side))
|
||||
if (PartFramedConnection.connectionMapContainsSide(renderSides, side))
|
||||
{
|
||||
renderSide(side, wire);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package resonantinduction.mechanical.fluid.pipe;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
|
|
@ -13,26 +13,26 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
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 ModelChannel MODEL_TROUGH_PIPE = new ModelChannel();
|
||||
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
|
||||
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)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
render(0, part.getAllCurrentConnections());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
public void render(PartPipe part, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
render(0, part.getAllCurrentConnections());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void render(int meta, byte sides)
|
||||
{
|
||||
RenderUtility.enableBlending();
|
||||
RenderUtility.bind(TEXTURE);
|
||||
MODEL_PIPE.render(sides);
|
||||
RenderUtility.disableBlending();
|
||||
}
|
||||
public static void render(int meta, byte sides)
|
||||
{
|
||||
RenderUtility.enableBlending();
|
||||
RenderUtility.bind(TEXTURE);
|
||||
MODEL_PIPE.render(sides);
|
||||
RenderUtility.disableBlending();
|
||||
}
|
||||
}
|
|
@ -22,118 +22,118 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockTank extends BlockFluidNetwork
|
||||
{
|
||||
public BlockTank(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setHardness(1f);
|
||||
setResistance(5f);
|
||||
}
|
||||
public BlockTank(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setHardness(1f);
|
||||
setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
int checkBlockID = blockAccess.getBlockId(x, y, z);
|
||||
return super.shouldSideBeRendered(blockAccess, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||
{
|
||||
int checkBlockID = blockAccess.getBlockId(x, y, z);
|
||||
return super.shouldSideBeRendered(blockAccess, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileTank();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
|
||||
{
|
||||
TileTank tileEntity = (TileTank) world.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity.getNetwork().getTank().getFluid() != null)
|
||||
{
|
||||
return 15 * (tileEntity.getNetwork().getTank().getFluidAmount() / tileEntity.getNetwork().getTank().getCapacity());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int par5)
|
||||
{
|
||||
TileTank tileEntity = (TileTank) world.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity.getNetwork().getTank().getFluid() != null)
|
||||
{
|
||||
return 15 * (tileEntity.getNetwork().getTank().getFluidAmount() / tileEntity.getNetwork().getTank().getCapacity());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(this, 1, 0);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
return new ItemStack(this, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
TileEntity entity = world.getBlockTileEntity(x, y, z);
|
||||
if (entity instanceof TileTank)
|
||||
{
|
||||
ret.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
TileEntity entity = world.getBlockTileEntity(x, y, z);
|
||||
if (entity instanceof TileTank)
|
||||
{
|
||||
ret.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(this, 1, 0));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
ItemStack dropStack = ItemBlockFluidContainer.getWrenchedItem(world, new Vector3(x, y, z));
|
||||
if (dropStack != null)
|
||||
{
|
||||
if (entityPlayer.getHeldItem() == null)
|
||||
{
|
||||
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, dropStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryUtility.dropItemStack(world, new Vector3(x, y, z), dropStack);
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
ItemStack dropStack = ItemBlockFluidContainer.getWrenchedItem(world, new Vector3(x, y, z));
|
||||
if (dropStack != null)
|
||||
{
|
||||
if (entityPlayer.getHeldItem() == null)
|
||||
{
|
||||
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, dropStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryUtility.dropItemStack(world, new Vector3(x, y, z), dropStack);
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package resonantinduction.mechanical.gear;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.multiblock.reference.IMultiBlockStructure;
|
||||
import calclavia.lib.multiblock.reference.MultiBlockHandler;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
|
|
@ -79,7 +79,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
|
|||
|
||||
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);
|
||||
long torque = mechanical.getTorque();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte
|
|||
{
|
||||
glPushMatrix();
|
||||
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);
|
||||
MODEL.renderAll();
|
||||
glPopMatrix();
|
||||
|
|
|
@ -20,6 +20,7 @@ public class BlockWindTurbine extends BlockTurbine
|
|||
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)
|
||||
{
|
||||
if (entityPlayer.getCurrentEquippedItem() == null)
|
||||
|
@ -41,6 +42,7 @@ public class BlockWindTurbine extends BlockTurbine
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
package resonantinduction.mechanical.turbine;
|
||||
|
||||
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.
|
||||
|
|
|
@ -3,7 +3,6 @@ package resonantinduction.mechanical.turbine;
|
|||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.BiomeGenOcean;
|
||||
import net.minecraft.world.biome.BiomeGenPlains;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* The vertical wind turbine collects airflow.
|
||||
|
|
|
@ -8,32 +8,32 @@ import calclavia.lib.prefab.block.BlockTile;
|
|||
/** @author Calclavia */
|
||||
public abstract class BlockFluidNetwork extends BlockTile
|
||||
{
|
||||
public BlockFluidNetwork(int id, Material material)
|
||||
{
|
||||
super(id, material);
|
||||
}
|
||||
public BlockFluidNetwork(int id, Material material)
|
||||
{
|
||||
super(id, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).refresh();
|
||||
((TileFluidNetwork) tile).getNetwork().reconstruct();
|
||||
}
|
||||
}
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).refresh();
|
||||
((TileFluidNetwork) tile).getNetwork().reconstruct();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int par5)
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, int par5)
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).refresh();
|
||||
}
|
||||
}
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public abstract class FluidNetwork extends NodeNetwork<IFluidNetwork, IFluidConn
|
|||
@Override
|
||||
public void update()
|
||||
{
|
||||
//TODO change to distribute fluid
|
||||
// TODO change to distribute fluid
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,109 +26,109 @@ import calclavia.lib.utility.LanguageUtility;
|
|||
/** @author Darkguardsman */
|
||||
public class ItemBlockFluidContainer extends ItemBlock
|
||||
{
|
||||
public ItemBlockFluidContainer(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
public ItemBlockFluidContainer(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid"));
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid"));
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
list.add("Fluid: " + fluid.getFluid().getLocalizedName());
|
||||
list.add("Volume: " + UnitDisplay.getDisplay(fluid.amount, Unit.LITER, UnitPrefix.MILLI));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fluid != null)
|
||||
{
|
||||
list.add("Fluid: " + fluid.getFluid().getLocalizedName());
|
||||
list.add("Volume: " + UnitDisplay.getDisplay(fluid.amount, Unit.LITER, UnitPrefix.MILLI));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getWrenchedItem(World world, Vector3 vec)
|
||||
{
|
||||
TileEntity entity = vec.getTileEntity(world);
|
||||
if (entity instanceof TileTank && ((TileTank) entity).getInternalTank() != null && ((TileTank) entity).getInternalTank().getFluid() != null)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(Mechanical.blockTank);
|
||||
FluidStack stack = ((TileTank) entity).getInternalTank().getFluid();
|
||||
public static ItemStack getWrenchedItem(World world, Vector3 vec)
|
||||
{
|
||||
TileEntity entity = vec.getTileEntity(world);
|
||||
if (entity instanceof TileTank && ((TileTank) entity).getInternalTank() != null && ((TileTank) entity).getInternalTank().getFluid() != null)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(Mechanical.blockTank);
|
||||
FluidStack stack = ((TileTank) entity).getInternalTank().getFluid();
|
||||
|
||||
if (itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (stack != null)
|
||||
{
|
||||
((TileTank) entity).drain(ForgeDirection.UNKNOWN, stack.amount, true);
|
||||
itemStack.getTagCompound().setCompoundTag("fluid", stack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (itemStack.getTagCompound() == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (stack != null)
|
||||
{
|
||||
((TileTank) entity).drain(ForgeDirection.UNKNOWN, stack.amount, true);
|
||||
itemStack.getTagCompound().setCompoundTag("fluid", stack.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
|
||||
if (itemStack.getTagCompound() != null && !player.capabilities.isCreativeMode && itemStack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemStack.getTagCompound() != null && !player.capabilities.isCreativeMode && itemStack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
{
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return this.maxStackSize;
|
||||
}
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack)
|
||||
{
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return this.maxStackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
String translation = LanguageUtility.getLocal(Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage());
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
String translation = LanguageUtility.getLocal(Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage());
|
||||
|
||||
if (translation == null || translation.isEmpty())
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getUnlocalizedName();
|
||||
}
|
||||
if (translation == null || translation.isEmpty())
|
||||
{
|
||||
return Block.blocksList[this.getBlockID()].getUnlocalizedName();
|
||||
}
|
||||
|
||||
return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage();
|
||||
}
|
||||
return Block.blocksList[this.getBlockID()].getUnlocalizedName() + "." + itemStack.getItemDamage();
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (metadata / EnumPipeMaterial.spacing)))
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).setSubID(stack.getItemDamage());
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
((TileFluidNetwork) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@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)
|
||||
{
|
||||
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (metadata / EnumPipeMaterial.spacing)))
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
if (tile instanceof TileFluidNetwork)
|
||||
{
|
||||
((TileFluidNetwork) tile).setSubID(stack.getItemDamage());
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
((TileFluidNetwork) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import resonantinduction.api.IInformation;
|
|||
import resonantinduction.api.mechanical.fluid.IFluidConnector;
|
||||
import resonantinduction.api.mechanical.fluid.IFluidNetwork;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
import calclavia.lib.network.PacketHandler;
|
||||
|
|
|
@ -27,199 +27,199 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@SideOnly(Side.CLIENT)
|
||||
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 RenderItem renderItem;
|
||||
private final RenderBlocks renderBlocks;
|
||||
private final RenderItem renderItem;
|
||||
|
||||
public RenderItemOverlayTile()
|
||||
{
|
||||
super();
|
||||
renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||
renderBlocks = new RenderBlocks();
|
||||
}
|
||||
public RenderItemOverlayTile()
|
||||
{
|
||||
super();
|
||||
renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||
renderBlocks = new RenderBlocks();
|
||||
}
|
||||
|
||||
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, double x, double y, double z)
|
||||
{
|
||||
renderTopOverlay(tileEntity, inventory, dir, 3, 3, x, y, 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);
|
||||
}
|
||||
|
||||
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, int matrixX, int matrixZ, double x, double y, double z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, ForgeDirection dir, int matrixX, int matrixZ, double x, double y, double z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
/** Render the Crafting Matrix */
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
boolean isLooking = false;
|
||||
/** Render the Crafting Matrix */
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
boolean isLooking = false;
|
||||
|
||||
MovingObjectPosition objectPosition = player.rayTrace(8, 1);
|
||||
MovingObjectPosition objectPosition = player.rayTrace(8, 1);
|
||||
|
||||
if (objectPosition != null)
|
||||
{
|
||||
isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord;
|
||||
}
|
||||
if (objectPosition != null)
|
||||
{
|
||||
isLooking = objectPosition.blockX == tileEntity.xCoord && objectPosition.blockY == tileEntity.yCoord && objectPosition.blockZ == tileEntity.zCoord;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (matrixX * matrixZ); i++)
|
||||
{
|
||||
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);
|
||||
translation.scale(0.9);
|
||||
translation.translate(0, 0, 0.06);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5f, y + 0.5f, z + 0.5f);
|
||||
RenderUtility.rotateBlockBasedOnDirection(dir);
|
||||
GL11.glTranslated(translation.x, translation.y, translation.z);
|
||||
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
this.renderItem(tileEntity.worldObj, ForgeDirection.UP, inventory[i], new Vector3(0, 0, 0), 0, 1);
|
||||
GL11.glPopMatrix();
|
||||
for (int i = 0; i < (matrixX * matrixZ); i++)
|
||||
{
|
||||
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);
|
||||
translation.scale(0.9);
|
||||
translation.translate(0, 0, 0.06);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5f, y + 0.5f, z + 0.5f);
|
||||
RenderUtility.rotateBlockBasedOnDirection(dir);
|
||||
GL11.glTranslated(translation.x, translation.y, translation.z);
|
||||
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
this.renderItem(tileEntity.worldObj, ForgeDirection.UP, inventory[i], new Vector3(0, 0, 0), 0, 1);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (isLooking)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
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));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
if (isLooking)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
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));
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z)
|
||||
{
|
||||
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 = "";
|
||||
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z)
|
||||
{
|
||||
renderItemOnSides(tile, itemStack, x, y, z, "No Output");
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
renderText = itemStack.getDisplayName();
|
||||
amount = Integer.toString(itemStack.stackSize);
|
||||
}
|
||||
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z, String renderText)
|
||||
{
|
||||
/** Render the Output */
|
||||
String amount = "";
|
||||
|
||||
for (ForgeDirection direction : forge_sides)
|
||||
{
|
||||
if (tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
|
||||
{
|
||||
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)
|
||||
{
|
||||
renderText = itemStack.getDisplayName();
|
||||
amount = Integer.toString(itemStack.stackSize);
|
||||
}
|
||||
|
||||
protected void renderItemSingleSide(TileEntity tile, double x, double y, double z, ItemStack itemStack, ForgeDirection direction, String renderText)
|
||||
{
|
||||
if (!tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
|
||||
{
|
||||
String amount = "";
|
||||
for (ForgeDirection direction : forge_sides)
|
||||
{
|
||||
if (tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
|
||||
{
|
||||
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)
|
||||
{
|
||||
renderText = itemStack.getDisplayName();
|
||||
amount = Integer.toString(itemStack.stackSize);
|
||||
}
|
||||
protected void renderItemSingleSide(TileEntity tile, double x, double y, double z, ItemStack itemStack, ForgeDirection direction, String renderText)
|
||||
{
|
||||
if (!tile.worldObj.isBlockSolidOnSide(tile.xCoord + direction.offsetX, tile.yCoord, tile.zCoord + direction.offsetZ, direction.getOpposite()))
|
||||
{
|
||||
String amount = "";
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
protected void renderItemOnSide(TileEntity tile, ItemStack itemStack, ForgeDirection direction, double x, double y, double z, String renderText, String amount)
|
||||
{
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.setupLight(tile, direction.offsetX, direction.offsetZ);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (itemStack != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
float scale = 0.03125F;
|
||||
GL11.glScalef(0.6f * scale, 0.6f * scale, -0.00001f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
switch (direction)
|
||||
{
|
||||
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))
|
||||
{
|
||||
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
|
||||
}
|
||||
GL11.glDisable(2896);
|
||||
|
||||
GL11.glEnable(2896);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, renderEngine, itemStack, true, 0.0F, 0.0F, 0.0F))
|
||||
{
|
||||
renderItem.renderItemIntoGUI(this.getFontRenderer(), renderEngine, itemStack, 0, 0);
|
||||
}
|
||||
|
||||
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
|
||||
{
|
||||
World world = tileEntity.worldObj;
|
||||
GL11.glEnable(2896);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference))
|
||||
{
|
||||
return;
|
||||
}
|
||||
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference)
|
||||
{
|
||||
World world = tileEntity.worldObj;
|
||||
|
||||
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
float scale = 0.6F;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
|
||||
}
|
||||
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
float scale = 0.6F;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale);
|
||||
}
|
||||
|
||||
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;
|
||||
RenderManager.instance.options.fancyGraphics = true;
|
||||
renderItem.doRenderItem(entityItem, 0, 0, 0, 0, 0);
|
||||
RenderManager.instance.options.fancyGraphics = fancyGraphics;
|
||||
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import resonantinduction.core.resource.TileMaterial;
|
|||
|
||||
/**
|
||||
* NO-OP. Not yet properly implemented. We're not using TEs for now.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue