Jump to content

middangeardim

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by middangeardim

  1. But I already Override the getShape method in the class because the cropsblock need it public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPES[state.get(this.getAgeProperty())]; } Is it possible to override another method to get the shape again? All I want is cancel the highlight, not to change the shape of the cropsblock(My brain totally mess up😱) here is the whole code in the class public class original_pumpkin_cropblock extends CropsBlock { private static final VoxelShape[] SHAPES = new VoxelShape[]{Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 10.0D, 4.0D, 10.0D), Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 11.0D, 7.0D, 11.0D), Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 11.0D, 9.0D, 11.0D), Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 9.0D, 13.0D), Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 9.0D, 13.0D), Block.makeCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 9.0D, 13.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D)}; public original_pumpkin_cropblock() { super(AbstractBlock.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().zeroHardnessAndResistance().sound(SoundType.CROP)); } @Override protected IItemProvider getSeedsItem() { return ItemRegistry.originalPumpkinSeed.get(); } public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPES[state.get(this.getAgeProperty())]; } @Override protected int getBonemealAgeIncrease(World worldIn) { return MathHelper.nextInt(worldIn.rand, 1, 2); } }
  2. actually there is only one method about shape in #Block "makeCuboidShape" and I think it doesn't help🤔 the getRenderShape means I have to change the block into a TileEntity Block
  3. Unfortunatly, I'm designing a cropblock. If I return an empty VoxelShape, then how can I break it?(I can't even touch it?😂)
  4. Well....here is code... @Mod.EventBusSubscriber() public static class MyStaticClientOnlyEventHandler { @SubscribeEvent public static void lookToBlock(DrawHighlightEvent.HighlightBlock event){ event.setCanceled(true); } } The problem is seems I canceled all highlightevent in the world. Is it possible to only cancel my mod's block's highlight?
  5. sorry about that I a noob modder, I don't know how to cancel an event, I try to write it like this but it doesn't work @SubscribeEvent public static void lookToBlock(DrawHighlightEvent.HighlightBlock event){ event.setCanceled(true); } What should I do to cancel it?
  6. In 12.2, there was a method can be Override to high the block's CollisionBoundingBox @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return Block.NULL_AABB; } But I can't find this method in Blocks anymore in 1.16,so how can I hide the block's CollisionBoundingBox in 1.16?
  7. I create a block which has a complex texture. Howerver when I trying to destroy it, the particles that appear seems terrible beacuse of the texture. Can I get a better particles when I'm breaking the blocks?
  8. well....it doesn't work,but I success finally using the setDamge(),here is the final code @Override public ItemStack getContainerItem(ItemStack itemStack) { if(itemStack.getDamage() < itemStack.getMaxDamage()){ ItemStack item = itemStack.copy(); item.setDamage(item.getDamage() + 1); return item; } return new ItemStack(Items.BUCKET); } by the way, thank you very much, both you and poopoodice😀
  9. for example,the recipe is carrot jam + bread = carrot jam bread it will recipe a carrot jam bread and return me a carrot jam which reduce 1 reduablity I need to use itemStack.damageItem(count,LivingEntity,null) to do it,but i have no idea how to get a playerEntity in this method
  10. well...I want to return a bucket after the carrot jam used up, need I add an "if" to check whether the item was used up? Which method should I use to check?
  11. no I mean, I want use this item to recipe another thing, and when recipe success,this item will reduce 1 durablity
  12. sorry about that. I want to make a item which will damage when reciping public class carrot_jam extends TieredItem { public carrot_jam() { super(ModItemTier.PUMPKINS,new Item.Properties().group(ModGroup.toolsGroup)); this.getItemStackTileEntityRenderer() } @Override public boolean hasContainerItem(ItemStack itemStack) { return true; } //here is the problem @Override public ItemStack getContainerItem(ItemStack itemStack) { itemStack.damageItem(1,player,null); return new ItemStack(Items.BUCKET); } }
  13. I'm a beginner of Modding, and I'm really confusing about how to get a playerEntity here is my code PlayerEntity player = [???] @Override public ItemStack getContainerItem(ItemStack itemStack) { itemStack.damageItem(1,player,null); return new ItemStack(Items.BUCKET); } what should I enter in the [???],I used to enter Minecraft.getInstance().player; but the game crushed because of null pointer
×
×
  • Create New...

Important Information

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