Помогите с броней!

Статус
В этой теме нельзя размещать новые ответы.
13
0
Все сделал но при запуске minecraft crash( Вот код:
Код:
Main Class:
package assets.mechanicalthings.src;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid=ModInfo.MODID, name=ModInfo.NAME, version=ModInfo.VERSION)
@NetworkMod(clientSideRequired=true, serverSideRequired=true)

public class MechanicalThings {
    @Mod.Instance(ModInfo.MODID)
    public static MechanicalThings mod;
    /** Dimension ID **/
    
    
    /** Fishing Rod **/
    
    
    /** Furnace **/
    private GuiHandlerFurnace guiHandlerFurnace = new GuiHandlerFurnace();
    public static Block grinder;
    public static Block grinderActive;
    public static int grinderID;
    public static int grinderActiveID;
    
    
    /** Table **/
    
    
    /** Blocks **/
    public static final Block uranOre = new UranOre(3001).setUnlocalizedName("UranOre");
    
    /** Items **/
    public static Item uran = new Uran(3002).setUnlocalizedName("Uran");
    
    /** Biome's **/
    
    
    /** Materials **/
    public static EnumToolMaterial toolMaterialUranium;
    public static EnumArmorMaterial armorMaterialUranium;
    
    
    /** Mobs **/
    
    
    /** Tools **/
    public static Item itemSwordUranium;
    
    
    /** Armor **/
    public static Item itemArmorUraniumH;
    public static Item itemArmorUraniumC;
    public static Item itemArmorUraniumL;
    public static Item itemArmorUraniumB;
    
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
        Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        config.load();
        
        grinderID = config.getBlock("grinder ID", 3070, (String)null).getInt();
        grinderActiveID = config.getBlock("grinderActive ID", 3071, (String)null).getInt();
        
        config.save();
    }

    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        /** Armor **/
        itemArmorUraniumH = new ItemUraniumArmor(7012, armorMaterialUranium, 0, 0, "Uranium").setUnlocalizedName("UraniumH");
        itemArmorUraniumC = new ItemUraniumArmor(7012, armorMaterialUranium, 0, 1, "Uranium").setUnlocalizedName("UraniumC");
        itemArmorUraniumL = new ItemUraniumArmor(7012, armorMaterialUranium, 0, 2, "Uranium").setUnlocalizedName("UraniumL");
        itemArmorUraniumB = new ItemUraniumArmor(7012, armorMaterialUranium, 0, 3, "Uranium").setUnlocalizedName("UraniumB");
        
        
        /** Furnace **/
        grinder = new BlockGrinder(grinderID, false).setHardness(3.5F).setResistance(2000.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("grinder").setCreativeTab(CreativeTabs.tabBlock);
        grinderActive = new BlockGrinder(grinderActiveID, true).setHardness(3.5F).setResistance(2000.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("grinder").setCreativeTab(CreativeTabs.tabBlock);
        
        GameRegistry.registerBlock(grinder, "grinder");
        GameRegistry.registerBlock(grinderActive, "grinderActive");
        LanguageRegistry.addName(grinder, "Grinder");
        
        GameRegistry.registerTileEntity(TileEntityGrinder.class, "tileEntityGrinder");
        
        
        RenderingRegistry.registerBlockHandler(2105, RenderGrinder.INSTANCE);
        NetworkRegistry.instance().registerGuiHandler(this, guiHandlerFurnace);    
        
        /** Mobs **/
        
        
        /** Table **/
        
        
        /** Fishing Rod **/
        
        
        /** Materials **/
        toolMaterialUranium = EnumHelper.addToolMaterial("UraniumToolMaterial", 4, 825, 9.0F, 3.5F, 15);
        armorMaterialUranium = EnumHelper.addArmorMaterial("UraniumArmorMaterial", 15, new int[]{3, 6, 5, 2}, 10);
        
        
        /** Tools **/
        itemSwordUranium = new ItemSwordUranium(3000, toolMaterialUranium).setUnlocalizedName("uraniumSword");
        
       
        /** Furnace Recipes **/
        
        
        /** Register Blocks **/
        GameRegistry.registerBlock(uranOre);
        GameRegistry.registerWorldGenerator(new UranOreGenerator());
        MinecraftForge.setBlockHarvestLevel(uranOre, "pickaxe", 2);
        
        
        /** Register Items **/
        LanguageRegistry.addName(itemArmorUraniumH, "Uranium Helmet");
        LanguageRegistry.addName(itemArmorUraniumC, "Uranium Chestplate");
        LanguageRegistry.addName(itemArmorUraniumL, "Uranium Leggings");
        LanguageRegistry.addName(itemArmorUraniumB, "Uranium Boots");
        LanguageRegistry.addName(uran, "Uran");
        
        
        /** Add In-Game Names **/
        LanguageRegistry.addName(itemSwordUranium, "Uranium Sword");
        LanguageRegistry.addName(uranOre, "UranOre");
        
        
        /** Registry Biome's **/
        
        
    }

    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {

    }

    @EventHandler
    public void serverStarting(FMLServerStartingEvent event)
    {

    }
}
Код:
Armor Class:
package assets.mechanicalthings.src;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemUraniumArmor extends ItemArmor {

    public String texturePath = ModInfo.MODID + ":" + "textures/model/armor/";
    
    public ItemUraniumArmor(int par1, EnumArmorMaterial armorMaterial, int par3, int par4, String type) {
        super(par1, armorMaterial, par3, par4);
        
        this.setMaxStackSize(1);
        this.setCreativeTab(CreativeTabs.tabCombat);
        this.setTextureName(type, par4);
    }

    private void setTextureName(String type, int armorPart){
           if(armorType == 0 || armorType == 1 || armorType == 3){
               this.texturePath += type + "_layer_1";
           }else{
               this.texturePath += type + "_layer_2";
           }
    }
    
    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister register){
        this.itemIcon = register.registerIcon(ModInfo.MODID + ":" + this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".")+1));
    }
    
           public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, int layer){
               return this.texturePath;
           }            
}
 
2,955
12
1. Краш покажи хотябы. 2. А не проще ли на каждую часть создать отдельный класс?
 
13
0
Код:
---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 07.05.14 17:29
Description: Initializing game

java.lang.NullPointerException
    at net.minecraft.item.ItemArmor.<init>(ItemArmor.java:50)
    at assets.mechanicalthings.src.ItemUraniumArmor.<init>(ItemUraniumArmor.java:17)
    at assets.mechanicalthings.src.MechanicalThings.init(MechanicalThings.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)
    at net.minecraft.client.Minecraft.run(Minecraft.java:808)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:27)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at net.minecraft.item.ItemArmor.<init>(ItemArmor.java:50)
    at assets.mechanicalthings.src.ItemUraniumArmor.<init>(ItemUraniumArmor.java:17)
    at assets.mechanicalthings.src.MechanicalThings.init(MechanicalThings.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)

-- Initialization --
Details:
Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:808)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

-- System Details --
Details:
    Minecraft Version: 1.6.4
    Operating System: Windows 7 (x86) version 6.1
    Java Version: 1.7.0_51, Oracle Corporation
    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
    Memory: 912620536 bytes (870 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Suspicious classes: FML and Forge are installed
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 4 mods loaded, 4 mods active
    mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
    FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized
    Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized
    mechanicalthings{0.0.1} [MechanicalThings] (bin) Unloaded->Constructed->Pre-initialized->Errored
    Launched Version: 1.6
    LWJGL: 2.9.0
    OpenGL: GeForce 9800M GTS/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Pack: Default
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Вот краш)
 

timaxa007

Модератор
5,831
409
672
У каждой твоей части брони один и тот-же ид.
 

necauqua

когда-то был anti344
Администратор
1,216
27
172
Эй-эй, чего все такие злобные?
И да, проще одним классом броню делать.
[merge_posts_bbcode]Добавлено: 07.05.2014 23:23:03[/merge_posts_bbcode]

Особенно если её будет много.
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху