Jump to content

Recommended Posts

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.

Posted

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

Posted

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);
    }

Posted

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);
        	
    }

Posted

	
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,

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.