Change of naming convention
Changed naming convention. All AE blocks, items and TEs were affected. Most of assets were transfered, but some sill need help. Localizations will be transfered in a separate commit. Closes #46.
This commit is contained in:
@@ -29,6 +29,7 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
@@ -79,7 +80,11 @@ public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
final String name = this.extractor.get();
|
||||
String name = this.extractor.get();
|
||||
if( Item.REGISTRY.containsKey( new ResourceLocation( AppEng.MOD_ID, name ) ) )
|
||||
{
|
||||
name += "_block";
|
||||
}
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setUnlocalizedName( "appliedenergistics2." + name );
|
||||
|
||||
|
||||
@@ -83,14 +83,14 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
final String name = this.extractor.get();
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setUnlocalizedName( "appliedenergistics2." + name );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( this.featured.getTileEntityClass(), this.featured );
|
||||
}
|
||||
|
||||
registryName = new ResourceLocation( AppEng.MOD_ID, "tile." + name );
|
||||
registryName = new ResourceLocation( AppEng.MOD_ID, name );
|
||||
|
||||
// Bypass the forge magic with null to register our own itemblock later.
|
||||
GameRegistry.register( this.featured.setRegistryName( registryName ) );
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
@@ -87,22 +88,26 @@ public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
{
|
||||
if( this.enabled )
|
||||
{
|
||||
final String name = this.extractor.get();
|
||||
String name = this.extractor.get();
|
||||
if( Item.REGISTRY.containsKey( new ResourceLocation( AppEng.MOD_ID, name ) ) )
|
||||
{
|
||||
name += "_block";
|
||||
}
|
||||
this.featured.setCreativeTab( CreativeTab.instance );
|
||||
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
|
||||
this.featured.setUnlocalizedName( "appliedenergistics2." + name );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( this.featured.getTileEntityClass(), this.featured );
|
||||
}
|
||||
|
||||
registryName = new ResourceLocation( AppEng.MOD_ID, "tile." + name );
|
||||
registryName = new ResourceLocation( AppEng.MOD_ID, name );
|
||||
|
||||
GameRegistry.register( this.featured.setRegistryName( registryName ) );
|
||||
GameRegistry.register( this.definition.maybeItem().get().setRegistryName( registryName ) );
|
||||
AEBaseTile.registerTileItem( this.featured.getTileEntityClass(), new BlockStackSrc( this.featured, 0, ActivityState.from( this.isFeatureAvailable() ) ) );
|
||||
|
||||
GameRegistry.registerTileEntity( this.featured.getTileEntityClass(), this.featured.toString() );
|
||||
GameRegistry.registerTileEntityWithAlternatives( this.featured.getTileEntityClass(), this.featured.toString() );
|
||||
|
||||
if( side == Side.CLIENT )
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.features;
|
||||
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
@@ -30,6 +31,9 @@ public class FeatureNameExtractor
|
||||
private static final Pattern PATTERN_ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
|
||||
private static final Pattern PATTERN_QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
|
||||
|
||||
private static final Pattern PATTERN_LOWERCASE = Pattern.compile( "([\\p{Upper}])([\\p{Upper}]+)" );
|
||||
private static final Pattern PATTERN_LOWERCASER = Pattern.compile( "(.)?([\\p{Upper}])" );
|
||||
|
||||
private final Class<?> clazz;
|
||||
private final Optional<String> subName;
|
||||
|
||||
@@ -40,6 +44,60 @@ public class FeatureNameExtractor
|
||||
}
|
||||
|
||||
public String get()
|
||||
{
|
||||
String ret;
|
||||
String name = this.clazz.getSimpleName().replaceFirst( "\\p{Upper}[\\p{Lower}]*(\\p{Upper})", "$1" );
|
||||
|
||||
if( this.subName.isPresent() )
|
||||
{
|
||||
final String subName = this.subName.get();
|
||||
// simple hack to allow me to do get nice names for these without
|
||||
// mode code outside of AEBaseItem
|
||||
if( subName.startsWith( "P2PTunnel" ) )
|
||||
{
|
||||
ret = "p2ptunnel";
|
||||
}
|
||||
else if( subName.equals( "CertusQuartzTools" ) )
|
||||
{
|
||||
ret = PATTERN_QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
|
||||
}
|
||||
else if( subName.equals( "NetherQuartzTools" ) )
|
||||
{
|
||||
ret = PATTERN_QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = name + '_' + subName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = name;
|
||||
}
|
||||
|
||||
System.out.println( ret );
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
Matcher m = PATTERN_LOWERCASE.matcher( ret );
|
||||
while( m.find() )
|
||||
{
|
||||
m.appendReplacement( buffer, m.group( 1 ) + m.group( 2 ).toLowerCase() );
|
||||
}
|
||||
m.appendTail( buffer );
|
||||
m = PATTERN_LOWERCASER.matcher( buffer.toString() );
|
||||
buffer = new StringBuffer();
|
||||
while( m.find() )
|
||||
{
|
||||
m.appendReplacement( buffer, ( m.group( 1 ) != null ? m.group( 1 ) + '_' : "" ) + m.group( 2 ).toLowerCase() );
|
||||
}
|
||||
m.appendTail( buffer );
|
||||
ret = buffer.toString().replace( '.', '_' ).replaceAll( "_+", "_" );
|
||||
System.out.println( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
// To Convert devs' test worlds
|
||||
@Deprecated
|
||||
public String getOld()
|
||||
{
|
||||
String name = this.clazz.getSimpleName();
|
||||
|
||||
|
||||
@@ -77,7 +77,10 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
if( this.enabled )
|
||||
{
|
||||
String name = this.extractor.get();
|
||||
final String itemPhysicalName = name;
|
||||
if( Item.REGISTRY.containsKey( new ResourceLocation( AppEng.MOD_ID, name ) ) )
|
||||
{
|
||||
name += "_item";
|
||||
}
|
||||
|
||||
// this.item.setTextureName( "appliedenergistics2:" + name );
|
||||
this.item.setUnlocalizedName( "appliedenergistics2." + name );
|
||||
@@ -91,15 +94,6 @@ public final class ItemFeatureHandler implements IFeatureHandler
|
||||
this.item.setCreativeTab( CreativeTab.instance );
|
||||
}
|
||||
|
||||
if( name.equals( "ItemMaterial" ) )
|
||||
{
|
||||
name = "ItemMultiMaterial";
|
||||
}
|
||||
else if( name.equals( "ItemPart" ) )
|
||||
{
|
||||
name = "ItemMultiPart";
|
||||
}
|
||||
|
||||
registryName = new ResourceLocation( AppEng.MOD_ID, name );
|
||||
GameRegistry.register( this.item.setRegistryName( registryName ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user