middangeardim
Members-
Posts
13 -
Joined
-
Last visited
Everything posted by middangeardim
-
[1.16]How to hide the block's CollisionBoundingBox in 1.16?
middangeardim replied to middangeardim's topic in Modder Support
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); } } -
[1.16]How to hide the block's CollisionBoundingBox in 1.16?
middangeardim replied to middangeardim's topic in Modder Support
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 -
[1.16]How to hide the block's CollisionBoundingBox in 1.16?
middangeardim replied to middangeardim's topic in Modder Support
Unfortunatly, I'm designing a cropblock. If I return an empty VoxelShape, then how can I break it?(I can't even touch it?😂) -
[1.16]How to hide the block's CollisionBoundingBox in 1.16?
middangeardim replied to middangeardim's topic in Modder Support
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? -
[1.16]How to hide the block's CollisionBoundingBox in 1.16?
middangeardim replied to middangeardim's topic in Modder Support
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? -
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?
-
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😀
-
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); } }
-
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