Minor tweaks and fixes

This commit is contained in:
Henry Mao 2012-12-20 01:39:50 +08:00
parent 46f591a45d
commit b32bf79fd3
16 changed files with 80 additions and 444 deletions

View file

@ -1 +1 @@
27
28

View file

@ -22,3 +22,4 @@ x AssemblyLine_v0.1.6.23.jar AssemblyLine_v0.1.6.23_api.zip
@ AssemblyLine_v0.1.7.25.jar AssemblyLine_v0.1.7.25_api.zip
* AssemblyLine_v0.1.7.26.jar AssemblyLine_v0.1.7.26_api.zip
* AssemblyLine_v0.1.7.27.jar AssemblyLine_v0.1.7.27_api.zip
@ AssemblyLine_v0.1.8.28.jar AssemblyLine_v0.1.8.28_api.zip

View file

@ -1 +1 @@
0.1.7
0.1.8

View file

@ -39,7 +39,7 @@ cd ..\
echo %PROMOTION% %FILE_NAME% %API_NAME%>>info.txt
::GENERATE FTP Script
echo open www.calclavia.com>ftpscript.txt
echo open calclavia.com>ftpscript.txt
echo al@calclavia.com>>ftpscript.txt
echo VkE4laBa84R9>>ftpscript.txt
echo binary>>ftpscript.txt

View file

@ -2,7 +2,7 @@
{
"modid" : "AssemblyLine",
"name" : "Assembly Line",
"version" : "0.1.7",
"version" : "0.1.8",
"url" : "http://calclavia.com/universalelectricity/?m=18",
"credits" : "",
"authors": [

View file

@ -44,7 +44,7 @@ public class AssemblyLine
public static final String NAME = "Assembly Line";
public static final String VERSION = "0.1.7";
public static final String VERSION = "0.1.8";
public static final String CHANNEL = "AssemblyLine";
@ -66,7 +66,7 @@ public class AssemblyLine
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
UniversalElectricity.register(this, 1, 2, 0, false);
UniversalElectricity.register(this, 1, 2, 1, false);
instance = this;
CONFIGURATION.load();
@ -77,10 +77,10 @@ public class AssemblyLine
CONFIGURATION.save();
NetworkRegistry.instance().registerGuiHandler(this, this.proxy);
GameRegistry.registerBlock(blockConveyorBelt);
GameRegistry.registerBlock(blockArchitectTable);
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class);
GameRegistry.registerBlock(blockMulti, ItemBlockMulti.class);
GameRegistry.registerBlock(blockConveyorBelt, "Conveyor Belt");
GameRegistry.registerBlock(blockArchitectTable, "Architect's Table");
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class, "Crate");
GameRegistry.registerBlock(blockMulti, ItemBlockMulti.class, "Machine");
UpdateNotifier.INSTANCE.checkUpdate(NAME, VERSION, "http://calclavia.com/downloads/al/recommendedversion.txt");

View file

@ -25,6 +25,11 @@ import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.PacketDispatcher;
/**
*
* @author Darkguardsman
*
*/
public class TileEntityRejector extends TileEntityAssemblyNetwork implements IPacketReceiver, IInventory
{
/**
@ -89,7 +94,7 @@ public class TileEntityRejector extends TileEntityAssemblyNetwork implements IPa
boolean flag = false;
if (itemsBehind.size() > 0 && this.wattsReceived > this.getRequest().getWatts())
if (itemsBehind.size() > 0 && this.isRunning())
{
// for every item found check
// if can be thrown then throw
@ -233,8 +238,9 @@ public class TileEntityRejector extends TileEntityAssemblyNetwork implements IPa
if (id == PacketTypes.ANIMATION) { return new Object[] { id.ordinal(), this.firePiston }; }
if (id == PacketTypes.GUI)
{
Object[] da = new Object[this.guiButtons.length];
Object[] da = new Object[this.guiButtons.length + 1];
da[0] = id.ordinal();
for (int i = 0; i < this.guiButtons.length; i++)
{
da[i + 1] = guiButtons[i];
@ -251,7 +257,7 @@ public class TileEntityRejector extends TileEntityAssemblyNetwork implements IPa
{
int id = dataStream.readInt();
PacketTypes pID = PacketTypes.values()[id];
System.out.print("\n id:" + id + " ");
if (pID == PacketTypes.ANIMATION)
{
this.firePiston = dataStream.readBoolean();

View file

@ -150,7 +150,7 @@ public class BlockConveyorBelt extends BlockMachine
if (slantType == SlantType.UP)
{
if (entity.motionY < 0.2)
if (entity.motionY < 0.3)
{
entity.addVelocity(0, 0.2, 0);
}

View file

@ -45,6 +45,64 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN));
}
/**
* This function is overriden to allow conveyor belts to power belts that are diagonally going
* up.
*/
@Override
public void updatePowerTransferRange()
{
int maximumTransferRange = 0;
for (int i = 0; i < 6; i++)
{
ForgeDirection direction = ForgeDirection.getOrientation(i);
TileEntity tileEntity = worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ);
if (tileEntity != null)
{
if (tileEntity instanceof TileEntityAssemblyNetwork)
{
TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork) tileEntity;
if (assemblyNetwork.powerTransferRange > maximumTransferRange)
{
maximumTransferRange = assemblyNetwork.powerTransferRange;
}
}
}
}
for (int d = 0; d <= 1; d++)
{
ForgeDirection direction = this.getDirection();
if (d == 1)
{
direction = direction.getOpposite();
}
for (int i = -1; i < 1; i++)
{
TileEntity tileEntity = worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + i, this.zCoord + direction.offsetZ);
if (tileEntity != null)
{
if (tileEntity instanceof TileEntityAssemblyNetwork)
{
TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork) tileEntity;
if (assemblyNetwork.powerTransferRange > maximumTransferRange)
{
maximumTransferRange = assemblyNetwork.powerTransferRange;
}
}
}
}
}
this.powerTransferRange = Math.max(maximumTransferRange - 1, 0);
}
@Override
public void onUpdate()
{

View file

@ -45,7 +45,7 @@ public class UpdateNotifier implements IPlayerTracker
if (latestUpdate != null && latestUpdate != "" && !currentVersion.trim().equals(latestUpdate.trim()))
{
modsToUpdate.put(modName, latestUpdate.trim());
modsToUpdate.put(modName, latestUpdate);
}
return latestUpdate;

View file

@ -1,98 +0,0 @@
package universalelectricity.prefab.multiblock;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.core.vector.Vector3;
public class BlockMulti extends BlockContainer
{
public BlockMulti(int id)
{
super(id, UniversalElectricity.machine);
this.setHardness(0.8F);
this.setBlockName("MultiBlock");
}
public void makeFakeBlock(World worldObj, Vector3 position, Vector3 mainBlock)
{
worldObj.setBlockWithNotify(position.intX(), position.intY(), position.intZ(), this.blockID);
((TileEntityMulti) worldObj.getBlockTileEntity(position.intX(), position.intY(), position.intZ())).setMainBlock(mainBlock);
}
@Override
public void breakBlock(World par1World, int x, int y, int z, int par5, int par6)
{
TileEntityMulti tileEntity = (TileEntityMulti) par1World.getBlockTileEntity(x, y, z);
tileEntity.onBlockRemoval();
super.breakBlock(par1World, x, y, z, par5, par6);
}
/**
* Called when the block is right clicked by the player. This modified version detects electric
* items and wrench actions on your machine block. Do not override this function. Use
* machineActivated instead! (It does the same thing)
*/
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
TileEntityMulti tileEntity = (TileEntityMulti) par1World.getBlockTileEntity(x, y, z);
return tileEntity.onBlockActivated(par1World, x, y, z, par5EntityPlayer);
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random)
{
return 0;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityMulti();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World par1World, int x, int y, int z)
{
TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z);
Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;
if (mainBlockPosition != null)
{
int mainBlockID = par1World.getBlockId(mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ());
if (mainBlockID > 0) { return Block.blocksList[mainBlockID].getPickBlock(target, par1World, mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); }
}
return null;
}
}

View file

@ -1,17 +0,0 @@
package universalelectricity.prefab.multiblock;
import net.minecraft.entity.player.EntityPlayer;
/**
* A general interface to be implemented by anything that needs it.
*
* @author Calclavia
*
*/
public interface IBlockActivate
{
/**
* Called when activated
*/
public boolean onActivated(EntityPlayer entityPlayer);
}

View file

@ -1,28 +0,0 @@
package universalelectricity.prefab.multiblock;
import net.minecraft.tileentity.TileEntity;
import universalelectricity.core.vector.Vector3;
/**
* Interface to be applied to tile entity blocks that occupies more than one block space. Useful for
* large machines.
*
* @author Calclavia
*
*/
public interface IMultiBlock extends IBlockActivate
{
/**
* Called when this multiblock is created
*
* @param placedPosition - The position the block was placed at
*/
public void onCreate(Vector3 placedPosition);
/**
* Called when one of the multiblocks of this block is destroyed
*
* @param callingBlock - The tile entity who called the onDestroy function
*/
public void onDestroy(TileEntity callingBlock);
}

View file

@ -1,120 +0,0 @@
package universalelectricity.prefab.multiblock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import com.google.common.io.ByteArrayDataInput;
/**
* This is a multiblock to be used for blocks that are bigger than one block.
*
* @author Calclavia
*
*/
public class TileEntityMulti extends TileEntity implements IPacketReceiver
{
// The the position of the main block
public Vector3 mainBlockPosition;
public void setMainBlock(Vector3 mainBlock)
{
this.mainBlockPosition = mainBlock;
if (!this.worldObj.isRemote)
{
PacketManager.sendPacketToClients(this.getDescriptionPacket());
}
}
@Override
public Packet getDescriptionPacket()
{
return PacketManager.getPacket("BasicComponents", this, this.mainBlockPosition.x, this.mainBlockPosition.y, this.mainBlockPosition.z);
}
public void onBlockRemoval()
{
if (mainBlockPosition != null)
{
TileEntity tileEntity = this.worldObj.getBlockTileEntity((int) mainBlockPosition.x, (int) mainBlockPosition.y, (int) mainBlockPosition.z);
if (tileEntity != null && tileEntity instanceof IMultiBlock)
{
IMultiBlock mainBlock = (IMultiBlock) tileEntity;
if (mainBlock != null)
{
mainBlock.onDestroy(this);
}
}
}
}
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
{
if (mainBlockPosition != null)
{
TileEntity tileEntity = this.worldObj.getBlockTileEntity((int) mainBlockPosition.x, (int) mainBlockPosition.y, (int) mainBlockPosition.z);
if (tileEntity != null)
{
if (tileEntity instanceof IMultiBlock) { return ((IMultiBlock) tileEntity).onActivated(par5EntityPlayer); }
}
}
return false;
}
/**
* Reads a tile entity from NBT.
*/
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
this.mainBlockPosition = Vector3.readFromNBT("mainBlockPosition", par1NBTTagCompound);
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
this.mainBlockPosition.writeToNBT("mainBlockPosition", par1NBTTagCompound);
}
/**
* Determines if this TileEntity requires update calls.
*
* @return True if you want updateEntity() to be called, false if not
*/
public boolean canUpdate()
{
return false;
}
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
try
{
this.mainBlockPosition = new Vector3(dataStream.readDouble(), dataStream.readDouble(), dataStream.readDouble());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View file

@ -1,36 +0,0 @@
package universalelectricity.prefab.vector;
import universalelectricity.core.vector.Vector2;
public class Region2
{
public Vector2 min;
public Vector2 max;
public Region2()
{
this(new Vector2(), new Vector2());
}
public Region2(Vector2 min, Vector2 max)
{
this.min = min;
this.max = max;
}
/**
* Checks if a point is located inside a region
*/
public boolean isIn(Vector2 point)
{
return (point.x > this.min.x && point.x < this.max.x) && (point.y > this.min.y && point.y < this.max.y);
}
/**
* Returns whether the given region intersects with this one.
*/
public boolean isIn(Region2 region)
{
return region.max.x > this.min.x && region.min.x < this.max.x ? (region.max.y > this.min.y && region.min.y < this.max.y ? true : false) : false;
}
}

View file

@ -1,130 +0,0 @@
package universalelectricity.prefab.vector;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
/**
* A cubical region class.
*
* @author Calclavia
*/
public class Region3
{
public Vector3 min;
public Vector3 max;
public Region3()
{
this(new Vector3(), new Vector3());
}
public Region3(Vector3 min, Vector3 max)
{
this.min = min;
this.max = max;
}
public Region3 get(AxisAlignedBB aabb)
{
return new Region3(new Vector3(aabb.minX, aabb.minY, aabb.minZ), new Vector3(aabb.maxX, aabb.maxY, aabb.maxZ));
}
public AxisAlignedBB toAABB()
{
return AxisAlignedBB.getBoundingBox(this.min.x, this.min.y, this.min.z, this.max.x, this.max.y, this.max.z);
}
public Region2 toRegion2()
{
return new Region2(this.min.toVector2(), this.max.toVector2());
}
/**
* Checks if a point is located inside a region
*/
public boolean isIn(Vector3 point)
{
return (point.x > this.min.x && point.x < this.max.x) && (point.y > this.min.y && point.y < this.max.y) && (point.z > this.min.z && point.z < this.max.z);
}
/**
* Returns whether the given region intersects with this one.
*/
public boolean isIn(Region3 region)
{
return region.max.x > this.min.x && region.min.x < this.max.x ? (region.max.y > this.min.y && region.min.y < this.max.y ? region.max.z > this.min.z && region.min.z < this.max.z : false) : false;
}
public void expand(Vector3 difference)
{
this.min.subtract(difference);
this.max.add(difference);
}
/**
* @return List of vectors within this region.
*/
public List<Vector3> getVectors()
{
List<Vector3> vectors = new ArrayList<Vector3>();
for (int x = this.min.intX(); x < this.max.intX(); x++)
{
for (int y = this.min.intY(); x < this.max.intY(); y++)
{
for (int z = this.min.intZ(); x < this.max.intZ(); z++)
{
vectors.add(new Vector3(x, y, z));
}
}
}
return vectors;
}
public List<Vector3> getVectors(Vector3 center, int radius)
{
List<Vector3> vectors = new ArrayList<Vector3>();
for (int x = this.min.intX(); x < this.max.intX(); x++)
{
for (int y = this.min.intY(); x < this.max.intY(); y++)
{
for (int z = this.min.intZ(); x < this.max.intZ(); z++)
{
Vector3 vector3 = new Vector3(x, y, z);
if (center.distanceTo(vector3) <= radius)
{
vectors.add(vector3);
}
}
}
}
return vectors;
}
/**
* Returns all entities in this region.
*/
public List<Entity> getEntities(World world, Class<? extends Entity> entityClass)
{
return world.getEntitiesWithinAABB(entityClass, this.toAABB());
}
public List<Entity> getEntitiesExlude(World world, Entity entity)
{
return world.getEntitiesWithinAABBExcludingEntity(entity, this.toAABB());
}
public List<Entity> getEntities(World world)
{
return this.getEntities(world, Entity.class);
}
}