Posted July 8, 20169 yr 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.
July 8, 20169 yr Author Huh, its says that getBoundingBox is deprecated, do you mean getCollisionBoundingBox? Also what is is the destroy function for getHeldItemMainhand ?
July 8, 20169 yr @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.
July 10, 20169 yr Author setHeldItem(MAINHAND, null) does not recognize MAINHAND. [me=diesieben07]screams in pain and frustration[/me] Sorry, What happened to MovingObjectPosition was it moved?
July 10, 20169 yr MovingObjectPosition was renamed to RayTraceResult . Most renames in 1.9+ are documented in this issue tracker. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 11, 20169 yr 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); }
July 11, 20169 yr 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); }
July 11, 20169 yr 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,
July 11, 20169 yr Author I get it now. This looks like it would work. @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ return AABB_BLOCK; }
July 11, 20169 yr Author I want to add stuff from my mod to vanilla generated chests in certain structures.
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.