Skip to content

Commit

Permalink
Update buildscript, apply spotless (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenraven authored Sep 1, 2022
1 parent 08d0ef6 commit a40ee74
Show file tree
Hide file tree
Showing 1,220 changed files with 105,610 additions and 120,307 deletions.
41 changes: 41 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
* text eol=lf

*.[jJ][aA][rR] binary

*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary

*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary

*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary

*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary

*.[pP][aA][tT][cC][hH] -text

*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf

*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
435 changes: 328 additions & 107 deletions build.gradle

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Add your dependencies here

dependencies {
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.33-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')

compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.34:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Jabba:1.2.13:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.5.14:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.23-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.5.19:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.2.8:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.18:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Jabba:1.2.21:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.5.15:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.7.5.32-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.5.21:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.10:api') {transitive = false}

compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
Expand Down
10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
}

apply plugin: 'com.diffplug.blowdryerSetup'

blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
}
69 changes: 29 additions & 40 deletions src/main/java/appeng/api/AEApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,56 +23,45 @@

package appeng.api;


import appeng.api.exceptions.CoreInaccessibleException;

import java.lang.reflect.Field;


/**
* Entry point for api.
* <p>
* Available IMCs:
*/
public enum AEApi
{
;

private static final String CORE_API_FQN = "appeng.core.Api";
private static final String CORE_API_FIELD = "INSTANCE";
private static final IAppEngApi HELD_API;
public enum AEApi {
;

static
{
try
{
final Class<?> apiClass = Class.forName( CORE_API_FQN );
final Field apiField = apiClass.getField( CORE_API_FIELD );
private static final String CORE_API_FQN = "appeng.core.Api";
private static final String CORE_API_FIELD = "INSTANCE";
private static final IAppEngApi HELD_API;

HELD_API = (IAppEngApi) apiField.get( apiClass );
}
catch( final ClassNotFoundException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared." );
}
catch( final NoSuchFieldException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without it being declared." );
}
catch( final IllegalAccessException e )
{
throw new CoreInaccessibleException( "AE2 API tried to access the " + CORE_API_FIELD + " field in " + CORE_API_FQN + " without enough access permissions." );
}
}
static {
try {
final Class<?> apiClass = Class.forName(CORE_API_FQN);
final Field apiField = apiClass.getField(CORE_API_FIELD);

/**
* API Entry Point.
*
* @return the {@link IAppEngApi}
*/
public static IAppEngApi instance()
{
return HELD_API;
}
HELD_API = (IAppEngApi) apiField.get(apiClass);
} catch (final ClassNotFoundException e) {
throw new CoreInaccessibleException(
"AE2 API tried to access the " + CORE_API_FQN + " class, without it being declared.");
} catch (final NoSuchFieldException e) {
throw new CoreInaccessibleException("AE2 API tried to access the " + CORE_API_FIELD + " field in "
+ CORE_API_FQN + " without it being declared.");
} catch (final IllegalAccessException e) {
throw new CoreInaccessibleException("AE2 API tried to access the " + CORE_API_FIELD + " field in "
+ CORE_API_FQN + " without enough access permissions.");
}
}

/**
* API Entry Point.
*
* @return the {@link IAppEngApi}
*/
public static IAppEngApi instance() {
return HELD_API;
}
}
117 changes: 57 additions & 60 deletions src/main/java/appeng/api/IAppEngApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

package appeng.api;


import appeng.api.definitions.*;
import appeng.api.exceptions.FailedConnection;
import appeng.api.features.IRegistryContainer;
Expand All @@ -33,72 +32,70 @@
import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper;

public interface IAppEngApi {

public interface IAppEngApi
{

/**
* @return Registry Container for the numerous registries in AE2.
*/
IRegistryContainer registries();
/**
* @return Registry Container for the numerous registries in AE2.
*/
IRegistryContainer registries();

/**
* @return helper for working with storage data types.
*/
IStorageHelper storage();
/**
* @return helper for working with storage data types.
*/
IStorageHelper storage();

/**
* @return helper for working with grids, and buses.
*/
IPartHelper partHelper();
/**
* @return helper for working with grids, and buses.
*/
IPartHelper partHelper();

/**
* @return an accessible list of all of AE's Items
* @deprecated use {@link appeng.api.definitions.IDefinitions#items()}
*/
@Deprecated
Items items();
/**
* @return an accessible list of all of AE's Items
* @deprecated use {@link appeng.api.definitions.IDefinitions#items()}
*/
@Deprecated
Items items();

/**
* @return an accessible list of all of AE's materials; materials are items
* @deprecated use {@link appeng.api.definitions.IDefinitions#materials()}
*/
@Deprecated
Materials materials();
/**
* @return an accessible list of all of AE's materials; materials are items
* @deprecated use {@link appeng.api.definitions.IDefinitions#materials()}
*/
@Deprecated
Materials materials();

/**
* @return an accessible list of all of AE's blocks
* @deprecated use {@link appeng.api.definitions.IDefinitions#blocks()}
*/
@Deprecated
Blocks blocks();
/**
* @return an accessible list of all of AE's blocks
* @deprecated use {@link appeng.api.definitions.IDefinitions#blocks()}
*/
@Deprecated
Blocks blocks();

/**
* @return an accessible list of all of AE's parts, parts are items
* @deprecated use {@link appeng.api.definitions.IDefinitions#parts()}
*/
@Deprecated
Parts parts();
/**
* @return an accessible list of all of AE's parts, parts are items
* @deprecated use {@link appeng.api.definitions.IDefinitions#parts()}
*/
@Deprecated
Parts parts();

/**
* @return an accessible list of all AE definitions
*/
IDefinitions definitions();
/**
* @return an accessible list of all AE definitions
*/
IDefinitions definitions();

/**
* create a grid node for your {@link appeng.api.networking.IGridHost}
*
* @param block grid block
* @return grid node of block
*/
IGridNode createGridNode( IGridBlock block );
/**
* create a grid node for your {@link appeng.api.networking.IGridHost}
*
* @param block grid block
* @return grid node of block
*/
IGridNode createGridNode(IGridBlock block);

/**
* create a connection between two {@link appeng.api.networking.IGridNode}
*
* @param a to be connected gridnode
* @param b to be connected gridnode
* @throws appeng.api.exceptions.FailedConnection
*/
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnection;
}
/**
* create a connection between two {@link appeng.api.networking.IGridNode}
*
* @param a to be connected gridnode
* @param b to be connected gridnode
* @throws appeng.api.exceptions.FailedConnection
*/
IGridConnection createGridConnection(IGridNode a, IGridNode b) throws FailedConnection;
}
76 changes: 35 additions & 41 deletions src/main/java/appeng/api/config/AccessRestriction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,45 @@

package appeng.api.config;

public enum AccessRestriction {
NO_ACCESS(0),
READ(1),
WRITE(2),
READ_WRITE(3);

public enum AccessRestriction
{
NO_ACCESS( 0 ), READ( 1 ), WRITE( 2 ), READ_WRITE( 3 );
private final int permissionBit;

private final int permissionBit;
AccessRestriction(final int v) {
this.permissionBit = v;
}

AccessRestriction( final int v )
{
this.permissionBit = v;
}
public boolean hasPermission(final AccessRestriction ar) {
return (this.permissionBit & ar.permissionBit) == ar.permissionBit;
}

public boolean hasPermission( final AccessRestriction ar )
{
return ( this.permissionBit & ar.permissionBit ) == ar.permissionBit;
}
public AccessRestriction restrictPermissions(final AccessRestriction ar) {
return this.getPermByBit(this.permissionBit & ar.permissionBit);
}

public AccessRestriction restrictPermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit & ar.permissionBit );
}
private AccessRestriction getPermByBit(final int bit) {
switch (bit) {
default:
case 0:
return NO_ACCESS;
case 1:
return READ;
case 2:
return WRITE;
case 3:
return READ_WRITE;
}
}

private AccessRestriction getPermByBit( final int bit )
{
switch( bit )
{
default:
case 0:
return NO_ACCESS;
case 1:
return READ;
case 2:
return WRITE;
case 3:
return READ_WRITE;
}
}
public AccessRestriction addPermissions(final AccessRestriction ar) {
return this.getPermByBit(this.permissionBit | ar.permissionBit);
}

public AccessRestriction addPermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit | ar.permissionBit );
}

public AccessRestriction removePermissions( final AccessRestriction ar )
{
return this.getPermByBit( this.permissionBit & ( ~ar.permissionBit ) );
}
}
public AccessRestriction removePermissions(final AccessRestriction ar) {
return this.getPermByBit(this.permissionBit & (~ar.permissionBit));
}
}
Loading

0 comments on commit a40ee74

Please sign in to comment.