Jump to content

Recommended Posts

Posted

Hello, I have made a mod in eclipse and it works just fine with no errors. But when I export it as a java file and try to run it in regular minecraft, I get a crash. I have no clue why this would happen.

My crash log:

Spoiler
---- Minecraft Crash Report ----
// Ooh. Shiny.
Time: 7/10/17 4:49 PM
Description: There was a severe problem during mod loading that has caused the game to fail
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Noahs Mod (nm)
Caused by: java.lang.NoSuchMethodError: net.minecraft.block.properties.PropertyBool.create(Ljava/lang/String;)Lnet/minecraft/block/properties/PropertyBool;
 at blocks.Nuke.<clinit>(Nuke.java:30)
 at init.ModBlocks.init(ModBlocks.java:17)
 at noahsmod.main.MyMod.preInit(MyMod.java:52)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:641)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 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:246)
 at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:224)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 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:147)
 at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628)
 at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:268)
 at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:440)
 at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:352)
 at net.minecraft.client.main.Main.main(SourceFile:124)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
 at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
 Minecraft Version: 1.11.2
 Operating System: Windows 10 (amd64) version 10.0
 Java Version: 1.8.0_25, Oracle Corporation
 Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
 Memory: 118473600 bytes (112 MB) / 305926144 bytes (291 MB) up to 3207856128 bytes (3059 MB)
 JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx3G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
 IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
 FML: MCP 9.38 Powered by Forge 13.20.0.2228 7 mods loaded, 7 mods active
 States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
 UCH minecraft{1.11.2} [Minecraft] (minecraft.jar)
 UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)
 UCH FML{8.0.99.99} [Forge Mod Loader] (forge-1.11.2-13.20.0.2228.jar)
 UCH forge{13.20.0.2228} [Minecraft Forge] (forge-1.11.2-13.20.0.2228.jar)
 UCH mercurius_updater{1.0} [mercurius_updater] (MercuriusUpdater-1.11.jar)
 UCE nm{1.0.0} [Noahs Mod] (NukeItMod.jar)
 UCH tntmod{1.7.10} [TNTMod] (TNT-Mod-1.11.2.jar)
 Loaded coremods (and transformers):
 GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13476 Compatibility Profile Context 22.19.171.257' Renderer: 'Radeon (TM) RX 480 Graphics'

Looks like this is the main problem class:

Spoiler
package blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTNT;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import noahsmod.main.MyMod;
public class Nuke extends BlockTNT{
 
 
  public static final PropertyBool EXPLODE = PropertyBool.create("explode");
    public Nuke()
    {
       setHardness(0.0F);
       setUnlocalizedName(MyMod.MyBlocks.NUKE.getUnlocalizedName());
       setRegistryName(MyMod.MyBlocks.NUKE.getRegistryName());
       setHardness(2F);
       setResistance(5F);
       setSoundType(SoundType.PLANT);
       setHarvestLevel("pickaxe", 2);
        this.setCreativeTab(CreativeTabs.REDSTONE);
    }
   
   
 
    /**
     * Called after the block is set in the Chunk data, but before the Tile Entity is set
     */
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        super.onBlockAdded(worldIn, pos, state);
        if (worldIn.isBlockPowered(pos))
        {
            this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
            worldIn.setBlockToAir(pos);
        }
    }
    /**
     * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
     * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
     * block, etc.
     */
    public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
    {
        if (worldIn.isBlockPowered(pos))
        {
            this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
            worldIn.setBlockToAir(pos);
        }
    }
    /**
     * Called when this Block is destroyed by an Explosion
     */
    public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
    {
        if (!worldIn.isRemote)
        {
            NukePrimed nukeprimed = new NukePrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
            nukeprimed.setFuse((short)(worldIn.rand.nextInt(nukeprimed.getFuse() / 4) + nukeprimed.getFuse() / 8));
            worldIn.spawnEntity(nukeprimed);
        }
    }
    /**
     * Called when a player destroys this Block
     */
    public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state)
    {
        this.explode(worldIn, pos, state, (EntityLivingBase)null);
    }
    public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
    {
        if (!worldIn.isRemote)
        {
            if (((Boolean)state.getValue(EXPLODE)).booleanValue())
            {
                NukePrimed nukeprimed = new NukePrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
                worldIn.spawnEntity(nukeprimed);
                worldIn.playSound((EntityPlayer)null, nukeprimed.posX, nukeprimed.posY, nukeprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 2.0F, 1.0F);
            }
        }
    }
    /**
     * Called when the block is right clicked by a player.
     */
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
        ItemStack itemstack = playerIn.getHeldItem(hand);
        if (!itemstack.isEmpty() && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE))
        {
            this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
            worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);
            if (itemstack.getItem() == Items.FLINT_AND_STEEL)
            {
                itemstack.damageItem(1, playerIn);
            }
            else if (!playerIn.capabilities.isCreativeMode)
            {
                itemstack.shrink(1);
            }
            return true;
        }
        else
        {
            return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
        }
    }
    /**
     * Called When an Entity Collided with the Block
     */
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
    {
        if (!worldIn.isRemote && entityIn instanceof EntityArrow)
        {
            EntityArrow entityarrow = (EntityArrow)entityIn;
            if (entityarrow.isBurning())
            {
                this.explode(worldIn, pos, worldIn.getBlockState(pos).withProperty(EXPLODE, Boolean.valueOf(true)), entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null);
                worldIn.setBlockToAir(pos);
            }
        }
    }
    /**
     * Return whether this block can drop from an explosion.
     */
    public boolean canDropFromExplosion(Explosion explosionIn)
    {
        return false;
    }
    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0));
    }
    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0;
    }
    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {EXPLODE});
    }
}
   
   
  
   

 

Posted
3 minutes ago, Franckyi said:

It won't work. Do what I said and it should work.

I got this

Spoiler
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 59.061 secs

 

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.