Improved registration for tools

This commit is contained in:
Emmanuel BENOîT 2016-06-16 16:33:43 +02:00
parent 284e7479f3
commit 0f5b02aea6
2 changed files with 44 additions and 16 deletions

View file

@ -0,0 +1,42 @@
package mmm.tech.tools;
import mmm.utils.URegistry;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraftforge.common.util.EnumHelper;
public class TTToolSet
{
public final ToolMaterial TOOL_MATERIAL;
public final ItemSpade SHOVEL;
public final ItemAxe AXE;
public final ItemPickaxe PICKAXE;
public final ItemSword SWORD;
public TTToolSet( final String name , final Item material , final int harvestLevel , final int maxUses ,
final float efficiency , final float damage , final int enchantability , final float axeDamage ,
final float axeSpeed )
{
this.TOOL_MATERIAL = EnumHelper
.addToolMaterial( name.toUpperCase( ) , harvestLevel , maxUses , efficiency , damage , enchantability )//
.setRepairItem( new ItemStack( material ) );
URegistry.addItem( this.SHOVEL = new TTShovel( this.TOOL_MATERIAL ) );
URegistry.addItem( this.AXE = new TTAxe( this.TOOL_MATERIAL , axeDamage , axeSpeed ) );
URegistry.addItem( this.PICKAXE = new TTPickaxe( this.TOOL_MATERIAL ) );
URegistry.addItem( this.SWORD = new TTSword( this.TOOL_MATERIAL ) );
}
}

View file

@ -2,29 +2,15 @@ package mmm.tech.tools;
import mmm.materials.Materials; import mmm.materials.Materials;
import mmm.utils.URegistry;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
public class Tools public class Tools
{ {
public static final ToolMaterial TM_COPPER; public static final TTToolSet COPPER;
public static final TTSword SWORD_COPPER;
public static final TTShovel SPADE_COPPER;
public static final TTAxe AXE_COPPER;
public static final TTPickaxe PICKAXE_COPPER;
static { static {
TM_COPPER = EnumHelper.addToolMaterial( "COPPER" , 2 , 192 , 5.0f , 1.5f , 18 )// COPPER = new TTToolSet( "copper" , Materials.COPPER.INGOT , 2 , 192 , 5.0f , 1.5f , 18 , 7 , -3 );
.setRepairItem( new ItemStack( Materials.COPPER.INGOT ) );
URegistry.addItem( SWORD_COPPER = new TTSword( Tools.TM_COPPER ) );
URegistry.addItem( SPADE_COPPER = new TTShovel( Tools.TM_COPPER ) );
URegistry.addItem( AXE_COPPER = new TTAxe( Tools.TM_COPPER , 7f , -3f ) );
URegistry.addItem( PICKAXE_COPPER = new TTPickaxe( Tools.TM_COPPER ) );
} }