Bug fixes and Updates for UE3.0

This commit is contained in:
Robert 2013-12-22 11:23:26 -05:00
parent 1cae25ad79
commit d30b626399
18 changed files with 192 additions and 101 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

View file

@ -82,7 +82,9 @@ public interface ITask extends Cloneable, ISaveObj
public final String name;
public final Vector2 UV;
public static final ResourceLocation TEXTURE = new ResourceLocation("dark", "textures/gui/gui_coder_icons.png");
/** This is only loaded when assembly line is installed, and only used as a backup if tasks
* don't return textures */
public static final ResourceLocation TEXTURE = new ResourceLocation("al", "textures/gui/gui_coder_icons.png");
private TaskType(String name, int uu, int vv)
{

View file

@ -23,7 +23,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
public class GuiEditTask extends GuiBase implements IMessageBoxDialog
{
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_task_edit.png");
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_task_edit.png");
protected GuiEncoderCoder gui;
protected ITask task, editTask;

View file

@ -9,7 +9,7 @@ import com.builtbroken.minecraft.DarkCore;
public class GuiEncoderHelp extends GuiEncoderBase
{
public static final ResourceLocation TEXTURE_CODE_BACK = new ResourceLocation(AssemblyLine.instance.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_encoder_coder.png");
public static final ResourceLocation TEXTURE_CODE_BACK = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_encoder_coder.png");
public GuiEncoderHelp(InventoryPlayer player, TileEntityEncoder tileEntity)
{

View file

@ -17,7 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiEncoderInventory extends GuiEncoderBase
{
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.instance.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_encoder_slot.png");
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.GUI_DIRECTORY + "gui_encoder_slot.png");
public GuiEncoderInventory(InventoryPlayer inventoryPlayer, TileEntityEncoder tileEntity)
{

View file

@ -1,7 +1,5 @@
package com.builtbroken.assemblyline.client.render;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyTile;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,14 +7,9 @@ import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import universalelectricity.api.Compatibility;
import universalelectricity.api.net.IConnector;
import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorHelper;
import buildcraft.api.power.IPowerReceptor;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.assemblyline.client.model.ModelCopperWire;
import com.builtbroken.assemblyline.transmit.TileEntityWire;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -37,46 +30,15 @@ public class RenderBlockWire extends TileEntitySpecialRenderer
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
boolean[] renderSide = new boolean[6];
for (byte i = 0; i < 6; i++)
if (tileEntity instanceof TileEntityWire)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
TileEntity ent = VectorHelper.getTileEntityFromSide(tileEntity.worldObj, new Vector3(tileEntity), dir);
if (ent instanceof IConnector)
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (((IConnector) ent).canConnect(dir.getOpposite()))
if (((TileEntityWire) tileEntity).hasConnectionSide(side))
{
renderSide[i] = true;
model.renderSide(side);
}
}
else if (ent instanceof IEnergyTile)
{
if (ent instanceof IEnergyAcceptor)
{
if (((IEnergyAcceptor) ent).acceptsEnergyFrom(tileEntity, dir.getOpposite()))
{
renderSide[i] = true;
}
}
else
{
renderSide[i] = true;
}
}
else if (ent instanceof IPowerReceptor)
{
renderSide[i] = true;
}
}
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (renderSide[side.ordinal()])
{
model.renderSide(side);
}
}
model.renderSide(ForgeDirection.UNKNOWN);
GL11.glPopMatrix();

View file

@ -14,13 +14,17 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.api.electricity.IVoltageInput;
import universalelectricity.api.electricity.IVoltageOutput;
import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyContainer;
import universalelectricity.api.energy.IEnergyInterface;
import universalelectricity.api.energy.IEnergyNetwork;
import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit;
import buildcraft.api.power.IPowerReceptor;
import cofh.api.energy.IEnergyStorage;
import com.builtbroken.assemblyline.AssemblyLine;
import com.builtbroken.common.science.units.ElectricUnit;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.fluid.FluidHelper;
import com.builtbroken.minecraft.interfaces.IToolReadOut;
@ -130,10 +134,45 @@ public class ItemReadoutTools extends ItemBasic
}
}
//TODO add shift click support to bring up a easier to read GUI or link to the block and add an on screen gui so the player can toy with a design and be updated
//TODO add toggle support to only get one energy system(UE,TE,BC,IC2) readings rather than all or first type read
if (tool == EnumTools.MULTI_METER)
{
//TODO filter all units threw UE unit helper to created nicer looking output text
player.sendChatToPlayer(ChatMessageComponent.createFromText("Multi-Meter is disabled until UE 3.0 is sorted out"));
if (tileEntity instanceof IVoltageInput && ((IVoltageInput) tileEntity).getVoltageInput(hitSide) > 0)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("V~In:" + ((IVoltageInput) tileEntity).getVoltageInput(hitSide)));
}
if (tileEntity instanceof IVoltageOutput && ((IVoltageOutput) tileEntity).getVoltageOutput(hitSide) > 0)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("V~Out:" + ((IVoltageOutput) tileEntity).getVoltageOutput(hitSide)));
}
if (tileEntity instanceof IConductor)
{
IEnergyNetwork network = ((IConductor) tileEntity).getNetwork();
if (network != null)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("Network:" + network.toString()));
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~In:" + UnitDisplay.getDisplay(network.getRequest(), Unit.JOULES, 2, false)));
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~Out:" + UnitDisplay.getDisplay(network.getLastBuffer(), Unit.JOULES, 2, false)));
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~lost:" + UnitDisplay.getDisplay(network.getEnergyLoss(), Unit.JOULES, 2, false)));
}
}
else if (tileEntity instanceof IEnergyContainer)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("E~:" + UnitDisplay.getDisplay(((IEnergyContainer) tileEntity).getEnergy(hitSide), Unit.JOULES, 2, false) + "/" + UnitDisplay.getDisplay(((IEnergyContainer) tileEntity).getEnergyCapacity(hitSide), Unit.JOULES, 2, false)));
}
else if (tileEntity instanceof IEnergyStorage)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("RF~:" + UnitDisplay.getDisplay(((IEnergyStorage) tileEntity).getEnergyStored(), Unit.REDFLUX, 2, true) + "/" + UnitDisplay.getDisplay(((IEnergyStorage) tileEntity).getMaxEnergyStored(), Unit.REDFLUX, 2, true)));
}
else if (tileEntity instanceof IPowerReceptor)
{
//TODO recode for input and output
if (((IPowerReceptor) tileEntity).getPowerReceiver(hitSide) != null)
{
player.sendChatToPlayer(ChatMessageComponent.createFromText("Mj~:" + ((IPowerReceptor) tileEntity).getPowerReceiver(hitSide).getEnergyStored()));
}
}
//TODO add IC2 support
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.IEnergyInterface;
import universalelectricity.api.item.ElectricItemHelper;
import universalelectricity.api.vector.Vector3;
@ -25,7 +26,7 @@ public class TileEntityBatteryBox extends TileEntityEnergyMachine
{
public TileEntityBatteryBox()
{
super(0, 5000);
super(0, 5000000);
this.invSlots = 2;
this.hasGUI = true;
}
@ -37,40 +38,12 @@ public class TileEntityBatteryBox extends TileEntityEnergyMachine
if (!this.worldObj.isRemote && this.enabled && !this.isDisabled())
{
/** Recharges electric item. */
ElectricItemHelper.chargeItemFromMachine(this, ForgeDirection.UNKNOWN, this.getStackInSlot(0));
/** Recharges electric item. */
this.setEnergy(ForgeDirection.UNKNOWN, this.getEnergy(ForgeDirection.UNKNOWN) - CompatibilityModule.chargeItem(this.getStackInSlot(0), Math.min(10000, this.getEnergyStored()), true));
/** Decharge electric item. */
ElectricItemHelper.dischargeItemToMachine(this, ForgeDirection.UNKNOWN, this.getStackInSlot(1));
this.setEnergy(ForgeDirection.UNKNOWN, this.getEnergy(ForgeDirection.UNKNOWN) + CompatibilityModule.disChargeItem(this.getStackInSlot(1), Math.min(10000, this.getEnergyCapacity(ForgeDirection.UNKNOWN) - this.getEnergyStored()), true));
ForgeDirection outputDirection = ForgeDirection.getOrientation(this.getBlockMetadata());
TileEntity outputTile = VectorHelper.getConnectorFromSide(this.worldObj, new Vector3(this), outputDirection);
if (outputTile instanceof IEnergyInterface)
{
long outputWatts = Math.min(this.getEnergyStored(), 10000);
if (outputWatts > 0 && ((IEnergyInterface) outputTile).onReceiveEnergy(outputDirection.getOpposite(), outputWatts, false) > 0)
{
this.setEnergy(outputDirection, this.getEnergy(outputDirection) - ((IEnergyInterface) outputTile).onReceiveEnergy(outputDirection, outputWatts, true));
}
}
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
{
if (direction != outputDirection)
{
TileEntity inputTile = VectorHelper.getConnectorFromSide(this.worldObj, new Vector3(this), direction);
long inputLimit = Math.min(this.getEnergyCapacity(direction.getOpposite()) - this.getEnergy(direction.getOpposite()), 10000);
if (inputLimit > 0 && ((IEnergyInterface) inputTile).onExtractEnergy(direction, inputLimit, false) > 0)
{
this.setEnergy(outputDirection, this.getEnergy(outputDirection) + ((IEnergyInterface) inputTile).onExtractEnergy(direction, inputLimit, true));
}
}
}
}
/** Gradually lose energy. */
if (this.ticks % 2000 == 0)
{
this.consumePower(1, true);
this.produce();
}
}
@ -86,6 +59,18 @@ public class TileEntityBatteryBox extends TileEntityEnergyMachine
return EnumSet.of(ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite());
}
/** The electrical input direction.
*
* @return The direction that electricity is entered into the tile. Return null for no input. By
* default you can accept power from all sides. */
public EnumSet<ForgeDirection> getInputDirections()
{
EnumSet<ForgeDirection> et = EnumSet.allOf(ForgeDirection.class);
et.remove(ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite());
et.remove(ForgeDirection.UNKNOWN);
return et;
}
@Override
public boolean simplePacket(String id, ByteArrayDataInput dis, Player player)
{

View file

@ -1,7 +1,6 @@
package com.builtbroken.assemblyline.machine;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.electricity.ElectricityPack;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
@ -38,6 +37,7 @@ public abstract class TileEntityGenerator extends TileEntityEnergyMachine
if (this.isFunctioning())
{
this.burnTime--;
this.produce();
}
}
}

View file

@ -1,11 +1,32 @@
package com.builtbroken.assemblyline.machine;
import java.util.EnumSet;
import net.minecraftforge.common.ForgeDirection;
import com.builtbroken.minecraft.prefab.TileEntityEnergyMachine;
public class TileEntityInfSupply extends TileEntityEnergyMachine
{
@Override
public void updateEntity()
{
super.updateEntity();
this.setJoulesPerTick(10000);
this.produce();
}
@Override
public EnumSet<ForgeDirection> getOutputDirections()
{
return EnumSet.allOf(ForgeDirection.class);
}
@Override
public EnumSet<ForgeDirection> getInputDirections()
{
return EnumSet.noneOf(ForgeDirection.class);
}
@Override
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)

View file

@ -1,6 +1,10 @@
package com.builtbroken.assemblyline.transmit;
import net.minecraft.block.Block;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.EnergyNetworkLoader;
@ -10,18 +14,29 @@ import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorHelper;
import universalelectricity.core.net.EnergyNetwork;
import com.builtbroken.minecraft.DarkCore;
import com.builtbroken.minecraft.helpers.ColorCode;
import com.builtbroken.minecraft.helpers.ColorCode.IColorCoded;
import com.builtbroken.minecraft.network.ISimplePacketReceiver;
import com.builtbroken.minecraft.network.PacketHandler;
import com.builtbroken.minecraft.prefab.TileEntityAdvanced;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityWire extends TileEntityAdvanced implements IConductor
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TileEntityWire extends TileEntityAdvanced implements IConductor, ISimplePacketReceiver, IColorCoded
{
protected int updateTick = 1;
protected ColorCode color = ColorCode.BLACK;
protected ColorCode color = ColorCode.UNKOWN;
private IEnergyNetwork network;
public TileEntity[] connections = new TileEntity[6];
public byte currentAcceptorConnections = 0x00;
@Override
public void updateEntity()
{
@ -36,22 +51,71 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor
}
}
@Override
public void invalidate()
{
super.invalidate();
this.getNetwork().split(this);
}
public void refresh()
{
this.connections = new TileEntity[6];
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
if (!this.worldObj.isRemote)
{
if (this.canConnect(direction.getOpposite()))
byte possibleAcceptorConnections = 0x00;
this.connections = new TileEntity[6];
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity entity = VectorHelper.getConnectorFromSide(this.worldObj, new Vector3(this), direction);
if (CompatibilityModule.isHandler(entity))
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), side);
if (CompatibilityModule.canConnect(tileEntity, side.getOpposite()) && this.canConnect(side))
{
this.connections[direction.ordinal()] = entity;
if (tileEntity instanceof IConductor)
{
this.getNetwork().merge(((IConductor) tileEntity).getNetwork());
}
this.connections[side.ordinal()] = tileEntity;
possibleAcceptorConnections |= 1 << side.ordinal();
}
}
if (this.currentAcceptorConnections != possibleAcceptorConnections)
{
this.currentAcceptorConnections = possibleAcceptorConnections;
PacketHandler.instance().sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 64);
this.getNetwork().reconstruct();
}
}
}
public boolean hasConnectionSide(ForgeDirection side)
{
return connectionMapContainsSide(this.currentAcceptorConnections, side);
}
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
{
byte tester = (byte) (1 << side.ordinal());
return ((connections & tester) > 0);
}
@Override
public boolean simplePacket(String id, ByteArrayDataInput data, Player player)
{
if (id.equalsIgnoreCase("Wire"))
{
this.currentAcceptorConnections = data.readByte();
this.setColor(ColorCode.get(data.readInt()));
return true;
}
return false;
}
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.instance().getTilePacket(DarkCore.CHANNEL, "Wire", this, this.currentAcceptorConnections, this.getColor().ordinal());
}
@Override
public boolean canUpdate()
{
@ -81,10 +145,7 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor
@Override
public void setNetwork(IEnergyNetwork network)
{
if (network instanceof IEnergyNetwork)
{
this.network = (EnergyNetwork) network;
}
this.network = (EnergyNetwork) network;
}
@Override
@ -96,9 +157,9 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor
@Override
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
if (this.canConnect(from) && network != null)
if (this.canConnect(from) && this.getNetwork() != null)
{
return network.produce(receive);
return this.getNetwork().produce(VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), from.getOpposite()), from.getOpposite(), receive, doReceive);
}
return 0;
}
@ -106,7 +167,6 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor
@Override
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
{
// TODO Auto-generated method stub
return 0;
}
@ -119,7 +179,29 @@ public class TileEntityWire extends TileEntityAdvanced implements IConductor
@Override
public long getEnergyCapacitance()
{
return BlockWire.energyMax;
return 100000;
}
@Override
public ColorCode getColor()
{
return this.color;
}
@Override
public boolean setColor(Object obj)
{
if (ColorCode.get(obj) != null)
{
this.color = ColorCode.get(obj);
return true;
}
return false;
}
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
return AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
}
}