Jump to content

Techne block collisionbox/hitbox/mousebox


Recommended Posts

Hi there


I have a block that is 4.0F high


the problem is i cant click/mouse over on it past 1 block from the ground


how can i it so i can mouse over it and click it for its full height.


Please do be warned i'm not good with coding yet and wont understand if you say use this or that.


this is my current code for it


thank you


package glowsblocksandlights;

import java.util.Random;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityFlameFX;
import net.minecraft.client.particle.EntityNoteFX;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class outsidelightgassteel extends BlockContainer {

public outsidelightgassteel(int id, Material Material) {
	super(id, Material);
	setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 4.0F, 0.7F);
					// setBlockBounds(0.0f, 0.0f, 0.0f, 0.6875f, 0.9000f,0.6875f);

public TileEntity createNewTileEntity(World world) {
	// TODO Auto-generated method stub
	return new TileEntityoutsidelightgassteel();

public void updateTick(World par1World, int par2, int par3, int par4,
		Random par5Random) {
	super.updateTick(par1World, par2, par3, par4, par5Random);
	//par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate());

	if (par1World.getBlockMetadata(par2, par3, par4) == 0) {
		par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate());
		this.onBlockAdded(par1World, par2, par3, par4);

 * Called whenever the block is added into the world. Args: world, x, y, z
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
	super.onBlockAdded(par1World, par2, par3, par4);


public void registerIcons(IconRegister IconRegister) {
	blockIcon = IconRegister.registerIcon(Basicinfo.ID.toLowerCase()
			+ ":outsidelightgassteel");

public boolean isOpaqueCube() {
	return false;

public int getRenderType() {
	return -1;

public boolean renderAsNormalBlock() {
	return false;

public int tickRate() {
	   return 1;

public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
	Minecraft.getMinecraft().effectRenderer.addEffect(new EntitycusflamesFX(par1World, par2 + 0.5F, par3 + 3.25F, par4 + 0.5F, 0.0D, 0.0D, 0.0D));


Link to comment
Share on other sites

Hi Jacky2611


if you looked at my code you would see i already have that in my code


setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 4.0F, 0.7F);





How big is your model in pixel? 1 block =16px

Here could be your advertisement!

Link to comment
Share on other sites

You cannot have a block with a hitbox larger than 1 block -- you will need to use tile entities and a multiblock structure to accomplish what you are trying to do.  This is due to the way minecraft looks up the hitbox -- it has no way of knowing that when you are looking at a given X,Y,Z that you really want to pull up and use the hitbox from the block located at X,Y-1,Z.

Link to comment
Share on other sites

  • 1 month later...

Actually I think you can override a block collision block to custom size, but it is done dynamically when the collision bounding boxes are set, it is not a fixed field for the block.  You do this by @Overriding the addCollisionBoxesToList method and


public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
    // change the parameters below to what you want
    super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);


You can do interesting things with this, like changing the bounding box depending on entity type (this could create mod-resistant force field).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

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.


  • Create New...

Important Information

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