This commit is contained in:
Brian Ricketts 2013-03-02 22:17:29 -06:00
commit 5a1d3e5bd7
12 changed files with 305 additions and 34 deletions

4
Include2.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
cd resources
..\..\..\7za.exe a "..\jars\bin\minecraft.jar" "*"
pause

28
buildlocal.bat Normal file
View file

@ -0,0 +1,28 @@
::ASSEMBLY LINE BUILDER
@echo off
set FILE_NAME=AssemblyLine_test.jar
set API_NAME=AssemblyLine_test_api.zip
set BACKUP_NAME=AssemblyLine_test_backup.zip
echo Starting to build %FILE_NAME%
::BUILD
runtime\bin\python\python_mcp runtime\recompile.py %*
runtime\bin\python\python_mcp runtime\reobfuscate.py %*
::ZIP-UP
cd reobf\minecraft\
7z a "..\..\builds\%FILE_NAME%" "*"
cd ..\..\
cd resources\
7z a "..\builds\%FILE_NAME%" "*"
7z a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
cd ..\
cd src\
7z a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
7z a "..\builds\%API_NAME%" "*\assemblyline\api\"
cd ..\
echo Done building %FILE_NAME% for UE %UE_VERSION%
pause

4
include.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
cd resources
7z a "..\jars\bin\minecraft.jar" "*"
pause

View file

@ -1 +1 @@
0.2.7
0.2.8

63
publish.bat Normal file
View file

@ -0,0 +1,63 @@
::ASSEMBLY LINE BUILDER
@echo off
echo Promotion Type? (Choose * for recommended, @ for stable and x for unstable)
set /p PROMOTION=
echo FTP Server?
set /p SERVER=
echo FTP Username?
set /p USERNAME=
echo FTP Password?
set /p PASSWORD=
set /p MODVERSION=<modversion.txt
set /p CurrentBuild=<buildnumber.txt
set /a BUILD_NUMBER=%CurrentBuild%+1
echo %BUILD_NUMBER% >buildnumber.txt
if %PROMOTION%==* (
echo %MODVERSION% >recommendedversion.txt
)
set FILE_NAME=AssemblyLine_v%MODVERSION%.%BUILD_NUMBER%.jar
set API_NAME=AssemblyLine_v%MODVERSION%.%BUILD_NUMBER%_api.zip
set BACKUP_NAME=AssemblyLine_v%MODVERSION%.%BUILD_NUMBER%_backup.zip
echo Starting to build %FILE_NAME%
::BUILD
runtime\bin\python\python_mcp runtime\recompile.py %*
runtime\bin\python\python_mcp runtime\reobfuscate.py %*
::ZIP-UP
cd reobf\minecraft\
7z a "..\..\builds\%FILE_NAME%" "*"
cd ..\..\
cd resources\
7z a "..\builds\%FILE_NAME%" "*"
7z a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
cd ..\
cd src\
7z a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
7z a "..\builds\%API_NAME%" "*\assemblyline\api\"
cd ..\
::UPDATE INFO FILE
echo %PROMOTION% %FILE_NAME% %API_NAME%>>info.txt
::GENERATE FTP Script
echo open %SERVER%>ftpscript.txt
echo %USERNAME%>>ftpscript.txt
echo %PASSWORD%>>ftpscript.txt
echo binary>>ftpscript.txt
echo put "recommendedversion.txt">>ftpscript.txt
echo put "builds\%FILE_NAME%">>ftpscript.txt
echo put "builds\%API_NAME%">>ftpscript.txt
echo put info.txt>>ftpscript.txt
echo quit>>ftpscript.txt
ftp.exe -s:ftpscript.txt
del ftpscript.txt
echo Done building %FILE_NAME%
pause

52
publish_obf.bat Normal file
View file

@ -0,0 +1,52 @@
::ASSEMBLY LINE BUILDER
@echo off
echo Promotion Type? (Choose * for recommended, @ for stable and x for unstable)
set /p PROMOTION=
set /p MODVERSION=<modversion.txt
set /p CurrentBuild=<buildnumber.txt
set /a BUILD_NUMBER=%CurrentBuild%+1
set NAME=AssemblyLine_v%MODVERSION%.%BUILD_NUMBER%
set FILE_NAME=%NAME%.jar
set TEMP_FILE=%NAME%_temp.jar
set TEMP_FILE2=%NAME%_temp2.jar
set TEMP_FOLDER=%NAME%_temp
set API_NAME=%NAME%_api.zip
set BACKUP_NAME=%NAME%_backup.zip
echo Starting to build %NAME%
::BUILD
::runtime\bin\python\python_mcp runtime\recompile.py %*
::runtime\bin\python\python_mcp runtime\reobfuscate.py %*
::ZIP-UP
cd reobf\minecraft\
"..\..\..\7za.exe" a "..\..\builds\%TEMP_FILE_NAME%" "*"
cd ..\..\
cd resources\
"..\..\7za.exe" a "..\builds\%FILE_NAME%" "*"
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
cd ..\
cd src\
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
"..\..\7za.exe" a "..\builds\%API_NAME%" "*\assemblyline\api\"
cd ..\
::Obfuscation
echo Injector Minecraft Source
cd obf_minecraft
"..\..\7za.exe" a "..\builds\%TEMP_FILE_NAME%" "*"
cd ..\
echo Obfuscating...
java -jar "retroguard.jar" "builds\%TEMP_FILE_NAME%" "builds\%TEMP_FILE2%" obf.rgs
echo Repacking
"..\7za.exe" x "builds\%TEMP_FILE_NAME%" "builds\%TEMP_FOLDER%"
cd "builds\%TEMP_FOLDER%"
"..\..\..\7za.exe" a "..\..\builds\%FILE_NAME%" "*"
cd ..\..\
echo Done building %NAME%
pause

View file

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

View file

@ -46,7 +46,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@Mod(modid = AssemblyLine.CHANNEL, name = AssemblyLine.NAME, version = AssemblyLine.VERSION, dependencies = "after:BasicComponents, after:IC2")
@Mod(modid = AssemblyLine.CHANNEL, name = AssemblyLine.NAME, version = AssemblyLine.VERSION, dependencies = "after:BasicComponents; after:IC2")
@NetworkMod(channels = { AssemblyLine.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class AssemblyLine
{
@ -58,7 +58,7 @@ public class AssemblyLine
public static final String NAME = "Assembly Line";
public static final String VERSION = "0.2.7";
public static final String VERSION = "0.2.8";
public static final String CHANNEL = "AssemblyLine";

View file

@ -11,6 +11,7 @@ import java.util.zip.ZipInputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.prefab.implement.IToolConfigurator;
import universalelectricity.prefab.multiblock.TileEntityMulti;
import assemblyline.common.block.TileEntityCrate;
import assemblyline.common.machine.TileEntityManipulator;
@ -24,7 +25,6 @@ import assemblyline.common.machine.encoder.ContainerEncoder;
import assemblyline.common.machine.encoder.TileEntityEncoder;
import assemblyline.common.machine.imprinter.ContainerImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprinter;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
@ -119,7 +119,7 @@ public class CommonProxy implements IGuiHandler
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
switch (ID)
@ -147,13 +147,4 @@ public class CommonProxy implements IGuiHandler
{
return false;
}
public static boolean isHoldingBCWrench(EntityPlayer player)
{
if (player.getCurrentEquippedItem() == null)
{
return false;
}
return player.getCurrentEquippedItem().getItem() instanceof IToolWrench || (Items.getItem("wrench") != null && player.getCurrentEquippedItem().isItemEqual(Items.getItem("wrench")));
}
}

View file

@ -0,0 +1,122 @@
package assemblyline.common;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.vector.Vector3;
import assemblyline.common.block.TileEntityCrate;
/**
* A class that allows flexible path finding in Minecraft Blocks. Back Ported from UE 1.3.0.
*
* TODO: Will need to change when MC 1.5 comes out.
*
* @author Calclavia
*
*/
public class PathfinderCrate
{
public interface IPathCallBack
{
/**
* Is this a valid node to search for?
*
* @return
*/
public boolean isValidNode(PathfinderCrate finder, ForgeDirection direction, TileEntity provider, TileEntity node);
/**
* Called when looping through nodes.
*
* @param finder
* @param provider
* @return True to stop the path finding operation.
*/
public boolean onSearch(PathfinderCrate finder, TileEntity provider);
}
/**
* A pathfinding call back interface used to call back on paths.
*/
public IPathCallBack callBackCheck;
/**
* A list of nodes that the pathfinder went through.
*/
public List<TileEntity> iteratedNodes;
/**
* The results and findings found by the pathfinder.
*/
public List results;
public PathfinderCrate()
{
this.callBackCheck = new IPathCallBack()
{
@Override
public boolean isValidNode(PathfinderCrate finder, ForgeDirection direction, TileEntity provider, TileEntity node)
{
return node instanceof TileEntityCrate;
}
@Override
public boolean onSearch(PathfinderCrate finder, TileEntity provider)
{
return false;
}
};
this.clear();
}
public boolean findNodes(TileEntity provider)
{
if (provider != null)
{
this.iteratedNodes.add(provider);
if (this.callBackCheck.onSearch(this, provider))
{
return false;
}
for (int i = 0; i < 6; i++)
{
TileEntity connectedTile = Vector3.getTileEntityFromSide(provider.worldObj, new Vector3(provider), ForgeDirection.getOrientation(i));
if (!iteratedNodes.contains(connectedTile))
{
if (this.callBackCheck.isValidNode(this, ForgeDirection.getOrientation(i), provider, connectedTile))
{
if (!this.findNodes(connectedTile))
{
return false;
}
}
}
}
}
return true;
}
/**
* Called to execute the pathfinding operation.
*/
public PathfinderCrate init(TileEntity provider)
{
this.findNodes(provider);
return this;
}
public PathfinderCrate clear()
{
this.iteratedNodes = new ArrayList<TileEntity>();
this.results = new ArrayList();
return this;
}
}

View file

@ -1,5 +1,6 @@
package assemblyline.common.block;
import ic2.api.Items;
import assemblyline.common.CommonProxy;
import universalelectricity.core.implement.IItemElectric;
import universalelectricity.prefab.BlockMachine;
@ -33,7 +34,7 @@ public class BlockALMachine extends BlockMachine
{
this(string, id, material);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
@ -42,13 +43,26 @@ public class BlockALMachine extends BlockMachine
*/
if (player.inventory.getCurrentItem() != null)
{
if (CommonProxy.isHoldingBCWrench(player))
if (isHoldingWrench(player))
{
return this.onUseWrench(world, x, y, z, player, side, hitX, hitY, hitZ);
}
}
return super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
}
/**
* Checks if the player is holding a foreign wrench.
*/
public static boolean isHoldingWrench(EntityPlayer player)
{
if (player.getCurrentEquippedItem() != null)
{
return (Items.getItem("wrench") != null && player.getCurrentEquippedItem().isItemEqual(Items.getItem("wrench")));
}
return false;
}
}

View file

@ -14,6 +14,7 @@ import universalelectricity.core.implement.IItemElectric;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.implement.IToolConfigurator;
import assemblyline.common.AssemblyLine;
import assemblyline.common.PathfinderCrate;
import assemblyline.common.TabAssemblyLine;
/**
@ -138,24 +139,16 @@ public class BlockCrate extends BlockALMachine
{
success = this.insertCurrentItem(tileEntity, player);
}
if (!success && doSearch)
{
int radius = 10;
for (int x = -radius; x < radius; x++)
{
for (int y = -radius; y < radius; y++)
{
for (int z = -radius; z < radius; z++)
{
Vector3 position = Vector3.add(new Vector3(tileEntity), new Vector3(x, y, z));
TileEntity checkTile = position.getTileEntity(tileEntity.worldObj);
PathfinderCrate pathfinder = new PathfinderCrate().init(tileEntity);
if (checkTile instanceof TileEntityCrate)
{
AssemblyLine.blockCrate.tryInsert(((TileEntityCrate) checkTile), player, allMode, false);
}
}
for (TileEntity checkTile : pathfinder.iteratedNodes)
{
if (checkTile instanceof TileEntityCrate)
{
AssemblyLine.blockCrate.tryInsert(((TileEntityCrate) checkTile), player, allMode, false);
}
}
}