|
| 1 | +package net.db64.homelawnsecurity.block; |
| 2 | + |
| 3 | +import net.db64.homelawnsecurity.HomeLawnSecurity; |
| 4 | +import net.db64.homelawnsecurity.block.custom.CurrencySpawnerBlock; |
| 5 | +import net.db64.homelawnsecurity.block.custom.MarkerBlock; |
| 6 | +import net.db64.homelawnsecurity.item.ModItems; |
| 7 | +import net.minecraft.block.*; |
| 8 | +import net.minecraft.item.ItemStack; |
| 9 | +import net.minecraft.item.Items; |
| 10 | +import net.minecraft.registry.RegistryKey; |
| 11 | +import net.minecraft.registry.RegistryKeys; |
| 12 | +import net.minecraft.sound.BlockSoundGroup; |
| 13 | +import net.minecraft.util.Identifier; |
| 14 | + |
| 15 | +import java.util.function.Function; |
| 16 | + |
| 17 | +public class ModBlocks { |
| 18 | + public static final Block GARDEN_BLOCK = register("garden_block", settings -> |
| 19 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.MOSS_BLOCK)); |
| 20 | + public static final Block GRAVEYARD_BLOCK = register("graveyard_block", settings -> |
| 21 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.MOSS_BLOCK)); |
| 22 | + |
| 23 | + public static final Block LAWN_BLOCK = register("lawn_block", settings -> |
| 24 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.WART_BLOCK)); |
| 25 | + |
| 26 | + public static final Block FERTILE_PATH_BLOCK_1 = register("fertile_path_block_1", settings -> |
| 27 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS)); |
| 28 | + public static final Block FERTILE_PATH_BLOCK_2 = register("fertile_path_block_2", settings -> |
| 29 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS)); |
| 30 | + public static final Block FERTILE_PATH_BLOCK_CROSS = register("fertile_path_block_cross", settings -> |
| 31 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.MUDDY_MANGROVE_ROOTS)); |
| 32 | + |
| 33 | + public static final Block ZOMBIE_PATH_BLOCK_1 = register("zombie_path_block_1", settings -> |
| 34 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT)); |
| 35 | + public static final Block ZOMBIE_PATH_BLOCK_2 = register("zombie_path_block_2", settings -> |
| 36 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT)); |
| 37 | + public static final Block ZOMBIE_PATH_BLOCK_CROSS = register("zombie_path_block_cross", settings -> |
| 38 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.GRASS_BLOCK).sounds(BlockSoundGroup.ROOTED_DIRT)); |
| 39 | + |
| 40 | + public static final Block UNSODDED_LAWN_BLOCK = register("unsodded_lawn_block", settings -> |
| 41 | + new Block(settings), AbstractBlock.Settings.copyShallow(Blocks.DIRT).sounds(BlockSoundGroup.GRAVEL)); |
| 42 | + |
| 43 | + public static final Block GARDEN_MARKER = register("garden_marker", settings -> |
| 44 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MOSS_BLOCK).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 45 | + public static final Block GRAVEYARD_MARKER = register("graveyard_marker", settings -> |
| 46 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MOSS_BLOCK).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 47 | + |
| 48 | + public static final Block LAWN_MARKER = register("lawn_marker", settings -> |
| 49 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.NETHER_SPROUTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 50 | + |
| 51 | + public static final Block FERTILE_PATH_MARKER_1 = register("fertile_path_marker_1", settings -> |
| 52 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 53 | + public static final Block FERTILE_PATH_MARKER_2 = register("fertile_path_marker_2", settings -> |
| 54 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 55 | + public static final Block FERTILE_PATH_MARKER_CROSS = register("fertile_path_marker_cross", settings -> |
| 56 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 57 | + |
| 58 | + public static final Block ZOMBIE_PATH_MARKER_1 = register("zombie_path_marker_1", settings -> |
| 59 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 60 | + public static final Block ZOMBIE_PATH_MARKER_2 = register("zombie_path_marker_2", settings -> |
| 61 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 62 | + public static final Block ZOMBIE_PATH_MARKER_CROSS = register("zombie_path_marker_cross", settings -> |
| 63 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.HANGING_ROOTS).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 64 | + |
| 65 | + public static final Block UNSODDED_LAWN_MARKER = register("unsodded_lawn_marker", settings -> |
| 66 | + new MarkerBlock(settings), AbstractBlock.Settings.create().sounds(BlockSoundGroup.MUD).strength(-1.0f, 3600000.8f).nonOpaque()); |
| 67 | + |
| 68 | + public static final Block SUN_SPAWNER = register("sun_spawner", settings -> |
| 69 | + new CurrencySpawnerBlock(settings, new ItemStack(ModItems.SUN)), AbstractBlock.Settings.copyShallow(Blocks.STONE).sounds(BlockSoundGroup.HEAVY_CORE).ticksRandomly()); |
| 70 | + public static final Block BRAINPOWER_BEACON = register("brainpower_beacon", settings -> |
| 71 | + new CurrencySpawnerBlock(settings, new ItemStack(ModItems.BRAINPOWER)), AbstractBlock.Settings.copyShallow(Blocks.STONE).sounds(BlockSoundGroup.HEAVY_CORE).ticksRandomly()); |
| 72 | + |
| 73 | + private static Block register(String id, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings, boolean obtainable) |
| 74 | + { |
| 75 | + Block block = Blocks.register(keyOf(id), factory, settings); |
| 76 | + if (obtainable) |
| 77 | + Items.register(block); |
| 78 | + return block; |
| 79 | + } |
| 80 | + |
| 81 | + private static Block register(String id, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings) { |
| 82 | + return register(id, factory, settings, true); |
| 83 | + } |
| 84 | + |
| 85 | + /*private static Item registerBlockItem(String name, Block block) { |
| 86 | + return Registry.register(Registries.ITEM, RegistryKey.of(RegistryKeys.ITEM, Identifier.of(HomeLawnSecurity.MOD_ID, name)), |
| 87 | + new BlockItem(block, new Item.Settings())); |
| 88 | + }*/ |
| 89 | + |
| 90 | + private static RegistryKey<Block> keyOf(String id) { |
| 91 | + return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(HomeLawnSecurity.MOD_ID, id)); |
| 92 | + } |
| 93 | + |
| 94 | + public static void registerModBlocks() { |
| 95 | + HomeLawnSecurity.LOGGER.debug("Registering blocks for " + HomeLawnSecurity.MOD_ID); |
| 96 | + } |
| 97 | + |
| 98 | + public static class BlockSetTypes { |
| 99 | + //public static BlockSetType RUBBER_WOOD = new BlockSetType("rubber_wood", true, true, true, BlockSetType.ActivationRule.EVERYTHING, ModSounds.BlockSoundGroups.RUBBER_WOOD, ModSounds.RUBBERWOOD_DOOR_CLOSE, ModSounds.RUBBERWOOD_DOOR_OPEN, ModSounds.RUBBERWOOD_TRAPDOOR_CLOSE, ModSounds.RUBBERWOOD_TRAPDOOR_OPEN, ModSounds.RUBBERWOOD_PRESSURE_PLATE_CLICK_OFF, ModSounds.RUBBERWOOD_PRESSURE_PLATE_CLICK_ON, ModSounds.RUBBERWOOD_BUTTON_CLICK_OFF, ModSounds.RUBBERWOOD_BUTTON_CLICK_ON); |
| 100 | + } |
| 101 | + |
| 102 | + public static class WoodTypes { |
| 103 | + //public static WoodType RUBBER_WOOD = new WoodType("rubber_wood", BlockSetTypes.RUBBER_WOOD, ModSounds.BlockSoundGroups.RUBBER_WOOD, BlockSoundGroup.CHERRY_WOOD_HANGING_SIGN, ModSounds.RUBBERWOOD_FENCE_GATE_CLOSE, ModSounds.RUBBERWOOD_FENCE_GATE_OPEN); |
| 104 | + } |
| 105 | +} |
0 commit comments