Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

changing getCollisionBoundingBoxFromPool to false/true on block right click

Featured Replies

Posted

Hi im trying to change this method to true/false every time the player clicks on the block.

 

This is what I've got so far, just can't seem to get the block to change the boolean method to false, wondering if anyone had an idea how I could do this.

 

public boolean setOpen()
    {
    	return true;
    }

public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
    {
    	if(this.setOpen() == true)
    	{
    		this.setBlockBoundsBasedOnState(par1World, par2, par3, par4);
    		return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
    	}
    	else
    		return null;
    }

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
    {
    	if (par1World.isRemote)
        {
            return true;
        }
    	if(this.setOpen() == true)
    	{
    		return this.setOpen() == false;
    	}
    	else
    	return this.setOpen() == true;
    }

 

 

Hello Sir.

I made an account (was gonna anyway) to help you. Your code is as far as I care to understand, Well...

 

However, in onBlockActivated, in the if else statement, return true if setOpen is false else return true if setOpen is ture. Thus you make a loop of true.

 

Solution, if you don't know already:

//Instead of
return this.setOpen() == false;
//return
return this.setOpen();

 

 

Actually you made a big derp. SetOpen() is ALWAYS true...

Have you even learned Java? Im a partial newb and you fail.

 

There should be a variable in the class which would be called

private boolean open;

I think.

set open would SET open and another method would GET open called

getOpen

 

 

 

Example:

public void onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
    {
     if (par1World.isRemote)
        {
            return true;
        }
     if(this.getOpen() == true)
     {
     this.setOpen(false);
     }
     else{
     this.setOpen(true);
    }

private boolean open;

 

hope you get the idea. If you are trying this without java experience, go NOW AND LEARN IT.

You definitly don't get objects or you don't know how to apply.

 

Hope this post is good enough and you aren't offended, I can be a little mean sometimes,

Green0Yoshi

 

Edit:

I don't think there is a point of isRemote, it might mess it up. I didn't have time to mess around yet cause of Homework. You will need to mess around and do some reseach, any other question might apply.

 

Thanks for your time... Hopefully I can reply soon after you reply, but I'm busy, anyways.

I can't wait to start working on my mod. I haven't worked on it in a while but it is on

Github. It needs much more organization and work, I have lots of plans. :)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.