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:
elix-x
2016-08-19 12:38:21 +02:00
parent 4abc60cf8e
commit 3d2ba425ec
697 changed files with 6939 additions and 2695 deletions
+2 -2
View File
@@ -74,7 +74,7 @@ import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration;
import appeng.hooks.TickHandler;
import appeng.items.materials.MultiItem;
import appeng.items.materials.ItemMultiItem;
import appeng.loot.ChestLoot;
import appeng.me.cache.CraftingGridCache;
import appeng.me.cache.EnergyGridCache;
@@ -252,7 +252,7 @@ public final class Registration
final IRegistryContainer registries = api.registries();
// Perform ore camouflage!
MultiItem.instance.makeUnique();
ItemMultiItem.instance.makeUnique();
final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
recipeLoader.run();
@@ -65,16 +65,16 @@ import appeng.debug.BlockChunkloader;
import appeng.debug.BlockCubeGenerator;
import appeng.debug.BlockItemGen;
import appeng.debug.BlockPhantomNode;
import appeng.decorative.solid.ChargedQuartzOreBlock;
import appeng.decorative.solid.ChiseledQuartzBlock;
import appeng.decorative.solid.FluixBlock;
import appeng.decorative.solid.QuartzBlock;
import appeng.decorative.solid.QuartzGlassBlock;
import appeng.decorative.solid.QuartzLampBlock;
import appeng.decorative.solid.QuartzOreBlock;
import appeng.decorative.solid.QuartzPillarBlock;
import appeng.decorative.solid.SkyStoneBlock;
import appeng.decorative.solid.SkyStoneBlock.SkystoneType;
import appeng.decorative.solid.BlockChargedQuartzOre;
import appeng.decorative.solid.BlockChiseledQuartz;
import appeng.decorative.solid.BlockFluix;
import appeng.decorative.solid.BlockQuartz;
import appeng.decorative.solid.BlockQuartzGlass;
import appeng.decorative.solid.BlockQuartzLamp;
import appeng.decorative.solid.BlockQuartzOre;
import appeng.decorative.solid.BlockQuartzPillar;
import appeng.decorative.solid.BlockSkyStone;
import appeng.decorative.solid.BlockSkyStone.SkystoneType;
import appeng.decorative.stair.BlockStairCommon;
@@ -162,20 +162,20 @@ public final class ApiBlocks implements IBlocks
public ApiBlocks( final DefinitionConstructor constructor )
{
// this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() );
this.quartzOre = constructor.registerBlockDefinition( new QuartzOreBlock() );
this.quartzOreCharged = constructor.registerBlockDefinition( new ChargedQuartzOreBlock() );
this.quartzOre = constructor.registerBlockDefinition( new BlockQuartzOre() );
this.quartzOreCharged = constructor.registerBlockDefinition( new BlockChargedQuartzOre() );
this.matrixFrame = constructor.registerBlockDefinition( new BlockMatrixFrame() );
this.quartz = constructor.registerBlockDefinition( new QuartzBlock() );
this.quartzPillar = constructor.registerBlockDefinition( new QuartzPillarBlock() );
this.quartzChiseled = constructor.registerBlockDefinition( new ChiseledQuartzBlock() );
this.quartzGlass = constructor.registerBlockDefinition( new QuartzGlassBlock() );
this.quartzVibrantGlass = constructor.registerBlockDefinition( new QuartzLampBlock() );
this.quartz = constructor.registerBlockDefinition( new BlockQuartz() );
this.quartzPillar = constructor.registerBlockDefinition( new BlockQuartzPillar() );
this.quartzChiseled = constructor.registerBlockDefinition( new BlockChiseledQuartz() );
this.quartzGlass = constructor.registerBlockDefinition( new BlockQuartzGlass() );
this.quartzVibrantGlass = constructor.registerBlockDefinition( new BlockQuartzLamp() );
this.quartzTorch = constructor.registerBlockDefinition( new BlockQuartzTorch() );
this.fluix = constructor.registerBlockDefinition( new FluixBlock() );
this.skyStone_stone = constructor.registerBlockDefinition( new SkyStoneBlock( SkystoneType.STONE ) );
this.skyStone_block = constructor.registerBlockDefinition( new SkyStoneBlock( SkystoneType.BLOCK ) );
this.skyStone_brick = constructor.registerBlockDefinition( new SkyStoneBlock( SkystoneType.BRICK ) );
this.skyStone_smallbrick = constructor.registerBlockDefinition( new SkyStoneBlock( SkystoneType.SMALL_BRICK ) );
this.fluix = constructor.registerBlockDefinition( new BlockFluix() );
this.skyStone_stone = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.STONE ) );
this.skyStone_block = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.BLOCK ) );
this.skyStone_brick = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.BRICK ) );
this.skyStone_smallbrick = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.SMALL_BRICK ) );
this.skyChest = constructor.registerBlockDefinition( new BlockSkyChest( SkyChestType.STONE ) );
this.skyChestBlock = constructor.registerBlockDefinition( new BlockSkyChest( SkyChestType.BLOCK ) );
this.skyCompass = constructor.registerBlockDefinition( new BlockSkyCompass() );
@@ -23,7 +23,7 @@ import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
import appeng.core.features.DamagedItemDefinition;
import appeng.items.materials.MaterialType;
import appeng.items.materials.MultiItem;
import appeng.items.materials.ItemMultiItem;
/**
@@ -105,7 +105,7 @@ public final class ApiMaterials implements IMaterials
public ApiMaterials( final DefinitionConstructor constructor )
{
final MultiItem materials = new MultiItem();
final ItemMultiItem materials = new ItemMultiItem();
constructor.registerItemDefinition( materials );
this.cell2SpatialPart = new DamagedItemDefinition( "material.cell.spatial.2", materials.createMaterial( MaterialType.Cell2SpatialPart ) );
@@ -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 ) );