1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-28 04:17:38 +00:00

Java 8. Java 8. Does whatever Java 8 can.

Default methods, everywhere.
Arrow types, switch on strings.
Lambdas!
Here comes Java 8.
This commit is contained in:
SquidDev
2017-06-12 21:08:35 +01:00
parent 08099f08f2
commit d29ffed383
76 changed files with 747 additions and 665 deletions

View File

@@ -16,6 +16,7 @@ import javax.annotation.Nullable;
* @see ILuaContext#executeMainThreadTask(ILuaTask)
* @see ILuaContext#issueMainThreadTask(ILuaTask)
*/
@FunctionalInterface
public interface ILuaTask
{
/**

View File

@@ -16,6 +16,7 @@ import javax.annotation.Nullable;
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerMediaProvider(IMediaProvider)
*/
@FunctionalInterface
public interface IMediaProvider
{
/**

View File

@@ -91,7 +91,9 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
void attach( @Nonnull IComputerAccess computer );
default void attach( @Nonnull IComputerAccess computer )
{
}
/**
* Is called when a computer is detaching from the peripheral.
@@ -108,7 +110,9 @@ public interface IPeripheral
* computers can be attached to a peripheral at once.
* @see #detach
*/
void detach( @Nonnull IComputerAccess computer );
default void detach( @Nonnull IComputerAccess computer )
{
}
/**
* Determine whether this peripheral is equivalent to another one.

View File

@@ -18,6 +18,7 @@ import javax.annotation.Nullable;
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerPeripheralProvider(IPeripheralProvider)
*/
@FunctionalInterface
public interface IPeripheralProvider
{
/**

View File

@@ -74,7 +74,9 @@ public interface IPocketUpgrade
* @param peripheral The peripheral for this upgrade.
* @see #createPeripheral(IPocketAccess)
*/
void update( @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral );
default void update( @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
{
}
/**
* Called when the pocket computer is right clicked.
@@ -87,5 +89,8 @@ public interface IPocketUpgrade
* access the GUI.
* @see #createPeripheral(IPocketAccess)
*/
boolean onRightClick( @Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral );
default boolean onRightClick( @Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral )
{
return false;
}
}

View File

@@ -17,6 +17,7 @@ import javax.annotation.Nonnull;
*
* @see dan200.computercraft.api.ComputerCraftAPI#registerBundledRedstoneProvider(IBundledRedstoneProvider)
*/
@FunctionalInterface
public interface IBundledRedstoneProvider
{
/**

View File

@@ -15,6 +15,7 @@ import javax.annotation.Nonnull;
*
* @see ITurtleAccess#executeCommand(ILuaContext, ITurtleCommand)
*/
@FunctionalInterface
public interface ITurtleCommand
{
/**

View File

@@ -136,5 +136,7 @@ public interface ITurtleUpgrade
* @param turtle Access to the turtle that the upgrade resides on.
* @param side Which side of the turtle (left or right) the upgrade resides on.
*/
void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side );
default void update( @Nonnull ITurtleAccess turtle, @Nonnull TurtleSide side )
{
}
}