Jump to content

Recommended Posts

Posted (edited)

No matter what, it gives me an execption on init when trying to register my block

 

ModBlocks Class:

Spoiler

package diegov.mod.init;

import diegov.mod.DiegovskyMod;
import diegov.mod.Reference;
import diegov.mod.blocks.BlockCheese;
import diegov.mod.blocks.BlockMyChest;
import diegov.mod.blocks.item.ItemBlockMyChest;
import diegov.mod.handlers.EnumHandler.Tiers;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {
    public static Block cheese;
    public static Block chest;
    
    public static void init(){
        cheese = new BlockCheese();
        chest = new BlockMyChest();
    }
    public static void register(){
        registerBlock(cheese);    
        registerBlock(chest,new ItemBlockMyChest(chest));
    }
    public static void registerRenders(){
        registerRender(cheese);
        for(int i = 0; i < Tiers.values().length; i++)
        registerRender(chest , i, "mychest_"+ Tiers.values().getName());
    }
    private static void registerBlock(Block block){
        block.setCreativeTab(DiegovskyMod.CREATIVE_TAB);
        GameRegistry.register(block);
        GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
    }
    
    private static void registerBlock(Block block, ItemBlock itemBlock){
        block.setCreativeTab(DiegovskyMod.CREATIVE_TAB);
        GameRegistry.register(block);
        GameRegistry.register(itemBlock.setRegistryName(block.getRegistryName()));
    }
    
    private static void registerRender(Block block){
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, block.getUnlocalizedName()), "inventory"));
    }
    private static void registerRender(Block block, int meta, String filename){
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(Reference.MODID, filename), "inventory"));
    }
}
 

My main class:

Spoiler

package diegov.mod;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import diegov.mod.init.ModBlocks;
import diegov.mod.init.ModCrafting;
import diegov.mod.init.ModItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MODID , name = Reference.NAME , version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class DiegovskyMod {
    
    public static final Logger logger = LogManager.getLogger(Reference.MODID);
    
    @SidedProxy( clientSide = Reference.CLIENTPROXY , serverSide = Reference.SERVERPROXY)
    public static diegov.mod.proxy.CommonProxy proxy;
    
    public static final CreativeTabs CREATIVE_TAB = new ModTab();
    
    @Mod.Instance
    public static DiegovskyMod instance;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event){
        proxy.registerTileEntities();
        
        ModItems.init();
        ModItems.register();
        
        ModBlocks.init();
        ModBlocks.register();
        //logger = event.getModLog();
        //proxy.preInit(event);
    }
    @EventHandler
    public void Init(FMLInitializationEvent event){
        proxy.init();
        
        ModCrafting.register();
    }
    @EventHandler
    public void postInit(FMLPostInitializationEvent event){
        //proxy.postInit(event);
    }
}

BlockMyChest class

Spoiler

package diegov.mod.blocks;

import java.util.List;

import javax.annotation.Nullable;

import diegov.mod.Reference;
import diegov.mod.handlers.EnumHandler.Tiers;
import diegov.mod.interfaces.IMetaBlockName;
import diegov.mod.tileentities.TileEntityMyChest;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

public class BlockMyChest extends Block implements ITileEntityProvider, IMetaBlockName{

    public static final PropertyEnum TIER = PropertyEnum.create("tier", Tiers.class);

    //public static Logger logger = DiegovskyMod.logger;
    TileEntityMyChest te;
    
    public BlockMyChest() {
        super(Material.GLASS);
        this.setDefaultState(this.blockState.getBaseState().withProperty(TIER, Tiers.BASIC));
        this.setRegistryName(Reference.Blocks.MYCHEST.getRegistryName());
        this.setUnlocalizedName(Reference.Blocks.MYCHEST.getUnlocalizedName());
        this.setHardness(0.5f);
    }
    @Override    
    protected BlockStateContainer createBlockState(){
        return new BlockStateContainer(this, new IProperty[] {TIER});
    }
    @Override
    public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) {
        if(worldIn.getTileEntity(pos) instanceof TileEntityMyChest)
        {
            TileEntityMyChest te = (TileEntityMyChest) worldIn.getTileEntity(pos);
            Minecraft.getMinecraft().thePlayer.sendChatMessage("ItemOnHand: "+playerIn.getHeldItemMainhand() + ", BlockItem: " + te.item + ", BlockItens: " + te.itens);
        }
        super.onBlockClicked(worldIn, pos, playerIn);
    }
    @Override
    public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,EntityPlayer player) {
        
        return new ItemStack(Item.getItemFromBlock(this),1, getMetaFromState(world.getBlockState(pos)));
    }
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        
        return false;
    }
    
    @Override
    public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) 
    {
        for(int i = 0; i < Tiers.values().length ; i++)
        {
            list.add(new ItemStack(itemIn , 1 , i));
        }
    }
    
    @Override
    public int getMetaFromState(IBlockState state) {
        Tiers Tiers = (Tiers) state.getValue(TIER);
        return Tiers.getId();
    }
    
    @Override
    public IBlockState getStateFromMeta(int meta) {
        return this.getDefaultState().withProperty(TIER, Tiers.values()[meta]);
    }
    @Override
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.TRANSLUCENT;
    }
    
    @Override
    @SuppressWarnings("unused")
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,EnumHand hand,@Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
        
        TileEntity tileentity = worldIn.getTileEntity(pos);
        if(tileentity instanceof TileEntityMyChest)
        {
            te =(TileEntityMyChest) tileentity;
            
            //remove items
            if(heldItem==null && te.nonNull())
            {
                if(side.equals(EnumFacing.UP))
                {
                    for(int index =0;;index++)
                    {
                        if(playerIn.inventory.addItemStackToInventory(new ItemStack(te.item,te.itens >64 ? 64 : te.itens)))
                        {
                            te.itens -= te.itens >64 ? 64 : te.itens;
                        }
                        else break;
                    }
                }
                
                if(playerIn.isSneaking())
                    playerIn.inventory.addItemStackToInventory(te.decrStackSize(0, 64));
                else 
                    playerIn.inventory.addItemStackToInventory(te.decrStackSize(0,1));
                return true;
            }
            //put items
            if(heldItem!=null)
            {
                if(te.nonNull() && heldItem.getItem() == te.item && heldItem.getMetadata() == te.meta)
                {
                    if(side.equals(EnumFacing.UP))
                    {    
                        for(int i = 0;i < playerIn.inventory.getSizeInventory();i++)
                        {
                            if(te.itens == te.size) break;
                            
                            if(playerIn.inventory.getStackInSlot(i) != null && playerIn.inventory.getStackInSlot(i).getItem() ==te.item || !te.nonNull())
                            {
                                if(playerIn.inventory.getStackInSlot(i).stackSize + te.itens >=te.size)
                                {
                                    te.itens = te.size;
                                    playerIn.inventory.setInventorySlotContents(i, new ItemStack(te.item,playerIn.inventory.getStackInSlot(i).stackSize+te.itens-te.size));
                                    break;
                                }
                                else
                                {
                                    te.itens += playerIn.inventory.getStackInSlot(i).stackSize;
                                    playerIn.inventory.setInventorySlotContents(i, null);
                                }
                            }
                        }
                        return true;
                    }
                    
                    if(heldItem.stackSize+te.itens > te.size)
                    {
                        playerIn.setHeldItem(hand, new ItemStack(te.item,te.itens+heldItem.stackSize-te.size));
                        te.itens =te.size;
                    }
                    else
                    {
                        te.itens += heldItem.stackSize;
                        playerIn.setHeldItem(hand, null);
                        
                    }
                    return true;
                }
                if(!te.nonNull())
                {    
                    if(side.equals(EnumFacing.UP))
                    {
                        te.item = heldItem.getItem();
                        for(int i = 0;i < playerIn.inventory.getSizeInventory();i++)
                        {
                            if(te.itens == te.size) break;
                            
                            if(playerIn.inventory.getStackInSlot(i) != null && playerIn.inventory.getStackInSlot(i).getItem() ==te.item || !te.nonNull())
                            {
                                if(playerIn.inventory.getStackInSlot(i).stackSize + te.itens >=te.size)
                                {
                                    te.itens = te.size;
                                    playerIn.inventory.setInventorySlotContents(i, new ItemStack(te.item,playerIn.inventory.getStackInSlot(i).stackSize+te.itens-te.size));
                                    break;
                                }
                                else
                                {
                                    te.itens += playerIn.inventory.getStackInSlot(i).stackSize;
                                    playerIn.inventory.setInventorySlotContents(i, null);
                                }
                            }
                        }
                        return true;
                    }
                    playerIn.setHeldItem(hand, te.addStackSize(heldItem));
                    return true;
                }
            }
            
        }
        return true;
        
}
    
    @Override
    public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
        TileEntityMyChest te = (TileEntityMyChest) worldIn.getTileEntity(pos);
        
        if(te.nonNull())
        {
            InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(this));
        }
        
        super.onBlockDestroyedByPlayer(worldIn, pos, state);
    }
    @Override
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
        
        super.breakBlock(worldIn, pos, state);
    }
    @Override
    public int damageDropped(IBlockState state) {
        return getMetaFromState(state);
    }
    
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta) {
        return null;
    }

    @Override
    public String getSpecialName(ItemStack item) {
        return Tiers.values()[item.getItemDamage()].getName();
    }
    

}

EnumHandler class:

Spoiler

package diegov.mod.handlers;

import net.minecraft.util.IStringSerializable;

public class EnumHandler{
    
    public enum Tiers implements IStringSerializable{
        BASIC(0,1280, "basic"),
        ADVANCED(1,2560,"advanced"),
        ELITE(2,3200,"elite"),
        ULTIMATE(3,6400,"ultimate");
        
        private Integer id;
        private Integer size;
        private String name;
        
        
        private Tiers(int id, int siz, String Name){
            this.id = id;
            this.size = siz;
            this.name = Name;
        }


        public Integer getId() {
            return id;
        }


        public Integer getSize() {
            return size;
        }


        public String getName() {
            return name;
        }


        @Override
        public String toString() {
            return getName();
        }
        
        
    }
}
 

TileEntityMyChest class:

Spoiler

package diegov.mod.tileentities;


import javax.annotation.Nullable;

import diegov.mod.handlers.EnumHandler.Tiers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;

public class TileEntityMyChest extends TileEntity implements IInventory{
    
    public Integer size;
    @Nullable public Item item;
    public String customName;
    public Integer itens;
    public Integer meta;
    public Tiers tier;
    
    public TileEntityMyChest(int ids) {
        this.tier = Tiers.values()[ids];
        size = this.tier.getSize();
        itens = 0;
        item = null;
        meta = 0;
    }
    
    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);
        
        nbt.setInteger("itens", itens);
        nbt.setInteger("meta", meta);
        
        NBTTagCompound comp = new NBTTagCompound();
        new ItemStack(item).writeToNBT(comp);
        nbt.setTag("item", comp);
        
        return nbt;
    }
    @Override
    public void readFromNBT(@Nullable NBTTagCompound nbt) {
        super.readFromNBT(nbt);
        
        itens = nbt.getInteger("itens");
        meta = nbt.getInteger("meta");
        try
        {
        item = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("item")).getItem();
        }catch (NullPointerException q)
        {
            item = null;
        }
    }
    @Override
    public NBTTagCompound getUpdateTag() {
        NBTTagCompound nbt = new NBTTagCompound();
        this.writeToNBT(nbt);
        return nbt;
    }
    @Override
    public void handleUpdateTag(NBTTagCompound nbt) {
        this.readFromNBT(nbt);
    }
    @Override
    public NBTTagCompound getTileData() {
        NBTTagCompound nbt = new NBTTagCompound();
        this.writeToNBT(nbt);
        return nbt;
    }
    
    /*@Override
    public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
        if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
            return (T) this.handler;
        return super.getCapability(capability, facing);
    }*/
    @Override
    public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
        if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){
            return true;
        }
        return super.hasCapability(capability, facing);
    }


    @Override
    public String getName() {
        return this.hasCustomName() ? this.customName : "container.mychest";
    }


    @Override
    public boolean hasCustomName() {
        return !this.customName.isEmpty() && !this.customName.equals(null);
    }


    @Override
    public int getSizeInventory() {
        return size/64;
    }

    
    
    @Nullable
    @Override
    public ItemStack getStackInSlot(int index) {
        if(item == null && itens > 0){
            if(itens >=64) return new ItemStack(item, 64,meta);
            else return new ItemStack(item, itens,meta);
        }
        return null;
    }
    
    @Nullable
    @Override
    public ItemStack decrStackSize(int index, int count) {
        if(nonNull())
        {
            if(itens >=count)
            {
                itens -=count;
                return new ItemStack(item,count,meta);
            }
            else
            {
                
                return setNull();
            }
        }
        return null;
    }
    public ItemStack addStackSize(ItemStack stack){
        final int count = stack.stackSize;
        if(nonNull())
        {
            if(itens+count>size)
            {
                itens = size;
                return new ItemStack(item , itens+count-size,meta);
            }
            else
            {
                itens += count;
                return null;
            }
        }
        else
        {
            item = stack.getItem();
            itens = stack.stackSize;
            meta = stack.getMetadata();
            return null;
        }
    }
    
    public boolean nonNull(){
        if(item == null)
        {
            itens = 0;
            meta = 0;
        }
        if(itens == 0) 
        {
            meta = 0;
            item = null;
        }
        
        return item !=null | itens >0;
    }
    
    
    public ItemStack setNull(){
        int tempInt = itens;
        Item tempItem = item;
        int tempMeta = meta;
        itens = 0;
        item = null;
        meta = 0;
        return new ItemStack(tempItem,tempInt,tempMeta);
    }
    
    public boolean nonNullE(ItemStack a){
        return nonNull() && a.getItem().equals(item) && a.getMetadata() == meta;
    }
    public boolean nonNullE(Item a, int meta)
    {
        return nonNullE(new ItemStack(a,0,meta));
    }
    
    @Nullable
    @Override
    public ItemStack removeStackFromSlot(int index) 
    {
        if(nonNull())
        {
            if(itens > 64)
            {
                itens -=64;
                this.markDirty();
                return new ItemStack(item,64,meta);
            }
            else{
                this.markDirty();
                return setNull();
            }
            
        }
        return null;
    }


    @Override
    public void setInventorySlotContents(int index, ItemStack stack) {
        if(isItemValidForSlot(index, stack))
        {    
            if(item == null) item = stack.getItem();
            if(meta == 0) meta = stack.getMetadata();
            if(stack.stackSize+itens > size) itens = size;
            else itens += stack.stackSize;
            
            this.markDirty();
        }
        
        
    }
    

    @Override
    public int getInventoryStackLimit() {
        return size;
    }


    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
        // TODO Auto-generated method stub
        return false;
    }


    @Override
    public void openInventory(EntityPlayer player) {
        // TODO Auto-generated method stub
        
    }


    @Override
    public void closeInventory(EntityPlayer player) {
        // TODO Auto-generated method stub
        
    }


    @Override
    public boolean isItemValidForSlot(int index, ItemStack stack) {
        if(nonNull() && stack.getItem() != item && stack.getMetadata() == meta) return false;
        return true;
        
    }


    @Override
    public int getField(int id) {
        return 0;
    }


    @Override
    public void setField(int id, int value) {
        // TODO Auto-generated method stub
        
    }


    @Override
    public int getFieldCount() {
        return 0;
    }


    @Override
    public void clear() {
        
    }
}
 

ItemBlockMyChest class:

Spoiler

package diegov.mod.blocks.item;

import diegov.mod.interfaces.IMetaBlockName;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;

public class ItemBlockMyChest extends ItemBlock{

    public ItemBlockMyChest(Block block) {
        super(block);
        if(!(block instanceof IMetaBlockName))
        {
            throw new IllegalArgumentException(String.format("The given Block %s isn't an instance of IMetaBlockName!", block.getUnlocalizedName()));
        }
        this.setHasSubtypes(true);
        this.setMaxDamage(0);
    }
    @Override
    public String getUnlocalizedName(ItemStack stack) {
        return super.getUnlocalizedName()+"."+((IMetaBlockName) this.block).getSpecialName(stack);
    }

}
 

IMetaBlockName class:

Spoiler

package diegov.mod.interfaces;

import net.minecraft.item.ItemStack;

public interface IMetaBlockName {

    String getSpecialName(ItemStack item);
}
 

 

The error:

Spoiler

[21:31:42] [Client thread/ERROR] [FML]: Caught exception from Teste Mode (diegovsky)
java.lang.ExceptionInInitializerError
    at diegov.mod.init.ModBlocks.init(ModBlocks.java:23) ~[bin/:?]
    at diegov.mod.DiegovskyMod.preInit(DiegovskyMod.java:38) ~[bin/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145) [LoadController.class:?]
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624) [Loader.class:?]
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.IllegalArgumentException: Multiple values have the same name 'null'
    at net.minecraft.block.properties.PropertyEnum.<init>(PropertyEnum.java:31) ~[PropertyEnum.class:?]
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:110) ~[PropertyEnum.class:?]
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:94) ~[PropertyEnum.class:?]
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:86) ~[PropertyEnum.class:?]
    at diegov.mod.blocks.BlockMyChest.<clinit>(BlockMyChest.java:34) ~[BlockMyChest.class:?]
    ... 45 more
[21:31:42] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 15/10/17 21:31
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Teste Mode (diegovsky)
Caused by: java.lang.ExceptionInInitializerError
    at diegov.mod.init.ModBlocks.init(ModBlocks.java:23)
    at diegov.mod.DiegovskyMod.preInit(DiegovskyMod.java:38)
    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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
    at net.minecraft.client.Minecraft.run(Minecraft.java:386)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)
Caused by: java.lang.IllegalArgumentException: Multiple values have the same name 'null'
    at net.minecraft.block.properties.PropertyEnum.<init>(PropertyEnum.java:31)
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:110)
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:94)
    at net.minecraft.block.properties.PropertyEnum.create(PropertyEnum.java:86)
    at diegov.mod.blocks.BlockMyChest.<clinit>(BlockMyChest.java:34)
    ... 45 more

 

This may be a silly problem but since I'm new to minecraft modding , I don't know what to do!

Edited by Diegovsky
Posted (edited)

Thank you!But now, it returns another IllegalArgumentExecption:

 

Spoiler


java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=tier, clazz=class diegov.mod.handlers.EnumHandler$Tiers, values=[basic, advanced, elite, ultimate]} as it does not exist in BlockStateContainer{block=null, properties=[]}
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:216) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at diegov.mod.blocks.BlockMyChest.<init>(BlockMyChest.java:41) ~[bin/:?]
    at diegov.mod.init.ModBlocks.init(ModBlocks.java:23) ~[bin/:?]
    at diegov.mod.DiegovskyMod.preInit(DiegovskyMod.java:38) ~[bin/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221) ~[forgeSrc-1.10.2-12.18.3.2316.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
    at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145) [LoadController.class:?]
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624) [Loader.class:?]
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259) [FMLClientHandler.class:?]
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_144]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_144]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
[15:58:27] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----
// Why is it breaking :(

Time: 16/10/17 15:58
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Teste Mode (diegovsky)
Caused by: java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=tier, clazz=class diegov.mod.handlers.EnumHandler$Tiers, values=[basic, advanced, elite, ultimate]} as it does not exist in BlockStateContainer{block=null, properties=[]}
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:216)
    at diegov.mod.blocks.BlockMyChest.<init>(BlockMyChest.java:41)
    at diegov.mod.init.ModBlocks.init(ModBlocks.java:23)
    at diegov.mod.DiegovskyMod.preInit(DiegovskyMod.java:38)
    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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:618)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:243)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:221)
    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.EventSubscriber.handleEvent(EventSubscriber.java:74)
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
    at com.google.common.eventbus.EventBus.post(EventBus.java:275)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:145)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:624)
    at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:259)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:477)
    at net.minecraft.client.Minecraft.run(Minecraft.java:386)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)

I updated the EnumHandler Class

 

Edited by Diegovsky
Posted
  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.