Posted January 15, 20214 yr Hello modders, I am new to modding mc, and I have a problem with custom block hitboxes. I have made a block (The little stone thing, currently called ExampleBlock to test this) with a custom model and it works just fine, but the model is quite a bit smaller than a full block, yet it still has the hitbox of a full block: Now, I did a lot of googling and found that, to get a custom hitbox, you need to override getShape(). I did that. Unfortunately, it didn't change anything. I must still be missing something, but I don't know what it is. All I want is for the hitbox/outline to be smaller, it can remain a simple box. The block file: package lellian.mc.elementology.common.blocks; import lellian.mc.elementology.common.EleRegistry; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraftforge.fml.RegistryObject; import javax.annotation.Nonnull; public class ExampleBlock extends Block { private static VoxelShape SHAPE = makeCuboidShape(4d, 0d, 4d, 12d, 4d, 12d); public static final RegistryObject<net.minecraft.block.Block> EXAMPLE_BLOCK = EleRegistry.registerBlock("example_block", () -> new Block(AbstractBlock.Properties .create(Material.ROCK) .hardnessAndResistance(3, 3) .sound(SoundType.STONE) .notSolid())); public ExampleBlock(Properties properties) { super(properties); } // Called for class loading. public static void register(){}; @Nonnull @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPE; } } I'm not sure how relevant it is, but here is also: The BlockStateProvider: package lellian.mc.elementology.client.data; import lellian.mc.elementology.common.Elementology; import lellian.mc.elementology.common.blocks.EleSimpleBlocks; import lellian.mc.elementology.common.blocks.ExampleBlock; import lellian.mc.elementology.common.blocks.MortarAndPestleBlock; import net.minecraft.block.Block; import net.minecraft.block.SlabBlock; import net.minecraft.data.DataGenerator; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.common.data.ExistingFileHelper; public class EleBlockStateProvider extends BlockStateProvider { public EleBlockStateProvider(DataGenerator gen, ExistingFileHelper exFileHelper) { super(gen, Elementology.MOD_ID, exFileHelper); } @Override protected void registerStatesAndModels() { registerBlockWithBlockItem(EleSimpleBlocks.BLUE_MANA_CRYSTAL_ORE.get()); registerBlockWithBlockItem(EleSimpleBlocks.GREEN_MANA_CRYSTAL_ORE.get()); registerBlockWithBlockItem(EleSimpleBlocks.RED_MANA_CRYSTAL_ORE.get()); registerBlockWithBlockItem(EleSimpleBlocks.WHITE_MANA_CRYSTAL_ORE.get()); registerBlockWithBlockItem(EleSimpleBlocks.MANA_CRYSTAL_BLOCK.get()); manualModel(ExampleBlock.EXAMPLE_BLOCK.get(), "example_block"); // manualModel(MortarAndPestleBlock.MORTAR_AND_PESTLE.get(), "mortar_and_pestle"); } private void registerBlockWithBlockItem(Block block){ simpleBlock(block); final ModelFile model = models().getExistingFile(block.getRegistryName()); simpleBlockItem(block, model); } private void manualModel(Block b, String name) { final ModelFile model = models().getExistingFile(modLoc("block/" + name)); simpleBlock(b, model); simpleBlockItem(b, model); } } and the model: { "parent": "minecraft:block/block", "textures": { "0": "minecraft:block/stone", "particle": "minecraft:block/stone" }, "elements": [ { "from": [4, 0, 4], "to": [12, 4, 12], "rotation": {"angle": 0, "axis": "y", "origin": [12, 8, 12]}, "faces": { "north": {"uv": [0, 0, 8, 1], "texture": "#0"}, "east": {"uv": [0, 3, 8, 4], "texture": "#0"}, "south": {"uv": [0, 2, 8, 3], "texture": "#0"}, "west": {"uv": [0, 0, 8, 2], "texture": "#0"}, "up": {"uv": [0, 0, 8, 8], "texture": "#0"}, "down": {"uv": [0, 0, 8, 8], "texture": "#0"} } } ] } Can somebody help me figure this out? Any help/idea is appreciated! Edited January 16, 20214 yr by Lellian
January 16, 20214 yr Author 31 minutes ago, poopoodice said: You've never use ExampleBlock? What do you mean? ExampleBlock is the small stone thing you see in the picture. It gets registered just fine (Via a DeferredRegistry), I can place it and then you see what is in the picture. This is about the hitbox/outline of the block, which I want to be smaller. Edited January 16, 20214 yr by Lellian
January 16, 20214 yr 1 hour ago, Lellian said: () -> new Block(AbstractBlock.Properties Cough. 1 hour ago, Lellian said: public class ExampleBlock extends Block { Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 16, 20214 yr Author 10 minutes ago, Draco18s said: Cough. Well this is embarrasing. I don't know how I missed this, but it fixed everything. Thank you very much 🤣🔫
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.