Flandre923
113 words
1 minutes
05 金西瓜

05 金西瓜#


public class ModBlock {

    public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(NeoMafishMod.MODID);

    public static final DeferredBlock<Block> GOLD_MELON = registerSimpleBlock("gold_melon", BlockBehaviour.Properties.of().mapColor(MapColor.GOLD));

    private static DeferredBlock<Block> registerBlock(String name, Supplier<Block> blockSupplier) {
        DeferredBlock<Block> register = BLOCKS.register(name, blockSupplier);
        ModItems.ITEMS.register(name,()-> new BlockItem(register.get(),new Item.Properties()));
        return register;
    }

    public static DeferredBlock<Block> registerSimpleBlock(String name, BlockBehaviour.Properties props) {
        DeferredBlock<Block> deferredBlock =  BLOCKS.registerSimpleBlock(name,props);
        ModItems.ITEMS.register(name,()-> new BlockItem(deferredBlock.get(),new Item.Properties()));
        return  deferredBlock;
    }

    public static DeferredBlock<Block> registerSimpleBlock(String name, BlockBehaviour.Properties props, Item.Properties properties) {
        DeferredBlock<Block> deferredBlock =  BLOCKS.registerSimpleBlock(name,props);
        ModItems.ITEMS.register(name,()-> new BlockItem(deferredBlock.get(),properties));
        return  deferredBlock;
    }

    public static void register(IEventBus eventBus){
        BLOCKS.register(eventBus);
    }
}

resources/assets/neomafishmod/blockstates/gold_melon.json

{
  "variants": {
    "": {
      "model": "neomafishmod:block/gold_melon"
    }
  }
}

resources/assets/neomafishmod/models/block/gold_melon.json

{
  "parent": "block/cube_column",
  "textures": {
    "end": "neomafishmod:block/gold_melon_top",
    "side": "neomafishmod:block/gold_melon_side"
  }
}

贴图

gold_melon_side

gold_melon_top

05 金西瓜
https://fuwari.vercel.app/posts/minecraft1_21_0/05_金西瓜/
Author
Flandre923
Published at
2024-08-24