Jump to content

Recommended Posts

Posted

Hi I was creating a Directional Block (a Furnace) and i received an exception. Console Error:

  Reveal hidden contents

Even if the Error says: "Caused by: at com.mistergamer.mysticalmod.world.biome.BiomeMystical.<init>(BiomeMystical.java:14), at com.mistergamer.mysticalmod.init.BiomeInit.<clinit>(BiomeInit.java:15), at com.mistergamer.mysticalmod.Main.PreInit(Main.java:58)", there are no errors here, so it's a createBlockState() method error.

 

Here it is the code:

	public final PropertyDirection FACING = PropertyDirection.create("facing");
	
	public ReversingFurnaceBlock(String name, Material material) {
		super(name, material);
		
		setSoundType(SoundType.METAL);
		setHardness(12.0F);
		setResistance(52.0F);
		setHarvestLevel("pickaxe", 2);
		setCreativeTab(Main.tabMystical);
		this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
	}
	
	@Override
	protected BlockStateContainer createBlockState() {
		return new BlockStateContainer(this, new IProperty[] {FACING});
	}
	
	@Override
	public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
		worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()));
	}
	
	public int getMetaFromState(IBlockState state) {
		return ((EnumFacing)state.getValue(FACING)).getIndex();
	}

	public IBlockState getStateFromMeta(int meta) {
		EnumFacing enumfacing = EnumFacing.getFront(meta);

        if (enumfacing.getAxis() == EnumFacing.Axis.Y)
        {
            enumfacing = EnumFacing.NORTH;
        }

        return this.getDefaultState().withProperty(FACING, enumfacing);
	}
	
	@Override
	public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float 		hitX, float hitY, float hitZ) {
		ReversingFurnaceTileEntity te = (ReversingFurnaceTileEntity)world.getTileEntity(pos);
		if(te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH)) {
			player.openGui(Main.instance, GuiHandler.REVERSING_FURNACE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
			return true;
		}
		return super.onBlockActivated(world, pos, state, player, hand, facing, hitX, hitY, hitZ);
	}
	
	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta) {
		return new ReversingFurnaceTileEntity();
	}

 

Thank you very much.

Posted

This is the real error:

  On 6/29/2019 at 6:27 PM, MisterGamer _ said:

Caused by: java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[down, up, north, south, west, east]} as it does not exist in BlockStateContainer{block=null, properties=[]}

Expand  

 

Originating at:

  On 6/29/2019 at 6:27 PM, MisterGamer _ said:

at com.mistergamer.mysticalmod.init.ModBlocks.<clinit>(ModBlocks.java:41)

Expand  

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.

Posted

Would've been nice if you included more than that, but sure, that's sufficient.

 

Problematic code #14

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.