Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.core;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -29,33 +30,35 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
|
||||
public class FacadeConfig extends Configuration
|
||||
{
|
||||
|
||||
public static FacadeConfig instance;
|
||||
final Pattern replacementPattern;
|
||||
|
||||
public FacadeConfig( File facadeFile ) {
|
||||
public FacadeConfig( File facadeFile )
|
||||
{
|
||||
super( facadeFile );
|
||||
this.replacementPattern = Pattern.compile( "[^a-zA-Z0-9]" );
|
||||
}
|
||||
|
||||
public boolean checkEnabled(Block id, int metadata, boolean automatic)
|
||||
public boolean checkEnabled( Block id, int metadata, boolean automatic )
|
||||
{
|
||||
if ( id == null )
|
||||
if( id == null )
|
||||
return false;
|
||||
|
||||
UniqueIdentifier blk = GameRegistry.findUniqueIdentifierFor( id );
|
||||
if ( blk == null )
|
||||
if( blk == null )
|
||||
{
|
||||
for (Field f : Block.class.getFields())
|
||||
for( Field f : Block.class.getFields() )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( f.get( Block.class ) == id )
|
||||
return this.get( "minecraft", f.getName() + (metadata == 0 ? "" : "." + metadata), automatic ).getBoolean( automatic );
|
||||
if( f.get( Block.class ) == id )
|
||||
return this.get( "minecraft", f.getName() + ( metadata == 0 ? "" : "." + metadata ), automatic ).getBoolean( automatic );
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
@@ -65,7 +68,7 @@ public class FacadeConfig extends Configuration
|
||||
{
|
||||
Matcher mod = this.replacementPattern.matcher( blk.modId );
|
||||
Matcher name = this.replacementPattern.matcher( blk.name );
|
||||
return this.get( mod.replaceAll( "" ), name.replaceAll( "" ) + (metadata == 0 ? "" : "." + metadata), automatic ).getBoolean( automatic );
|
||||
return this.get( mod.replaceAll( "" ), name.replaceAll( "" ) + ( metadata == 0 ? "" : "." + metadata ), automatic ).getBoolean( automatic );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user