dan200.computercraft.api.turtle.ITurtleUpgrade Java Examples

The following examples show how to use dan200.computercraft.api.turtle.ITurtleUpgrade. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComputerCraftAPI.java    From OpenPeripheral-Integration with MIT License 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #2
Source File: ComputerCraftAPI.java    From Framez with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #3
Source File: ComputerCraftAPI.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #4
Source File: ComputerCraftAPI.java    From OpenPeripheral-Addons with MIT License 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #5
Source File: ComputerCraftAPI.java    From BigReactors with MIT License 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #6
Source File: ComputerCraftAPI.java    From OpenPeripheral with MIT License 6 votes vote down vote up
/**
 * Registers a new turtle turtle for use in ComputerCraft. After calling this,
 * users should be able to craft Turtles with your new turtle. It is recommended to call
 * this during the load() method of your mod.
 * @see dan200.computercraft.api.turtle.ITurtleUpgrade
 */
public static void registerTurtleUpgrade( ITurtleUpgrade upgrade )
{
    if( upgrade != null )
    {
        findCC();
        if( computerCraft_registerTurtleUpgrade != null )
        {
            try {
                computerCraft_registerTurtleUpgrade.invoke( null, upgrade );
            } catch( Exception e ) {
                // It failed
            }
        }
    }
}
 
Example #7
Source File: TurtleMetaProvider.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
private static void addSideInfo(Map<String, Object> map, String side, ITurtleUpgrade upgrade) {
	if (upgrade != null) {
		Map<Object, Object> upgradeMap = Maps.newHashMap();

		upgradeMap.put("adjective", upgrade.getUnlocalisedAdjective());
		upgradeMap.put("type", upgrade.getType().toString());

		map.put(side, upgradeMap);
	}
}
 
Example #8
Source File: ComputerCraftAPI.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #9
Source File: ComputerCraftAPI.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #10
Source File: ComputerCraftAPI.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #11
Source File: ComputerCraftAPI.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #12
Source File: ComputerCraftAPI.java    From BigReactors with MIT License 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #13
Source File: ComputerCraftAPI.java    From OpenPeripheral with MIT License 5 votes vote down vote up
private static void findCC()
{
	if( !ccSearched ) {
		try {
			computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
			computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
                   World.class, String.class
               } );
			computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
				World.class, String.class, Long.TYPE
			} );
			computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
				Class.class, String.class, String.class
			} );
			computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
				IPeripheralProvider.class
			} );
               computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
                   ITurtleUpgrade.class
               } );
               computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
                   IBundledRedstoneProvider.class
               } );
               computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
                   World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE
               } );
               computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
                   IMediaProvider.class
               } );
		} catch( Exception e ) {
			System.out.println( "ComputerCraftAPI: ComputerCraft not found." );
		} finally {
			ccSearched = true;
		}
	}
}
 
Example #14
Source File: CCUtils.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
private static void addUpgradedTurtles(List<ItemStack> result, ITurtleUpgrade upgrade, boolean isAdvanced) {
	short upgradeId = (short)upgrade.getUpgradeID();
	createTurtleItemStack(result, isAdvanced, upgradeId, null);
	for (int i = 1; i < NUMBER_OF_TURTLE_TOOLS; i++)
		createTurtleItemStack(result, isAdvanced, upgradeId, (short)i);
}
 
Example #15
Source File: CCUtils.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
public static void addUpgradedTurtles(List<ItemStack> result, ITurtleUpgrade upgrade) {
	addUpgradedTurtles(result, upgrade, false);
	addUpgradedTurtles(result, upgrade, true);
}