Advertisement
jayhillx

logs/leaves code

Aug 5th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. =======================================================================================================================================
  2. ModBlock (indented to see easier)
  3. //logs
  4. public static final RegistryObject<Block> STRAWBERRY_LOGS = BLOCKS.register("strawberry_logs", () -> new LogBlock(MaterialColor.WOOD, Block.Properties.create(Material.WOOD, MaterialColor.PINK).hardnessAndResistance(2.0F).sound(SoundType.WOOD)));
  5. public static final RegistryObject<Block> SWEET_STRAWBERRY_LOG = BLOCKS.register("sweet_strawberry_log", () -> new LogBlock(MaterialColor.WOOD, Block.Properties.create(Material.WOOD, MaterialColor.PINK).hardnessAndResistance(2.0F).sound(SoundType.WOOD)));
  6. public static final RegistryObject<Block> LAVENDER_LOG = BLOCKS.register("lavender_log", () -> new LogBlock(MaterialColor.WOOD, Block.Properties.create(Material.WOOD, MaterialColor.PURPLE).hardnessAndResistance(2.0F).sound(SoundType.WOOD)));
  7.  
  8. //leaves
  9. public static final RegistryObject<Block> STRAWBERRY_LEAVES = BLOCKS.register("strawberry_leaves", () -> new LeavesBlock(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT).notSolid()));
  10. public static final RegistryObject<Block> SWEET_STRAWBERRY_LEAVES = BLOCKS.register("sweet_strawberry_leaves", () -> new LeavesBlock(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT).notSolid()));
  11. public static final RegistryObject<Block> LAVENDER_LEAVES = BLOCKS.register("lavender_leaves", () -> new LeavesBlock(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT).notSolid()));
  12. =======================================================================================================================================
  13. ModItem
  14. //block item
  15. public static final RegistryObject<Item> STRAWBERRY_LEAVES_ITEM = ITEMS.register("strawberry_leaves", () -> new
  16. BlockItemBase(ModBlock.STRAWBERRY_LEAVES.get()));
  17. public static final RegistryObject<Item> SWEET_STRAWBERRY_LEAVES_ITEM = ITEMS.register("sweet_strawberry_leaves", () -> new BlockItemBase(ModBlock.SWEET_STRAWBERRY_LEAVES.get()));
  18. public static final RegistryObject<Item> LAVENDER_LEAVES_ITEM = ITEMS.register("lavender_leaves", () -> new BlockItemBase(ModBlock.LAVENDER_LEAVES.get()));
  19.  
  20. public static final RegistryObject<Item> STRAWBERRY_LOGS_ITEM = ITEMS.register("strawberry_logs", () -> new BlockItemBase(ModBlock.STRAWBERRY_LOGS.get()));
  21. public static final RegistryObject<Item> SWEET_STRAWBERRY_LOG_ITEM = ITEMS.register("sweet_strawberry_log", () -> new BlockItemBase(ModBlock.SWEET_STRAWBERRY_LOG.get()));
  22. public static final RegistryObject<Item> LAVENDER_LOG_ITEM = ITEMS.register("lavender_log", () -> new BlockItemBase(ModBlock.LAVENDER_LOG.get()));
  23. =======================================================================================================================================
  24. Trees(same for all trees)
  25. public class StrawberryTree extends Tree {
  26.  
  27. public static final TreeFeatureConfig STRAWBERRY_TREE_CONFIG = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(ModBlock.STRAWBERRY_LOGS.get().getDefaultState()), new SimpleBlockStateProvider(ModBlock.STRAWBERRY_LEAVES.get().getDefaultState()), new BlobFoliagePlacer(2, 0))).baseHeight(4).heightRandA(2).foliageHeight(3).ignoreVines().setSapling((IPlantable) Blocks.OAK_SAPLING).build();
  28.  
  29. @Override
  30. protected ConfiguredFeature<TreeFeatureConfig, ?> getTreeFeature(Random randomIn, boolean p_225546_2_) {
  31. return Feature.NORMAL_TREE.withConfiguration(STRAWBERRY_TREE_CONFIG);
  32. }
  33. }
  34. =======================================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement