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.

Featured Replies

Posted

Hello, I am porting my mod from 1.8.9 to 1.9.4 and I have an issue. I have a block with many blockstates that "fills" up when right-clicked by a water bucket and then reverts to its initial blockstate when right-clicked when it is in the "full" blockstate. However I have many errors and corrected many of them however a few baffle me.

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {

		if (state.getValue(TYPE) == EnumType.EMPTY){
		ItemStack itemstack = playerIn.getCurrentEquippedItem();
		if (itemstack.getItem() == Items.WATER_BUCKET){
			worldIn.setBlockState(pos, (this.blockState.getBaseState().withProperty(TYPE, EnumType.FULL)));
			if (!playerIn.capabilities.isCreativeMode) {
				playerIn.destroyCurrentEquippedItem();
				return true;
				}

		}

 

My first problem with the code above is that playerIn.destroyCurrentEquippedItem() and playerIn.getCurrentEquippedItem() appear to have been moved but where? Secondly it says that is no function to override onBlockActivated.

 

@Override
public boolean isOpaqueCube(){
	return false;
}
@Override
public boolean isFullCube()
    {
        return false;
    }
    public void setBlockBoundsForItemRender()
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
    }
   public void addCollisionBoxesToList(World worldIn, BlockPos pos, BlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
        super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);

 

isOpapueCude() , .setBlockBounds, addCollisionBoxesToList and isFullCude() appear not exist have they been moved?

Also, what is the 1.9.4 replacement for BLockstate?

Thanks in advance.

@Deprecated != Deprecated

 

Mojang miss-uses this annotation to mark "internal" methods that should only be overriden by sub-classes.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

setHeldItem(MAINHAND, null) does not recognize MAINHAND.

[me=diesieben07]screams in pain and frustration[/me]

 

Sorry, :(

What happened to MovingObjectPosition was it moved?

  • Author

Lastly, is this what you meant for getBoundingBox?

 

public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
    {
        this.getBlockBounds(state, (0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F), pos);
    }

  • Author

So you mean something like this:

 

@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World worldIn, BlockPos pos)
    {
        return this.getBoundingBox(state, (0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F), pos);
        	
    }

  • Author

	
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
    {
        this.getCollisionBoundingBox(state, (0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F), pos);
    }

 

Is this closer to the end result? This is somewhat confusing. I replaced getBoundingBox with getCollisionBoundngBox as it returns  getBoundingBox,

  • Author

I get it now. This looks like it would work.

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
	return AABB_BLOCK;
}

 

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.