Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.10/1.9.4] Block requires a block above it to exist


Bloopers
 Share

Recommended Posts

I'd like to make it so that the block I have created will only work if there is a block above it(it's meant to hang from the ceiling)

 

I've looked into classes like carpet and plants since the only work if a block is UNDER them but I can't figure out how to make it so that it will be destroyed/can't be placed unless there is a block above.

 

This is the class I have right now:

 

package bloopers.climbing.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

public class BlockRope extends Block {

    public static final AxisAlignedBB PILLAR_AABB = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.5D, 0.625D);


public BlockRope(Material blockMaterialIn, MapColor blockMapColorIn) {
	super(Material.CLOTH, blockMapColorIn.BROWN);
}

    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
    {
	return PILLAR_AABB;

    }

    /**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }

    public boolean isFullCube(IBlockState state)
    {
        return false;
    }

    @Override
    public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }

    

}

Link to comment
Share on other sites

How does that have anything to do with it?!

You get the BlockPos above another one using the

up

method. Then you use

World#getBlockState

to get the block at a position.

(probably looking super stupid)

I still don't really understand..

What is the up method, and how am I supposed to use it?

Link to comment
Share on other sites

Do you understand Java?  At all?

 

The block is passed a World object and a BlockPos object.  Use them.

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.

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.