Hello,
I recently started modding Minecraft and tried to make bocks fall when their weight is not supported.
As a POC I tried to do this with dirt and stone blocks.
So I tried to override those two blocks like this:
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents {
@SubscribeEvent
public static void onBlockRegistry(RegistryEvent.Register<Block> event) {
event.getRegistry().registerAll(
BlockList.FALLING_DIRT_BLOCK = new FallingBlock(Block.Properties.create(Material.EARTH, MaterialColor.DIRT).hardnessAndResistance(0.5F).sound(SoundType.GROUND)).setRegistryName(Objects.requireNonNull(Blocks.DIRT.getRegistryName())),
BlockList.FALLING_STONE_BLOCK = new FallingBlock(Block.Properties.create(Material.ROCK, MaterialColor.STONE).hardnessAndResistance(1.5F, 6.0F)).setRegistryName(Objects.requireNonNull(Blocks.STONE.getRegistryName()))
);
}
@SubscribeEvent
public static void onItemRegistry(RegistryEvent.Register<Item> event) {
event.getRegistry().registerAll(
ItemList.FALLING_DIRT_ITEM = new BlockItem(BlockList.FALLING_DIRT_BLOCK, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(Objects.requireNonNull(BlockList.FALLING_DIRT_BLOCK.getRegistryName())),
ItemList.FALLING_STONE_ITEM = new BlockItem(BlockList.FALLING_STONE_BLOCK, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(Objects.requireNonNull(BlockList.FALLING_STONE_BLOCK.getRegistryName()))
);
}
}
For stone blocks it works fine.
The dirt blocks on the other hand pose a problem.
After world generation all dirt blocks seem to be invisible.
I cannot see them but I also cant walk through them.
I attached an PNG to this post where the missing dirt layer(s) can be seen.
As I'm an experienced Java-developer I already tried to find my way through the forge classes but I did not find anything useful up until now.
Hope that somebody here can help.