Jump to content

[SOLVED] Bounding Box not stopping players from walking into large 3d Object


ScottehBoeh

Recommended Posts

I'm developing my Apocalypse mod, as many people know, and I'm having issus with setting up a bounding box around one of our map objects:

 

D8vF0FN.jpg

 

I've created a rediculous 8x8 bound box on the block class file:

 

BlockBuilding_Shop1.class:

public class BlockBuilding_Shop1 extends BlockContainer

{

    public BlockBuilding_Shop1()

    {

        super(Material.wood);

        this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F);

    }

 

    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack){

        int rotation = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

        if (rotation == 0) {

 

            world.setBlockMetadataWithNotify(x, y, z, 2, 2);

        }

        if (rotation == 1) {

            world.setBlockMetadataWithNotify(x, y, z, 5, 2);

        }

        if (rotation == 2) {

            world.setBlockMetadataWithNotify(x, y, z, 3, 2);

        }

        if (rotation == 3) {

            world.setBlockMetadataWithNotify(x, y, z, 4, 2);

        }

    }

 

    public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){

        int meta = world.getBlockMetadata(x, y, z);

        if(meta==2)

            this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F);

        if(meta==5)

            this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F);

        if(meta==3)

            this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F);

        if(meta==4)

            this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F);

    }

 

    @Override

    public TileEntity createNewTileEntity(World world, int var1)

    {

        return new EntityBuilding_Shop1();

    }

 

    @Override

    public int getRenderType()

    {

        return -1;

    }

 

    @Override

    public boolean isOpaqueCube()

    {

        return false;

    }

 

    public boolean renderAsNormalBlock()

    {

        return false;

    }

 

 

}

 

WvMWSnT.png

 

Anyone know why players can still enter through the sides/walls of the building apart from one 1x1 block area?

 

Thanks, Forge Community!

 

 

Link to comment
Share on other sites

You can sorta cheat with bounding boxes, but only in the +Y direction (see: fences), but in general you can't get larger than 1x1x1

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

It doesn't work because how would the AI know that that block (which is set to air) is covered by the bounding box from that block waaaay over there?

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