AL 0.2.3 Release!
This commit is contained in:
parent
13cba0dbcd
commit
ceb784fa26
29 changed files with 258 additions and 165 deletions
|
@ -1 +1 @@
|
|||
53
|
||||
54
|
||||
|
|
1
info.txt
1
info.txt
|
@ -47,3 +47,4 @@ Minecraft 1.4.5
|
|||
@ AssemblyLine_v0.2.3.51.jar AssemblyLine_v0.2.3.51_api.zip
|
||||
@ AssemblyLine_v0.2.3.52.jar AssemblyLine_v0.2.3.52_api.zip
|
||||
@ AssemblyLine_v0.2.3.53.jar AssemblyLine_v0.2.3.53_api.zip
|
||||
* AssemblyLine_v0.2.3.54.jar AssemblyLine_v0.2.3.54_api.zip
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
0.2.2
|
||||
0.2.3
|
||||
|
|
BIN
resources/assemblyline/textures/armbot.png
Normal file
BIN
resources/assemblyline/textures/armbot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
|
@ -23,7 +23,6 @@ import org.lwjgl.opengl.GL11;
|
|||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.encoder.ContainerEncoder;
|
||||
import assemblyline.common.machine.encoder.IInventoryWatcher;
|
||||
import assemblyline.common.machine.encoder.ItemDisk;
|
||||
|
|
|
@ -13,7 +13,6 @@ package assemblyline.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelAngledBelt extends ModelBase
|
||||
{
|
||||
|
|
|
@ -6,94 +6,113 @@ import net.minecraft.entity.Entity;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
|
||||
public class ModelArmbot extends ModelBase
|
||||
{
|
||||
// fields
|
||||
private ModelRenderer BaseTop;
|
||||
private ModelRenderer Base;
|
||||
private ModelRenderer armMountRight;
|
||||
private ModelRenderer armMountLeft;
|
||||
private ModelRenderer armLower;
|
||||
private ModelRenderer armUpper;
|
||||
private ModelRenderer baseRotation;
|
||||
private ModelRenderer clampBody;
|
||||
private ModelRenderer clampBody2;
|
||||
private ModelRenderer clampClawLower;
|
||||
private ModelRenderer clampClawLower2;
|
||||
ModelRenderer baseTop;
|
||||
ModelRenderer base;
|
||||
ModelRenderer armMountRight;
|
||||
ModelRenderer armMountLeft;
|
||||
ModelRenderer armLower;
|
||||
ModelRenderer armLower2;
|
||||
ModelRenderer armLower3;
|
||||
ModelRenderer armUpper;
|
||||
ModelRenderer baseRotation;
|
||||
ModelRenderer clampBody;
|
||||
ModelRenderer clampBody2;
|
||||
ModelRenderer clampClawLower;
|
||||
ModelRenderer clampClawLower2;
|
||||
ModelRenderer clampClawLower3;
|
||||
|
||||
public ModelArmbot()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
BaseTop = new ModelRenderer(this, 0, 0);
|
||||
BaseTop.addBox(-6F, 0F, -6F, 12, 3, 12);
|
||||
BaseTop.setRotationPoint(0F, 18F, 0F);
|
||||
BaseTop.setTextureSize(64, 32);
|
||||
BaseTop.mirror = true;
|
||||
setRotation(BaseTop, 0F, 0F, 0F);
|
||||
Base = new ModelRenderer(this, 0, 0);
|
||||
Base.addBox(-8F, 0F, -8F, 16, 3, 16);
|
||||
Base.setRotationPoint(0F, 21F, 0F);
|
||||
Base.setTextureSize(64, 32);
|
||||
Base.mirror = true;
|
||||
setRotation(Base, 0F, 0F, 0F);
|
||||
armMountRight = new ModelRenderer(this, 0, 0);
|
||||
armMountRight.addBox(-4F, -5F, -1.5F, 2, 5, 3);
|
||||
baseTop = new ModelRenderer(this, 0, 94);
|
||||
baseTop.addBox(-6F, 0F, -6F, 12, 3, 12);
|
||||
baseTop.setRotationPoint(0F, 18F, 0F);
|
||||
baseTop.setTextureSize(64, 32);
|
||||
baseTop.mirror = true;
|
||||
setRotation(baseTop, 0F, 0F, 0F);
|
||||
base = new ModelRenderer(this, 0, 109);
|
||||
base.addBox(-8F, 0F, -8F, 16, 3, 16);
|
||||
base.setRotationPoint(0F, 21F, 0F);
|
||||
base.setTextureSize(64, 32);
|
||||
base.mirror = true;
|
||||
setRotation(base, 0F, 0F, 0F);
|
||||
armMountRight = new ModelRenderer(this, 12, 85);
|
||||
armMountRight.addBox(-4F, -5F, -2F, 2, 5, 4);
|
||||
armMountRight.setRotationPoint(0F, 17F, 0F);
|
||||
armMountRight.setTextureSize(64, 32);
|
||||
armMountRight.mirror = true;
|
||||
setRotation(armMountRight, 0F, 0F, 0F);
|
||||
armMountLeft = new ModelRenderer(this, 0, 0);
|
||||
armMountLeft.addBox(2F, -5F, -1.5F, 2, 5, 3);
|
||||
armMountLeft = new ModelRenderer(this, 0, 85);
|
||||
armMountLeft.addBox(2F, -5F, -2F, 2, 5, 4);
|
||||
armMountLeft.setRotationPoint(0F, 17F, 0F);
|
||||
armMountLeft.setTextureSize(64, 32);
|
||||
armMountLeft.mirror = true;
|
||||
setRotation(armMountLeft, 0F, 0F, 0F);
|
||||
armLower = new ModelRenderer(this, 0, 0);
|
||||
armLower.addBox(-2F, -15F, -2.5F, 4, 16, 5);
|
||||
armLower = new ModelRenderer(this, 116, 0);
|
||||
armLower.addBox(0.3F, -15F, -1.5F, 2, 16, 4);
|
||||
armLower.setRotationPoint(0F, 14F, 0F);
|
||||
armLower.setTextureSize(64, 32);
|
||||
armLower.mirror = true;
|
||||
setRotation(armLower, 0.5235988F, 0F, 0F);
|
||||
armUpper = new ModelRenderer(this, 0, 0);
|
||||
armUpper.addBox(-1.5F, -15F, -2F, 3, 16, 4);
|
||||
armLower2 = new ModelRenderer(this, 104, 0);
|
||||
armLower2.addBox(-2.3F, -15F, -1.5F, 2, 16, 4);
|
||||
armLower2.setRotationPoint(0F, 14F, 0F);
|
||||
armLower2.setTextureSize(64, 32);
|
||||
armLower2.mirror = true;
|
||||
setRotation(armLower2, 0.5235988F, 0F, 0F);
|
||||
armLower3 = new ModelRenderer(this, 92, 0);
|
||||
armLower3.addBox(-1F, -14F, -2F, 2, 14, 4);
|
||||
armLower3.setRotationPoint(0F, 14F, 0F);
|
||||
armLower3.setTextureSize(64, 32);
|
||||
armLower3.mirror = true;
|
||||
setRotation(armLower3, 0.5235988F, 0F, 0F);
|
||||
armUpper = new ModelRenderer(this, 0, 70);
|
||||
armUpper.addBox(-1F, -10F, -1.5F, 2, 12, 3);
|
||||
armUpper.setRotationPoint(0F, 2F, -7F);
|
||||
armUpper.setTextureSize(64, 32);
|
||||
armUpper.mirror = true;
|
||||
setRotation(armUpper, 2.007129F, 0F, 0F);
|
||||
baseRotation = new ModelRenderer(this, 0, 0);
|
||||
setRotation(armUpper, 2.513274F, 0F, 0F);
|
||||
baseRotation = new ModelRenderer(this, 0, 60);
|
||||
baseRotation.addBox(-4.5F, 0F, -4.5F, 9, 1, 9);
|
||||
baseRotation.setRotationPoint(0F, 17F, 0F);
|
||||
baseRotation.setTextureSize(64, 32);
|
||||
baseRotation.mirror = true;
|
||||
setRotation(baseRotation, 0F, 0F, 0F);
|
||||
clampBody = new ModelRenderer(this, 0, 0);
|
||||
clampBody.addBox(-2F, -17F, -2.5F, 4, 2, 5);
|
||||
clampBody = new ModelRenderer(this, 0, 7);
|
||||
clampBody.addBox(-1.5F, -12F, -2.5F, 3, 2, 5);
|
||||
clampBody.setRotationPoint(0F, 2F, -7F);
|
||||
clampBody.setTextureSize(64, 32);
|
||||
clampBody.mirror = true;
|
||||
setRotation(clampBody, 2.007129F, 0F, 0F);
|
||||
clampBody2 = new ModelRenderer(this, 0, 0);
|
||||
clampBody2.addBox(-1.5F, -19F, -1F, 3, 2, 2);
|
||||
setRotation(clampBody, 2.513274F, 0F, 0F);
|
||||
clampBody2 = new ModelRenderer(this, 0, 56);
|
||||
clampBody2.addBox(-1F, -14F, -1F, 2, 2, 2);
|
||||
clampBody2.setRotationPoint(0F, 2F, -7F);
|
||||
clampBody2.setTextureSize(64, 32);
|
||||
clampBody2.mirror = true;
|
||||
setRotation(clampBody2, 2.007129F, 0F, 0F);
|
||||
clampClawLower = new ModelRenderer(this, 0, 0);
|
||||
clampClawLower.addBox(-2.5F, -5F, -1F, 5, 6, 1);
|
||||
clampClawLower.setRotationPoint(0F, 10F, -23F);
|
||||
setRotation(clampBody2, 2.513274F, 0F, 0F);
|
||||
clampClawLower = new ModelRenderer(this, 0, 25);
|
||||
clampClawLower.addBox(-1F, -4F, -1F, 2, 5, 1);
|
||||
clampClawLower.setRotationPoint(0F, 13F, -15F);
|
||||
clampClawLower.setTextureSize(64, 32);
|
||||
clampClawLower.mirror = true;
|
||||
setRotation(clampClawLower, 2.007129F, 0F, 0F);
|
||||
clampClawLower2 = new ModelRenderer(this, 0, 0);
|
||||
clampClawLower2.addBox(-2.5F, -5F, 1F, 5, 6, 1);
|
||||
clampClawLower2.setRotationPoint(0F, 10F, -23F);
|
||||
setRotation(clampClawLower, 2.9147F, 0F, 0F);
|
||||
clampClawLower2 = new ModelRenderer(this, 0, 31);
|
||||
clampClawLower2.addBox(-1.2F, -3.5F, 0F, 1, 6, 1);
|
||||
clampClawLower2.setRotationPoint(0F, 14F, -16F);
|
||||
clampClawLower2.setTextureSize(64, 32);
|
||||
clampClawLower2.mirror = true;
|
||||
setRotation(clampClawLower2, 2.007129F, 0F, 0F);
|
||||
setRotation(clampClawLower2, 2.897247F, 0F, 0F);
|
||||
clampClawLower3 = new ModelRenderer(this, 0, 0);
|
||||
clampClawLower3.addBox(0.2F, -3.5F, 0F, 1, 6, 1);
|
||||
clampClawLower3.setRotationPoint(0F, 14F, -16F);
|
||||
clampClawLower3.setTextureSize(64, 32);
|
||||
clampClawLower3.mirror = true;
|
||||
setRotation(clampClawLower3, 2.897247F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
|
@ -131,8 +150,8 @@ public class ModelArmbot extends ModelBase
|
|||
* clampClawLower2.rotateAngleY = armBot.rotationYaw;
|
||||
*/
|
||||
|
||||
BaseTop.render(f5);
|
||||
Base.render(f5);
|
||||
baseTop.render(f5);
|
||||
base.render(f5);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(rotationYaw, 0, 1, 0);
|
||||
armMountRight.render(f5);
|
||||
|
@ -154,5 +173,4 @@ public class ModelArmbot extends ModelBase
|
|||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
package assemblyline.client.render;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
import assemblyline.client.model.ModelArmbot;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
|
|
|
@ -3,10 +3,8 @@ package assemblyline.common.machine;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.electricity.ElectricityConnections;
|
||||
import universalelectricity.core.electricity.ElectricityNetwork;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
@ -69,32 +67,13 @@ public abstract class TileEntityAssemblyNetwork extends TileEntityElectricityRec
|
|||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
|
||||
{
|
||||
if (ElectricityConnections.getDirections(this) != null)
|
||||
if (this.wattsReceived < this.getRequest().getWatts())
|
||||
{
|
||||
for (Object obj : ElectricityConnections.getDirections(this))
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
ForgeDirection inputDirection = (ForgeDirection) obj;
|
||||
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection);
|
||||
|
||||
ElectricityNetwork network = ElectricityNetwork.getNetworkFromTileEntity(inputTile, inputDirection);
|
||||
|
||||
if (network != null)
|
||||
{
|
||||
if (this.wattsReceived >= this.getRequest().getWatts())
|
||||
{
|
||||
network.stopRequesting(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
network.startRequesting(this, this.getRequest());
|
||||
this.wattsReceived += network.consumeElectricity(this).getWatts() * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.wattsReceived += ElectricityNetwork.consumeFromMultipleSides(this, this.getRequest()).getWatts() * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ElectricityNetwork.consumeFromMultipleSides(this, new ElectricityPack());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,12 +108,6 @@ public abstract class TileEntityAssemblyNetwork extends TileEntityElectricityRec
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected ElectricityPack getRequest()
|
||||
{
|
||||
return new ElectricityPack(15, this.getVoltage());
|
||||
|
|
|
@ -121,15 +121,6 @@ public class TileEntityRejector extends TileEntityFilterable
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* UE methods
|
||||
*/
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
||||
/**
|
||||
* NBT Data
|
||||
*/
|
||||
|
|
|
@ -60,12 +60,6 @@ public class TileEntityRoboticSorter extends TileEntityElectricityReceiver imple
|
|||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inventory functions.
|
||||
*/
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
@ -84,6 +83,20 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
{
|
||||
Vector3 handPosition = this.getHandPosition();
|
||||
|
||||
/**
|
||||
* Break the block if the hand hits a solid block.
|
||||
*/
|
||||
Block block = Block.blocksList[handPosition.getBlockID(this.worldObj)];
|
||||
|
||||
if (block != null)
|
||||
{
|
||||
if (Block.isNormalCube(block.blockID))
|
||||
{
|
||||
block.dropBlockAsItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, handPosition.getBlockMetadata(this.worldObj), 0);
|
||||
handPosition.setBlockWithNotify(this.worldObj, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity entity : this.grabbedEntities)
|
||||
{
|
||||
entity.setPosition(handPosition.x, handPosition.y, handPosition.z);
|
||||
|
@ -149,7 +162,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
Vector3 position = new Vector3(this);
|
||||
position.add(0.5);
|
||||
// The distance of the position relative to the main position.
|
||||
double distance = 1.7f;
|
||||
double distance = 1f;
|
||||
Vector3 delta = new Vector3();
|
||||
// The delta Y of the hand.
|
||||
delta.y = Math.sin(Math.toRadians(this.rotationPitch)) * distance;
|
||||
|
@ -159,18 +172,9 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
delta.x = Math.sin(Math.toRadians(-this.rotationYaw)) * dH;
|
||||
delta.z = Math.cos(Math.toRadians(-this.rotationYaw)) * dH;
|
||||
position.add(delta);
|
||||
// TODO: Use Smoke Spawning to Determine Hand Calculation Position. Delete when done
|
||||
// developing this part.
|
||||
// this.worldObj.spawnParticle("smoke", position.x, position.y, position.z, 0, 0, 0);
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class CommandDrop extends Command
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
|
||||
public class CommandIdle extends Command
|
||||
{
|
||||
|
|
|
@ -28,8 +28,6 @@ public class CommandManager
|
|||
{
|
||||
if (this.tasks.size() > 0)
|
||||
{
|
||||
System.out.println(this.lastTask + " vs " + currentTask + ": " + this.tasks.size());
|
||||
|
||||
if (this.currentTask < this.tasks.size())
|
||||
{
|
||||
if (this.currentTask < 0)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
|
||||
public class CommandReturn extends Command
|
||||
{
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
/**
|
||||
* Rotates the armbot to a specific direction. If not specified, it will turn right.
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
package assemblyline.common.machine.imprinter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.Pair;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class ContainerImprinter extends Container implements ISlotWatcher
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@ package assemblyline.common.machine.imprinter;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
|
||||
public class SlotCustom extends Slot
|
||||
{
|
||||
|
|
|
@ -39,7 +39,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { return 3; }
|
||||
if (side == ForgeDirection.UP || side == ForgeDirection.DOWN)
|
||||
return 3;
|
||||
return START_INVENTORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class UniversalElectricity
|
|||
*/
|
||||
public static final int MAJOR_VERSION = 1;
|
||||
public static final int MINOR_VERSION = 2;
|
||||
public static final int REVISION_VERSION = 1;
|
||||
public static final int REVISION_VERSION = 3;
|
||||
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION_VERSION;
|
||||
|
||||
/**
|
||||
|
@ -42,10 +42,10 @@ public class UniversalElectricity
|
|||
/**
|
||||
* Conversion ratios between Buildcraft and Industrialcraft energy.
|
||||
*/
|
||||
// EU to Watts ratio
|
||||
public static double IC2_RATIO = 10;
|
||||
// MJ to Watts ratio.
|
||||
public static double BC3_RATIO = 85;
|
||||
// The amount of UE Joules equivalent to IC2 EU
|
||||
public static double IC2_RATIO = 50;
|
||||
// The amount of UE Joules equivalent to BC Minecraft Joules
|
||||
public static double BC3_RATIO = 500;
|
||||
public static double TO_IC2_RATIO = 1 / IC2_RATIO;
|
||||
public static double TO_BC_RATIO = 1 / BC3_RATIO;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package universalelectricity.core.electricity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -9,6 +10,7 @@ import java.util.Map;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.implement.IConductor;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class ElectricityNetwork
|
||||
|
@ -202,7 +204,8 @@ public class ElectricityNetwork
|
|||
|
||||
if (this.consumers.containsKey(tileEntity) && tileRequest != null)
|
||||
{
|
||||
// Calculate the electricity this tile entity is receiving in percentage.
|
||||
// Calculate the electricity this tile entity is receiving in
|
||||
// percentage.
|
||||
totalElectricity = this.getProduced();
|
||||
|
||||
if (totalElectricity.getWatts() > 0)
|
||||
|
@ -388,4 +391,132 @@ public class ElectricityNetwork
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tileEntity - The TileEntity's sides.
|
||||
* @param approachingDirection - The directions that can be connected.
|
||||
* @return A list of networks from all specified sides. There will be no repeated
|
||||
* ElectricityNetworks and it will never return null.
|
||||
*/
|
||||
public static List<ElectricityNetwork> getNetworksFromMultipleSides(TileEntity tileEntity, EnumSet<ForgeDirection> approachingDirection)
|
||||
{
|
||||
final List<ElectricityNetwork> connectedNetworks = new ArrayList<ElectricityNetwork>();
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(i);
|
||||
|
||||
if (approachingDirection.contains(direction))
|
||||
{
|
||||
Vector3 position = new Vector3(tileEntity);
|
||||
position.modifyPositionFromSide(direction);
|
||||
TileEntity outputConductor = position.getTileEntity(tileEntity.worldObj);
|
||||
ElectricityNetwork electricityNetwork = getNetworkFromTileEntity(outputConductor, direction);
|
||||
|
||||
if (electricityNetwork != null && !connectedNetworks.contains(connectedNetworks))
|
||||
{
|
||||
connectedNetworks.add(electricityNetwork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return connectedNetworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consumes electricity from all specified sides. Use this as a simple helper function.
|
||||
*
|
||||
* @param tileEntity- The TileEntity consuming the electricity.
|
||||
* @param approachDirection - The sides in which you can connect.
|
||||
* @param requestPack - The amount of electricity to be requested.
|
||||
* @return The consumed ElectricityPack.
|
||||
*/
|
||||
public static ElectricityPack consumeFromMultipleSides(TileEntity tileEntity, EnumSet<ForgeDirection> approachingDirection, ElectricityPack requestPack)
|
||||
{
|
||||
ElectricityPack consumedPack = new ElectricityPack();
|
||||
|
||||
if (tileEntity != null && approachingDirection != null)
|
||||
{
|
||||
final List<ElectricityNetwork> connectedNetworks = getNetworksFromMultipleSides(tileEntity, approachingDirection);
|
||||
|
||||
if (connectedNetworks.size() > 0)
|
||||
{
|
||||
/**
|
||||
* Requests an even amount of electricity from all sides.
|
||||
*/
|
||||
double wattsPerSide = (requestPack.getWatts() / connectedNetworks.size());
|
||||
double voltage = requestPack.voltage;
|
||||
|
||||
for (ElectricityNetwork network : connectedNetworks)
|
||||
{
|
||||
if (wattsPerSide > 0 && requestPack.getWatts() > 0)
|
||||
{
|
||||
network.startRequesting(tileEntity, wattsPerSide / voltage, voltage);
|
||||
ElectricityPack receivedPack = network.consumeElectricity(tileEntity);
|
||||
consumedPack.amperes += receivedPack.amperes;
|
||||
consumedPack.voltage = Math.max(consumedPack.voltage, receivedPack.voltage);
|
||||
}
|
||||
else
|
||||
{
|
||||
network.stopRequesting(tileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return consumedPack;
|
||||
}
|
||||
|
||||
public static ElectricityPack consumeFromMultipleSides(TileEntity tileEntity, ElectricityPack electricityPack)
|
||||
{
|
||||
return consumeFromMultipleSides(tileEntity, ElectricityConnections.getDirections(tileEntity), electricityPack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces electricity from all specified sides. Use this as a simple helper function.
|
||||
*
|
||||
* @param tileEntity- The TileEntity consuming the electricity.
|
||||
* @param approachDirection - The sides in which you can connect to.
|
||||
* @param producePack - The amount of electricity to be produced.
|
||||
* @return What remained in the electricity pack.
|
||||
*/
|
||||
public static ElectricityPack produceFromMultipleSides(TileEntity tileEntity, EnumSet<ForgeDirection> approachingDirection, ElectricityPack producingPack)
|
||||
{
|
||||
ElectricityPack remainingElectricity = producingPack.clone();
|
||||
|
||||
if (tileEntity != null && approachingDirection != null)
|
||||
{
|
||||
final List<ElectricityNetwork> connectedNetworks = getNetworksFromMultipleSides(tileEntity, approachingDirection);
|
||||
|
||||
if (connectedNetworks.size() > 0)
|
||||
{
|
||||
/**
|
||||
* Requests an even amount of electricity from all sides.
|
||||
*/
|
||||
double wattsPerSide = (producingPack.getWatts() / connectedNetworks.size());
|
||||
double voltage = producingPack.voltage;
|
||||
|
||||
for (ElectricityNetwork network : connectedNetworks)
|
||||
{
|
||||
if (wattsPerSide > 0 && producingPack.getWatts() > 0)
|
||||
{
|
||||
double amperes = wattsPerSide / voltage;
|
||||
network.startProducing(tileEntity, amperes, voltage);
|
||||
remainingElectricity.amperes -= amperes;
|
||||
}
|
||||
else
|
||||
{
|
||||
network.stopProducing(tileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return remainingElectricity;
|
||||
}
|
||||
|
||||
public static ElectricityPack produceFromMultipleSides(TileEntity tileEntity, ElectricityPack electricityPack)
|
||||
{
|
||||
return produceFromMultipleSides(tileEntity, ElectricityConnections.getDirections(tileEntity), electricityPack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ public interface IVoltage
|
|||
/**
|
||||
* Gets the voltage of this object.
|
||||
*
|
||||
* @param data - The data, possibly an ItemStack if this is an electric item.
|
||||
* @return The amount of volts. E.g 120v or 240v
|
||||
*/
|
||||
public double getVoltage();
|
||||
public double getVoltage(Object... data);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@ package universalelectricity.prefab;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -23,7 +25,12 @@ public class UpdateNotifier implements IPlayerTracker
|
|||
public static final UpdateNotifier INSTANCE = new UpdateNotifier();
|
||||
public static boolean isInitialized = false;
|
||||
|
||||
public static final HashMap<String, String> modsToUpdate = new HashMap<String, String>();
|
||||
public static final HashMap<String, String> MODS_TO_UPDATE = new HashMap<String, String>();
|
||||
|
||||
/**
|
||||
* Add variables to this array if you want extra custom notifications to be output.
|
||||
*/
|
||||
public static final List<String> NOTIFICATIONS = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Call this in your FML Pre-Initialize Event.
|
||||
|
@ -45,7 +52,7 @@ public class UpdateNotifier implements IPlayerTracker
|
|||
|
||||
if (latestUpdate != null && latestUpdate != "" && !currentVersion.trim().equals(latestUpdate.trim()))
|
||||
{
|
||||
modsToUpdate.put(modName, latestUpdate.trim());
|
||||
MODS_TO_UPDATE.put(modName, latestUpdate.trim());
|
||||
}
|
||||
|
||||
return latestUpdate;
|
||||
|
@ -76,19 +83,26 @@ public class UpdateNotifier implements IPlayerTracker
|
|||
@Override
|
||||
public void onPlayerLogin(EntityPlayer player)
|
||||
{
|
||||
if (modsToUpdate.size() > 0)
|
||||
if (MODS_TO_UPDATE.size() > 0)
|
||||
{
|
||||
String notification = "You have " + modsToUpdate.size() + " mod(s) that needs to be updated: ";
|
||||
// Output Notification Message.
|
||||
String updateNotification = "You have " + MODS_TO_UPDATE.size() + " mod(s) that needs to be updated: ";
|
||||
|
||||
Iterator it = modsToUpdate.entrySet().iterator();
|
||||
Iterator it = MODS_TO_UPDATE.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) it.next();
|
||||
|
||||
notification += pairs.getKey() + " [" + pairs.getValue() + "] ";
|
||||
updateNotification += pairs.getKey() + " [" + pairs.getValue() + "] ";
|
||||
}
|
||||
|
||||
player.addChatMessage(updateNotification);
|
||||
}
|
||||
|
||||
// Output Extra Notifications
|
||||
for (String notification : NOTIFICATIONS)
|
||||
{
|
||||
player.addChatMessage(notification);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import universalelectricity.core.vector.Vector3;
|
|||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
|
|
@ -27,7 +27,7 @@ public abstract class TileEntityElectricityProducer extends TileEntityDisableabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
public double getVoltage(Object... data)
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public abstract class TileEntityElectricityReceiver extends TileEntityDisableabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
public double getVoltage(Object... data)
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue