Removed old renamer

This commit is contained in:
thatsIch
2015-06-26 22:13:04 +02:00
parent 0e378d8ad4
commit 4e863e7d90
18 changed files with 432 additions and 530 deletions
-47
View File
@@ -74,17 +74,6 @@ public final class AppEng
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
// public static final String nameCustomWall = "custom_wall";
// public static final BlockWall blockCustomWall = new BlockWall( Blocks.cobblestone);
// public static final ItemMultiTexture itemCustomWall = new ItemMultiTexture(blockCustomWall, blockCustomWall, new Function<ItemStack, String>()
// {
// @Override
// public String apply(ItemStack stack)
// {
// return BlockWall.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
// }
// });
@Nonnull
private static final AppEng INSTANCE = new AppEng();
@@ -153,45 +142,9 @@ public final class AppEng
this.startService( "AE2 VersionChecker", versionCheckerThread );
}
// blockCustomWall.setUnlocalizedName(MODID + ".customWall");
// GameRegistry.registerBlock( blockCustomWall, null, nameCustomWall );
// GameRegistry.registerItem(itemCustomWall, nameCustomWall);
// GameData.getBlockItemMap().put( blockCustomWall, itemCustomWall );
//
// if (event.getSide() == Side.CLIENT)
// preInitClient(event);
AELog.info( "Pre Initialization ( ended after " + watch.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
}
// @SideOnly(Side.CLIENT)
// public void preInitClient(FMLPreInitializationEvent event)
// {
// ModelLoader.setCustomStateMapper( blockCustomWall, new IStateMapper()
// {
// StateMap stateMap = new StateMap.Builder().setProperty( BlockWall.VARIANT ).setBuilderSuffix( "_wall" ).build();
//
// @Override
// public Map<IBlockState, ModelResourceLocation> putStateModelLocations( Block block )
// {
// Map<IBlockState, ModelResourceLocation> map = (Map<IBlockState, ModelResourceLocation>) stateMap.putStateModelLocations( block );
// Map<IBlockState, ModelResourceLocation> newMap = Maps.newHashMap();
//
// for( Map.Entry<IBlockState, ModelResourceLocation> e : map.entrySet() )
// {
// ModelResourceLocation loc = e.getValue();
// newMap.put( e.getKey(), new ModelResourceLocation( ASSETS + loc.getResourcePath(), loc.getVariant() ) );
// }
//
// return newMap;
// }
// } );
// Item customWallItem = Item.getItemFromBlock(blockCustomWall);
// ModelLoader.setCustomModelResourceLocation(customWallItem, 0, new ModelResourceLocation(ASSETS + "cobblestone_wall", "inventory"));
// ModelLoader.setCustomModelResourceLocation(customWallItem, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory"));
// ModelBakery.addVariantName( customWallItem, ASSETS + "cobblestone_wall", ASSETS + "mossy_cobblestone_wall" );
// }
private void startService( String serviceName, Thread thread )
{
thread.setName( serviceName );
@@ -28,6 +28,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.SidedProxy;
import appeng.api.parts.CableRenderMode;
import appeng.block.AEBaseBlock;
import appeng.client.EffectType;
@@ -42,6 +43,8 @@ public abstract class CommonHelper
public abstract void preinit();
public abstract void init();
public abstract World getWorld();
public abstract void bindTileEntitySpecialRenderer( Class tile, AEBaseBlock blk );
@@ -21,16 +21,17 @@ package appeng.core.features;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import appeng.api.definitions.IBlockDefinition;
import appeng.block.AEBaseBlock;
import appeng.core.CommonHelper;
import appeng.core.CreativeTab;
import com.google.common.base.Optional;
public final class AEBlockFeatureHandler implements IFeatureHandler
{
@@ -69,16 +70,14 @@ public final class AEBlockFeatureHandler implements IFeatureHandler
String name = this.extractor.get();
this.featured.setCreativeTab( CreativeTab.instance );
this.featured.setUnlocalizedName( /* "tile." */"appliedenergistics2." + name );
this.featured.setBlockTextureName( name );
final String registryName = "tile." + name;
this.featured.setBlockTextureName( name );
// Bypass the forge magic with null to register our own itemblock later.
GameRegistry.registerBlock( this.featured, null, registryName );
GameRegistry.registerItem( this.definition.maybeItem().get(), registryName );
GameRegistry.registerBlock( this.featured, null, name );
GameRegistry.registerItem( this.definition.maybeItem().get(), name );
// register the block/item conversion...
if ( this.featured != null && this.definition.maybeItem().isPresent() )
if ( this.definition.maybeItem().isPresent() )
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
if ( side == Side.CLIENT)
@@ -55,6 +55,10 @@ public class FeatureNameExtractor
{
name = "stair";
}
else if ( name.startsWith( "BlockFluix" ) )
{
name = "fluix";
}
if( this.subName.isPresent() )
{
@@ -21,17 +21,18 @@ package appeng.core.features;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import appeng.api.definitions.IItemDefinition;
import appeng.core.CommonHelper;
import appeng.core.CreativeTab;
import appeng.core.CreativeTabFacade;
import appeng.items.parts.ItemFacade;
import com.google.common.base.Optional;
public final class ItemFeatureHandler implements IFeatureHandler
{
@@ -63,13 +64,13 @@ public final class ItemFeatureHandler implements IFeatureHandler
}
@Override
public void register(Side side)
public void register( Side side )
{
if( this.enabled )
{
String name = this.extractor.get();
String itemPhysicalName = name;
//this.item.setTextureName( "appliedenergistics2:" + name );
this.item.setUnlocalizedName( /* "item." */"appliedenergistics2." + name );
@@ -91,21 +92,17 @@ public final class ItemFeatureHandler implements IFeatureHandler
name = "ItemMultiPart";
}
GameRegistry.registerItem( this.item, "item." + name );
if ( side == Side.CLIENT )
// "item." +
GameRegistry.registerItem( this.item, name );
if( side == Side.CLIENT )
{
CommonHelper.proxy.configureIcon( item, itemPhysicalName );
}
}
}
private void configureIcon(
Item item,
int meta,
String name )
private void configureIcon( Item item, int meta, String name )
{
}
}
@@ -1,85 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features;
import java.util.regex.Pattern;
import appeng.items.AEBaseItem;
/**
* This class is used to rename items to match the persistent stored items.
*
* This can be removed, when a new iteration of minecraft arrives or a new world is used.
* Remember to differentiate the currently renamed items later on correctly.
*
* @deprecated only a temporary solution for a rename
*/
@Deprecated
public final class NameResolver
{
private static final Pattern ITEM_MULTI_PART = Pattern.compile( "ItemMultiPart", Pattern.LITERAL );
private static final Pattern ITEM_MULTI_MATERIAL = Pattern.compile( "ItemMultiMaterial", Pattern.LITERAL );
private static final Pattern QUARTZ = Pattern.compile( "Quartz", Pattern.LITERAL );
private final Class<? extends AEBaseItem> withOriginalName;
public NameResolver( Class<? extends AEBaseItem> withOriginalName )
{
this.withOriginalName = withOriginalName;
}
public String getName( String subName )
{
String name = this.withOriginalName.getSimpleName();
if( name.startsWith( "ItemMultiPart" ) )
{
name = ITEM_MULTI_PART.matcher( name ).replaceAll( "ItemPart" );
}
else if( name.startsWith( "ItemMultiMaterial" ) )
{
name = ITEM_MULTI_MATERIAL.matcher( name ).replaceAll( "ItemMaterial" );
}
if( subName != null )
{
// simple hack to allow me to do get nice names for these without
// mode code outside of AEBaseItem
if( subName.startsWith( "P2PTunnel" ) )
{
return "ItemPart.P2PTunnel";
}
if( subName.equals( "CertusQuartzTools" ) )
{
return QUARTZ.matcher( name ).replaceAll( "CertusQuartz" );
}
if( subName.equals( "NetherQuartzTools" ) )
{
return QUARTZ.matcher( name ).replaceAll( "NetherQuartz" );
}
name += '.' + subName;
}
return name;
}
}