Removes the unneeded information about the current class in all blocks
Every Block had a call to its super, passing its own class. This can easily be simulated by calling `this.getClass()` in the super class. Also this was basically only used as using a name. In the future it might be advisable to not use such methods, since they are prone to refactoring.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
package appeng.fmp;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import codechicken.multipart.TMultiPart;
|
||||
@@ -31,7 +33,8 @@ import appeng.core.Api;
|
||||
|
||||
public enum PartRegistry
|
||||
{
|
||||
QuartzTorchPart( "ae2_torch", BlockQuartzTorch.class, QuartzTorchPart.class ), CableBusPart( "ae2_cablebus", BlockCableBus.class, CableBusPart.class );
|
||||
QuartzTorchPart( "ae2_torch", BlockQuartzTorch.class, QuartzTorchPart.class ),
|
||||
CableBusPart( "ae2_cablebus", BlockCableBus.class, CableBusPart.class );
|
||||
|
||||
private final String name;
|
||||
private final Class<? extends AEBaseBlock> blk;
|
||||
@@ -44,20 +47,7 @@ public enum PartRegistry
|
||||
this.part = part;
|
||||
}
|
||||
|
||||
public static String getPartName( TMultiPart part )
|
||||
{
|
||||
Class c = part.getClass();
|
||||
for( PartRegistry pr : values() )
|
||||
{
|
||||
if( pr.equals( c ) )
|
||||
{
|
||||
return pr.name;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException( "Invalid PartName" );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TMultiPart getPartByBlock( Block block, int meta )
|
||||
{
|
||||
for( PartRegistry pr : values() )
|
||||
@@ -89,18 +79,6 @@ public enum PartRegistry
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPart( Block block )
|
||||
{
|
||||
for( PartRegistry pr : values() )
|
||||
{
|
||||
if( pr.blk.isInstance( block ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
|
||||
Reference in New Issue
Block a user