Removed Unused API

This commit is contained in:
Henry Mao 2013-01-14 18:29:27 +08:00
parent 7e38f9027f
commit 35a196701e
15 changed files with 6 additions and 599 deletions

View file

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

View file

@ -24,15 +24,15 @@ runtime\bin\python\python_mcp runtime\reobfuscate.py %*
::ZIP-UP
cd reobf\minecraft\
"..\..\..\7za.exe" a "..\..\builds\%FILE_NAME%" "*"
7z a "..\..\builds\%FILE_NAME%" "*"
cd ..\..\
cd resources\
"..\..\7za.exe" a "..\builds\%FILE_NAME%" "*"
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
7z a "..\builds\%FILE_NAME%" "*"
7z a "..\builds\%BACKUP_NAME%" "*" -pdarkguardsman
cd ..\
cd src\
"..\..\7za.exe" a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
"..\..\7za.exe" a "..\builds\%API_NAME%" "*\assemblyline\api\"
7z a "..\builds\%BACKUP_NAME%" "*\assemblyline\" -pdarkguardsman
7z a "..\builds\%API_NAME%" "*\assemblyline\api\"
cd ..\
::UPDATE INFO FILE

View file

@ -1,86 +0,0 @@
package dan200.computer.api;
import java.lang.reflect.Method;
/**
* The static entry point to the ComputerCraft API.
* Members in this class must be called after mod_ComputerCraft has been initialised,
* but may be called before it is fully loaded.
*/
public class ComputerCraftAPI
{
/**
* Get the creative mode tab that ComputerCraft items can be found on.
* Use this to add your peripherals to ComputerCraft's tab.
*/
public static net.minecraft.creativetab.CreativeTabs getCreativeTab()
{
findCC();
if (computerCraft_getCreativeTab != null)
{
try {
return (net.minecraft.creativetab.CreativeTabs)( computerCraft_getCreativeTab.invoke(null) );
} catch (Exception e){
// It failed
}
}
return null;
}
/**
* Registers a peripheral handler for a TileEntity that you do not have access to. Only
* use this if you want to expose IPeripheral on a TileEntity from another mod. For your own
* mod, just implement IPeripheral on the TileEntity directly.
* @see IPeripheral
* @see IPeripheralHandler
*/
public static void registerExternalPeripheral( Class <? extends net.minecraft.tileentity.TileEntity> clazz, IPeripheralHandler handler )
{
findCC();
if (computerCraft_registerExternalPeripheral != null)
{
try {
computerCraft_registerExternalPeripheral.invoke(null, clazz, handler);
} catch (Exception e){
// It failed
}
}
}
// The functions below here are private, and are used to interface with the non-API ComputerCraft classes.
// Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including
// it in your solution.
private static void findCC()
{
if( !ccSearched ) {
try {
computerCraft = Class.forName( "dan200.ComputerCraft" );
computerCraft_getCreativeTab = findCCMethod( "getCreativeTab", new Class[] { } );
computerCraft_registerExternalPeripheral = findCCMethod( "registerExternalPeripheral", new Class[] {
Class.class, IPeripheralHandler.class
} );
} catch( Exception e ) {
System.out.println("ComputerCraftAPI: ComputerCraft not found.");
} finally {
ccSearched = true;
}
}
}
private static Method findCCMethod( String name, Class[] args )
{
try {
return computerCraft.getMethod( name, args );
} catch( NoSuchMethodException e ) {
System.out.println("ComputerCraftAPI: ComputerCraft method " + name + " not found.");
return null;
}
}
private static boolean ccSearched = false;
private static Class computerCraft = null;
private static Method computerCraft_registerExternalPeripheral = null;
private static Method computerCraft_getCreativeTab = null;
}

View file

@ -1,39 +0,0 @@
package dan200.computer.api;
import dan200.computer.api.IPeripheral;
/**
* A subclass of IPeripheral specifically for peripherals
* created by ITurtleUpgrade's of type Peripheral. When an
* IHostedPeripheral is created, its IPeripheral methods will be called
* just as if the peripheral was a seperate adjacent block in the world,
* and update() will be called once per tick.
* @see ITurtleUpgrade
*/
public interface IHostedPeripheral extends IPeripheral
{
/**
* A method called on each hosted peripheral once per tick, on the main thread
* over the lifetime of the turtle or block. May be used to update the state
* of the peripheral, and may interact with IComputerAccess or ITurtleAccess
* however it likes at this time.
*/
public void update();
/**
* A method called whenever data is read from the Turtle's NBTTag,
* over the lifetime of the turtle. You should only use this for
* reading data you want to stay with the peripheral.
* @param nbttagcompound The peripheral's NBTTag
*/
public void readFromNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound );
/**
* A method called whenever data is written to the Turtle's NBTTag,
* over the lifetime of the turtle. You should only use this for
* writing data you want to stay with the peripheral.
* @param nbttagcompound The peripheral's NBTTag.
* @param ID The turtle's ID.
*/
public void writeToNBT( net.minecraft.nbt.NBTTagCompound nbttagcompound );
}

View file

@ -1,16 +0,0 @@
package dan200.computer.api;
/**
* TODO: Document me
*/
public interface IMedia
{
public String getLabel( net.minecraft.item.ItemStack stack );
public boolean setLabel( net.minecraft.item.ItemStack stack, String label );
public String getAudioTitle( net.minecraft.item.ItemStack stack );
public String getAudioRecordName( net.minecraft.item.ItemStack stack );
public String mountData( net.minecraft.item.ItemStack stack, IComputerAccess computer );
}

View file

@ -1,9 +0,0 @@
package dan200.computer.api;
/**
* TODO: Document me
*/
public interface IPeripheralHandler
{
public IHostedPeripheral getPeripheral( net.minecraft.tileentity.TileEntity tile );
}

View file

@ -1,145 +0,0 @@
package dan200.turtle.api;
import dan200.computer.api.*;
/**
* The interface passed to upgrades by turtles, providing methods that they can call.
* This should not be implemented by your classes. Do not interact with turtles except via this interface and ITurtleUpgrade.
*/
public interface ITurtleAccess
{
/**
* Returns the world in which the turtle resides.
* @return the world in which the turtle resides.
*/
public net.minecraft.world.World getWorld();
/**
* Returns a vector containing the integer block co-ordinates at which the turtle resides.
* @return a vector containing the integer block co-ordinates at which the turtle resides.
*/
public net.minecraft.util.Vec3 getPosition();
/**
* Returns the world direction the turtle is currently facing.
* @return the world direction the turtle is currently facing.
*/
public int getFacingDir();
/**
* Returns the size of the turtles inventory, in number of slots. This will currently always be 16.
* @return the size of the turtles inventory, in number of slots. This will currently always be 16.
*/
public int getInventorySize();
/**
* Returns which slot the turtle currently has selected in its inventory using turtle.select().
* Unlike the 1-based lua representation, this will be between 0 and getInventorySize() - 1.
* @return which slot the turtle currently has selected in its inventory
*/
public int getSelectedSlot();
/**
* Returns the item stack that the turtle has in one of its inventory slots.
* @param index which inventory slot to retreive, should be between 0 and getInventorySize() - 1
* @return the item stack that the turtle has in one of its inventory slots. May be null.
*/
public net.minecraft.item.ItemStack getSlotContents( int index );
/**
* Changes the item stack that the turtle has in one of its inventory slots.
* @param index which inventory slot to change, should be between 0 and getInventorySize() - 1
* @param stack an item stack to put in the slot. May be null.
*/
public void setSlotContents( int index, net.minecraft.item.ItemStack stack );
/**
* Tries to store an item stack into the turtles current inventory, starting from the turtles
* currently selected inventory slot.
* @param stack The item stack to try and store.
* @return true if the stack was completely stored in the inventory, false if
* it was only partially stored, or could not fit at all. If false is returned
* and the stack was partially stored, the ItemStack passed into "stack" will now
* represent the stack of items that is left over.
*/
public boolean storeItemStack( net.minecraft.item.ItemStack stack );
/**
* Drops an item stack from the turtle onto the floor, or into an inventory is there is one
* adjacent to the turtle in the direction specified.
* @param stack The item stack to drop.
* @param dir The world direction to drop the item
* @return true if the stack was dropped, or completely stored in the adjacent inventory, false if
* it was only partially stored in the adjacent inventory, or could not fit at all. If false is returned
* and the stack was partially stored, the ItemStack passed into "stack" will now
* represent the stack of items that is left over.
*/
public boolean dropItemStack( net.minecraft.item.ItemStack stack, int dir );
/**
* "Deploys" an item stack in the direction specified. This simulates a player right clicking, and calls onItemUse() on the Item class.
* Will return true if some kind of deployment happened, and may modify the item stack. For block item types, this can be
* used to place blocks. Some kinds of items (such as shears when facing a sheep) may modify the turtles inventory during this call.
* @param stack The item stack to deploy
* @param dir The world direction to deploy the item
* @return true if the stack was deployed, false if it was not.
*/
public boolean deployWithItemStack( net.minecraft.item.ItemStack stack, int dir );
/**
* Tries to "attack" entities with an item stack in the direction specified. This simulates a player left clicking, but will
* not affect blocks. If an entity is attacked and killed during this call, its dropped items will end up in the turtles
* inventory.
* @param stack The item stack to attack with
* @param dir The world direction to attack with the item
* @return true if something was attacked, false if it was not
*/
public boolean attackWithItemStack( net.minecraft.item.ItemStack stack, int dir, float damageMultiplier );
/**
* Returns the current fuel level of the turtle, this is the same integer returned by turtle.getFuelLevel(),
* that decreases by 1 every time the turtle moves. Can be used to have your tool or peripheral require or supply
* fuel to the turtle.
* @return the fuel level
*/
public int getFuelLevel();
/**
* Tries to increase the fuel level of a turtle by burning an item stack. If the item passed in is a fuel source, fuel
* will increase and true will be returned. Otherwise, nothing will happen and false will be returned.
* @param stack The stack to try to refuel with
* @return Whether the turtle was refueled
*/
public boolean refuelWithItemStack( net.minecraft.item.ItemStack stack );
/**
* Removes some fuel from the turtles fuel supply. Negative numbers can be passed in to INCREASE the fuel level of the turtle.
* @return Whether the turtle was able to consume the ammount of fuel specified. Will return false if you supply a number
* greater than the current fuel level of the turtle.
*/
public boolean consumeFuel( int fuel );
/**
* Adds a custom command to the turtles command queue. Unlike peripheral methods, these custom commands will be executed
* on the main thread, so are guaranteed to be able to access Minecraft objects safely, and will be queued up
* with the turtles standard movement and tool commands. An issued command will return an unique integer, which will
* be supplied as a parameter to a "turtle_response" event issued to the turtle after the command has completed. Look at the
* lua source code for "rom/apis/turtle" for how to build a lua wrapper around this functionality.
* @param handler an object which will execute the custom command when its point in the queue is reached
* @return the unique command identifier described above
* @see ITurtleCommandHandler
*/
public int issueCommand( ITurtleCommandHandler handler );
/**
* Returns the upgrade on the specified side of the turtle, if there is one.
* @return the upgrade on the specified side of the turtle, if there is one.
*/
public ITurtleUpgrade getUpgrade( TurtleSide side );
/**
* Returns the peripheral created by the upgrade on the specified side of the turtle, if there is one.
* @return the peripheral created by the upgrade on the specified side of the turtle, if there is one.
*/
public IHostedPeripheral getPeripheral( TurtleSide side );
}

View file

@ -1,20 +0,0 @@
package dan200.turtle.api;
/**
* An interface for objects executing custom turtle commands, used with ITurtleAccess.issueCommand
* @see ITurtleAccess#issueCommand( ITurtleCommandHandler )
*/
public interface ITurtleCommandHandler
{
/**
* Will be called by the turtle on the main thread when it is time to execute the custom command.
* The handler should either perform the work of the command, and return true for success, or return
* false to indicate failure if the command cannot be executed at this time.
* @param turtle access to the turtle for whom the command was issued
* @return true for success, false for failure. If true is returned, the turtle will wait 0.4 seconds
* before executing the next command in its queue, as it does for the standard turtle commands.
* @see ITurtleAccess#issueCommand( ITurtleCommandHandler )
*/
public boolean handleCommand( ITurtleAccess turtle );
}

View file

@ -1,98 +0,0 @@
package dan200.turtle.api;
import dan200.computer.api.*;
/**
* The primary interface for defining an upgrade for Turtles. A turtle upgrade
* can either be a new tool, or a new peripheral.
* @see TurtleAPI#registerUpgrade( ITurtleUpgrade )
*/
public interface ITurtleUpgrade
{
/**
* Gets a unique numerical identifier representing this type of turtle upgrade.
* Like Minecraft block and item IDs, you should strive to make this number unique
* among all turtle upgrades that have been released for ComputerCraft.
* The ID must be in the range 64 to 255, as the ID is stored as an 8-bit value,
* and 0-64 is reserved for future use by ComputerCraft. The upgrade will
* fail registration if an already used ID is specified.
* @see TurtleAPI#registerUpgrade( ITurtleUpgrade )
*/
public int getUpgradeID();
/**
* Return a String to describe this type of upgrade in turtle item names.
* Examples of built-in adjectives are "Wireless", "Mining" and "Crafty".
*/
public String getAdjective();
/**
* Return whether this upgrade adds a tool or a peripheral to the turtle.
* Currently, turtle crafting is restricted to one tool & one peripheral per turtle.
* @see TurtleUpgradeType for the differences between the two.
*/
public TurtleUpgradeType getType();
/**
* Return an item stack representing the type of item that a turtle must be crafted
* with to create a turtle which holds this upgrade.
* Currently, turtle crafting is restricted to one tool & one peripheral per turtle.
*/
public net.minecraft.item.ItemStack getCraftingItem();
/**
* Return whether this turtle upgrade is an easter egg, and should be attempted to be hidden
* from the creative mode inventory and recipe book plugins.
*/
public boolean isSecret();
/**
* Return which texture file should be used to render this upgrade when rendering a turtle
* in the world or as an item.
* @param turtle Access to the turtle that is being rendered, this will be null when
* the method is being called to render the turtle as an Item. For turtles in the world,
* this can be used to have the upgrade change appearance based on state.
* @param side Which side of the turtle (left or right) that the upgrade being rendered resides on.
* @see #getIconIndex
*/
public String getIconTexture( ITurtleAccess turtle, TurtleSide side );
/**
* Return which icon index should be used to render this upgrade when rendering a turtle
* in the world or as an item.
* @param turtle Access to the turtle that is being rendered, this will be null when
* the method is being called to render the turtle as an Item. For turtles in the world,
* this can be used to have the upgrade change appearance based on state.
* @param side Which side of the turtle (left or right) that the upgrade being rendered resides on.
* @see #getIconTexture
*/
public int getIconIndex( ITurtleAccess turtle, TurtleSide side );
/**
* Will only be called for Peripheral upgrades. Creates a peripheral for a turtle
* being placed using this upgrade. The peripheral created will be stored
* for the lifetime of the turtle, will have update() called once-per-tick, and will be
* attach'd detach'd and have methods called in the same manner as a Computer peripheral.
* @param turtle Access to the turtle that the peripheral is being created for.
* @param side Which side of the turtle (left or right) that the upgrade resides on.
* @returns The newly created peripheral. You may return null if this upgrade is a Tool
* and this method is not expected to be called.
*/
public IHostedPeripheral createPeripheral( ITurtleAccess turtle, TurtleSide side );
/**
* Will only be called for Tool upgrades. Called when turtle.dig() or turtle.attack() is called
* by the turtle, and the tool is required to do some work.
* @param turtle Access to the turtle that the tool resides on.
* @param side Which side of the turtle (left or right) the tool resides on.
* @param verb Which action (dig or attack) the turtle is being called on to perform.
* @param direction Which world direction the action should be performed in, relative to the turtles
* position. This will either be up, down, or the direction the turtle is facing, depending on
* whether dig, digUp or digDown was called.
* @return Whether the turtle was able to perform the action, and hence whether the turtle.dig()
* or turtle.attack() lua method should return true. If true is returned, the tool will perform
* a swinging animation. You may return false if this upgrade is a Peripheral
* and this method is not expected to be called.
*/
public boolean useTool( ITurtleAccess turtle, TurtleSide side, TurtleVerb verb, int direction );
}

View file

@ -1,73 +0,0 @@
package dan200.turtle.api;
import java.lang.reflect.Method;
/**
* The static entry point to the ComputerCraft Turtle Upgrade API.
* Members in this class must be called after mod_CCTurtle has been initialised,
* but may be called before it is fully loaded.
*/
public class TurtleAPI
{
/**
* Registers a new turtle upgrade for use in ComputerCraft. After calling this,
* users should be able to craft Turtles with your new upgrade. It is recommended to call
* this during the load() method of your mod.
* @throws Exception if you try to register an upgrade with an already used or reserved upgradeID
* @see ITurtleUpgrade
*/
public static void registerUpgrade( ITurtleUpgrade upgrade )
{
if( upgrade != null )
{
findCCTurtle();
if( ccTurtle_registerTurtleUpgrade != null )
{
try {
ccTurtle_registerTurtleUpgrade.invoke( null, new Object[]{ upgrade } );
} catch( Exception e ) {
// It failed
}
}
}
}
// The functions below here are private, and are used to interface with the non-API ComputerCraft classes.
// Reflection is used here so you can develop your mod in MCP without decompiling ComputerCraft and including
// it in your solution.
private static void findCCTurtle()
{
if( !ccTurtleSearched ) {
// Search for CCTurtle
try {
ccTurtle = Class.forName( "dan200.CCTurtle" );
ccTurtle_registerTurtleUpgrade = findCCTurtleMethod( "registerTurtleUpgrade", new Class[] {
ITurtleUpgrade.class
} );
} catch( ClassNotFoundException e ) {
System.out.println("ComputerCraftAPI: CCTurtle not found.");
} finally {
ccTurtleSearched = true;
}
}
}
private static Method findCCTurtleMethod( String name, Class[] args )
{
try {
return ccTurtle.getMethod( name, args );
} catch( NoSuchMethodException e ) {
System.out.println("ComputerCraftAPI: CCTurtle method " + name + " not found.");
return null;
}
}
private static boolean ccTurtleSearched = false;
private static Class ccTurtle = null;
private static Method ccTurtle_registerTurtleUpgrade = null;
}

View file

@ -1,18 +0,0 @@
package dan200.turtle.api;
/**
* An enum representing the two sides of the turtle that a turtle upgrade might reside.
*/
public enum TurtleSide
{
/**
* The turtles left side (where the pickaxe usually is on a Wireless Mining Turtle)
*/
Left,
/**
* The turtles right side (where the modem usually is on a Wireless Mining Turtle)
*/
Right,
}

View file

@ -1,22 +0,0 @@
package dan200.turtle.api;
/**
* An enum representing the two different types of upgrades that an ITurtleUpgrade
* implementation can add to a turtle.
* @see ITurtleUpgrade
*/
public enum TurtleUpgradeType
{
/**
* A tool is rendered as an item on the side of the turtle, and responds to the turtle.dig()
* and turtle.attack() methods (Such as pickaxe or sword on Mining and Melee turtles).
*/
Tool,
/**
* A peripheral adds a special peripheral which is attached to the side of the turtle,
* and can be interacted with the peripheral API (Such as the modem on Wireless Turtles).
*/
Peripheral,
}

View file

@ -1,21 +0,0 @@
package dan200.turtle.api;
/**
* An enum representing the two different actions that an ITurtleUpgrade of type
* Tool may be called on to perform by a turtle.
* @see ITurtleUpgrade
* @see ITurtleUpgrade#useTool
*/
public enum TurtleVerb
{
/**
* The turtle called turtle.dig(), turtle.digUp() or turtle.digDown()
*/
Dig,
/**
* The turtle called turtle.attack(), turtle.attackUp() or turtle.attackDown()
*/
Attack,
}

View file

@ -1,16 +0,0 @@
package dan200.turtle.api.events;
import dan200.turtle.api.ITurtleAccess;
import net.minecraftforge.event.Event;
public class TurtleEvent extends Event
{
public final ITurtleAccess turtle;
public TurtleEvent (ITurtleAccess turtle)
{
this.turtle = turtle;
}
}

View file

@ -1,30 +0,0 @@
package dan200.turtle.api.events;
import dan200.turtle.api.ITurtleAccess;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.Cancelable;
@Cancelable
public class TurtleRefuel extends TurtleEvent
{
public ItemStack itemstack;
public int refuelAmount;
private boolean handled = false;
public TurtleRefuel (ITurtleAccess turtle, ItemStack itemstack, int fuelToGive )
{
super(turtle);
this.itemstack = itemstack;
this.refuelAmount = fuelToGive;
}
public boolean isHandled()
{
return handled;
}
public void setHandled()
{
handled = true;
}
}