|
| 1 | +package juuxel.adorn.block; |
| 2 | + |
| 3 | +import juuxel.adorn.block.variant.BlockVariant; |
| 4 | +import juuxel.adorn.item.TradingStationItem; |
| 5 | +import juuxel.adorn.lib.AdornSounds; |
| 6 | +import juuxel.adorn.lib.registry.Registered; |
| 7 | +import juuxel.adorn.lib.registry.Registrar; |
| 8 | +import juuxel.adorn.lib.registry.RegistrarFactory; |
| 9 | +import juuxel.adorn.lib.registry.RegistryHelper; |
| 10 | +import juuxel.adorn.platform.PlatformBridges; |
| 11 | +import juuxel.adorn.util.ExtensionsKt; |
| 12 | +import net.minecraft.block.AbstractBlock; |
| 13 | +import net.minecraft.block.Block; |
| 14 | +import net.minecraft.block.Blocks; |
| 15 | +import net.minecraft.block.MapColor; |
| 16 | +import net.minecraft.block.Oxidizable; |
| 17 | +import net.minecraft.block.TorchBlock; |
| 18 | +import net.minecraft.block.WallTorchBlock; |
| 19 | +import net.minecraft.item.Item; |
| 20 | +import net.minecraft.particle.ParticleTypes; |
| 21 | +import net.minecraft.registry.RegistryKeys; |
| 22 | +import net.minecraft.sound.BlockSoundGroup; |
| 23 | +import net.minecraft.util.DyeColor; |
| 24 | + |
| 25 | +import java.util.Map; |
| 26 | + |
| 27 | +public final class AdornBlocks { |
| 28 | + public static final Registrar<Block> BLOCKS = RegistrarFactory.get().create(RegistryKeys.BLOCK); |
| 29 | + public static final Registrar<Item> ITEMS = RegistrarFactory.get().create(RegistryKeys.ITEM); |
| 30 | + private static final RegistryHelper HELPER = new RegistryHelper(BLOCKS, ITEMS); |
| 31 | + |
| 32 | + public static final Registered<Map<DyeColor, SofaBlock>> SOFAS = ExtensionsKt.associateLazily( |
| 33 | + DyeColor.values(), |
| 34 | + color -> HELPER.registerBlock( |
| 35 | + color.asString() + "_sofa", |
| 36 | + () -> PlatformBridges.Companion.getBlockFactory().createSofa(BlockVariant.wool(color)) |
| 37 | + ) |
| 38 | + ); |
| 39 | + |
| 40 | + public static final Registered<Block> BRICK_CHIMNEY = HELPER.registerBlock("brick_chimney", |
| 41 | + () -> new ChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.RED))); |
| 42 | + public static final Registered<Block> STONE_BRICK_CHIMNEY = HELPER.registerBlock("stone_brick_chimney", |
| 43 | + () -> new ChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.STONE_GRAY))); |
| 44 | + public static final Registered<Block> NETHER_BRICK_CHIMNEY = HELPER.registerBlock("nether_brick_chimney", |
| 45 | + () -> new ChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.DARK_RED))); |
| 46 | + public static final Registered<Block> RED_NETHER_BRICK_CHIMNEY = HELPER.registerBlock("red_nether_brick_chimney", |
| 47 | + () -> new ChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.DARK_RED))); |
| 48 | + public static final Registered<Block> COBBLESTONE_CHIMNEY = HELPER.registerBlock("cobblestone_chimney", |
| 49 | + () -> new ChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.STONE_GRAY))); |
| 50 | + public static final Registered<Block> PRISMARINE_CHIMNEY = HELPER.registerBlock("prismarine_chimney", |
| 51 | + () -> new PrismarineChimneyBlock(AbstractChimneyBlock.createBlockSettings(MapColor.CYAN, 1.5f))); |
| 52 | + public static final Registered<Block> MAGMATIC_PRISMARINE_CHIMNEY = HELPER.registerBlock("magmatic_prismarine_chimney", |
| 53 | + () -> new PrismarineChimneyBlock.WithColumn(true, AbstractChimneyBlock.createBlockSettings(MapColor.CYAN, 1.5f).luminance(state -> 3))); |
| 54 | + public static final Registered<Block> SOULFUL_PRISMARINE_CHIMNEY = HELPER.registerBlock("soulful_prismarine_chimney", |
| 55 | + () -> new PrismarineChimneyBlock.WithColumn(false, AbstractChimneyBlock.createBlockSettings(MapColor.CYAN, 1.5f))); |
| 56 | + |
| 57 | + public static final Registered<Map<DyeColor, Block>> TABLE_LAMPS = ExtensionsKt.associateLazily( |
| 58 | + DyeColor.values(), |
| 59 | + color -> HELPER.registerBlock(color.asString() + "_table_lamp", () -> new TableLampBlock(TableLampBlock.createBlockSettings(color))) |
| 60 | + ); |
| 61 | + |
| 62 | + public static final Registered<Block> TRADING_STATION = HELPER.registerBlock( |
| 63 | + "trading_station", |
| 64 | + block -> new TradingStationItem(block, new Item.Settings()), |
| 65 | + () -> new TradingStationBlock(AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(2.5f).sounds(BlockSoundGroup.WOOD)) |
| 66 | + ); |
| 67 | + |
| 68 | + public static final Registered<Block> STONE_TORCH_GROUND = HELPER.registerBlockWithoutItem("stone_torch", |
| 69 | + () -> new TorchBlock( |
| 70 | + ParticleTypes.FLAME, |
| 71 | + AbstractBlock.Settings.copy(Blocks.TORCH) |
| 72 | + .sounds(BlockSoundGroup.STONE) |
| 73 | + .luminance(state -> 15) |
| 74 | + )); |
| 75 | + |
| 76 | + public static final Registered<Block> STONE_TORCH_WALL = HELPER.registerBlockWithoutItem("wall_stone_torch", |
| 77 | + () -> new WallTorchBlock( |
| 78 | + ParticleTypes.FLAME, |
| 79 | + AbstractBlock.Settings.copy(STONE_TORCH_GROUND.get()).dropsLike(STONE_TORCH_GROUND.get()) |
| 80 | + )); |
| 81 | + |
| 82 | + public static final Registered<Block> CRATE = HELPER.registerBlock("crate", |
| 83 | + () -> new Block(ExtensionsKt.copySettingsSafely(Blocks.OAK_PLANKS))); |
| 84 | + public static final Registered<Block> APPLE_CRATE = registerCrate("apple_crate"); |
| 85 | + public static final Registered<Block> WHEAT_CRATE = registerCrate("wheat_crate"); |
| 86 | + public static final Registered<Block> CARROT_CRATE = registerCrate("carrot_crate"); |
| 87 | + public static final Registered<Block> POTATO_CRATE = registerCrate("potato_crate"); |
| 88 | + public static final Registered<Block> MELON_CRATE = registerCrate("melon_crate"); |
| 89 | + public static final Registered<Block> WHEAT_SEED_CRATE = registerCrate("wheat_seed_crate"); |
| 90 | + public static final Registered<Block> MELON_SEED_CRATE = registerCrate("melon_seed_crate"); |
| 91 | + public static final Registered<Block> PUMPKIN_SEED_CRATE = registerCrate("pumpkin_seed_crate"); |
| 92 | + public static final Registered<Block> BEETROOT_CRATE = registerCrate("beetroot_crate"); |
| 93 | + public static final Registered<Block> BEETROOT_SEED_CRATE = registerCrate("beetroot_seed_crate"); |
| 94 | + public static final Registered<Block> SWEET_BERRY_CRATE = registerCrate("sweet_berry_crate"); |
| 95 | + public static final Registered<Block> COCOA_BEAN_CRATE = registerCrate("cocoa_bean_crate"); |
| 96 | + public static final Registered<Block> NETHER_WART_CRATE = registerCrate("nether_wart_crate"); |
| 97 | + public static final Registered<Block> SUGAR_CANE_CRATE = registerCrate("sugar_cane_crate"); |
| 98 | + public static final Registered<Block> EGG_CRATE = registerCrate("egg_crate"); |
| 99 | + public static final Registered<Block> HONEYCOMB_CRATE = registerCrate("honeycomb_crate"); |
| 100 | + public static final Registered<Block> LIL_TATER_CRATE = registerCrate("lil_tater_crate"); |
| 101 | + |
| 102 | + public static final Registered<Block> PICKET_FENCE = HELPER.registerBlock("picket_fence", |
| 103 | + () -> new PicketFenceBlock(AbstractBlock.Settings.copy(Blocks.OAK_FENCE).nonOpaque())); |
| 104 | + public static final Registered<Block> CHAIN_LINK_FENCE = HELPER.registerBlock("chain_link_fence", |
| 105 | + () -> new ChainLinkFenceBlock( |
| 106 | + AbstractBlock.Settings.copy(Blocks.IRON_BARS) |
| 107 | + .sounds(AdornSounds.CHAIN_LINK_FENCE) |
| 108 | + )); |
| 109 | + public static final Registered<Block> STONE_LADDER = HELPER.registerBlock("stone_ladder", |
| 110 | + () -> new StoneLadderBlock(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque())); |
| 111 | + public static final Registered<Block> BREWER = HELPER.registerBlock("brewer", |
| 112 | + () -> new BrewerBlock( |
| 113 | + AbstractBlock.Settings.create() |
| 114 | + .mapColor(MapColor.DEEPSLATE_GRAY) |
| 115 | + .solid() |
| 116 | + .strength(0.8F) |
| 117 | + .requiresTool() |
| 118 | + )); |
| 119 | + |
| 120 | + public static final Registered<Block> CANDLELIT_LANTERN = HELPER.registerBlock("candlelit_lantern", |
| 121 | + () -> new CandlelitLanternBlock(CandlelitLanternBlock.createBlockSettings())); |
| 122 | + public static final Registered<Map<DyeColor, Block>> DYED_CANDLELIT_LANTERNS = ExtensionsKt.associateLazily( |
| 123 | + DyeColor.values(), |
| 124 | + color -> HELPER.registerBlock( |
| 125 | + color.asString() + "_candlelit_lantern", |
| 126 | + () -> new CandlelitLanternBlock(CandlelitLanternBlock.createBlockSettings()) |
| 127 | + ) |
| 128 | + ); |
| 129 | + |
| 130 | + public static final Registered<Block> COPPER_PIPE = HELPER.registerBlock("copper_pipe", |
| 131 | + () -> new OxidizableCopperPipeBlock( |
| 132 | + Oxidizable.OxidationLevel.UNAFFECTED, |
| 133 | + AbstractBlock.Settings.create() |
| 134 | + .requiresTool() |
| 135 | + .strength(3f, 5f) |
| 136 | + .sounds(BlockSoundGroup.COPPER) |
| 137 | + .mapColor(MapColor.ORANGE) |
| 138 | + )); |
| 139 | + public static final Registered<Block> EXPOSED_COPPER_PIPE = HELPER.registerBlock("exposed_copper_pipe", |
| 140 | + () -> new OxidizableCopperPipeBlock( |
| 141 | + Oxidizable.OxidationLevel.EXPOSED, |
| 142 | + AbstractBlock.Settings.create() |
| 143 | + .requiresTool() |
| 144 | + .strength(3f, 5f) |
| 145 | + .sounds(BlockSoundGroup.COPPER) |
| 146 | + .mapColor(MapColor.TERRACOTTA_LIGHT_GRAY) |
| 147 | + )); |
| 148 | + public static final Registered<Block> WEATHERED_COPPER_PIPE = HELPER.registerBlock("weathered_copper_pipe", |
| 149 | + () -> new OxidizableCopperPipeBlock( |
| 150 | + Oxidizable.OxidationLevel.WEATHERED, |
| 151 | + AbstractBlock.Settings.create() |
| 152 | + .requiresTool() |
| 153 | + .strength(3f, 5f) |
| 154 | + .sounds(BlockSoundGroup.COPPER) |
| 155 | + .mapColor(MapColor.DARK_AQUA) |
| 156 | + )); |
| 157 | + public static final Registered<Block> OXIDIZED_COPPER_PIPE = HELPER.registerBlock("oxidized_copper_pipe", |
| 158 | + () -> new OxidizableCopperPipeBlock( |
| 159 | + Oxidizable.OxidationLevel.OXIDIZED, |
| 160 | + AbstractBlock.Settings.create() |
| 161 | + .requiresTool() |
| 162 | + .strength(3f, 5f) |
| 163 | + .sounds(BlockSoundGroup.COPPER) |
| 164 | + .mapColor(MapColor.TEAL) |
| 165 | + )); |
| 166 | + public static final Registered<Block> WAXED_COPPER_PIPE = HELPER.registerBlock("waxed_copper_pipe", |
| 167 | + () -> new CopperPipeBlock(AbstractBlock.Settings.copy(COPPER_PIPE.get()))); |
| 168 | + public static final Registered<Block> WAXED_EXPOSED_COPPER_PIPE = HELPER.registerBlock("waxed_exposed_copper_pipe", |
| 169 | + () -> new CopperPipeBlock(AbstractBlock.Settings.copy(EXPOSED_COPPER_PIPE.get()))); |
| 170 | + public static final Registered<Block> WAXED_WEATHERED_COPPER_PIPE = HELPER.registerBlock("waxed_weathered_copper_pipe", |
| 171 | + () -> new CopperPipeBlock(AbstractBlock.Settings.copy(WEATHERED_COPPER_PIPE.get()))); |
| 172 | + public static final Registered<Block> WAXED_OXIDIZED_COPPER_PIPE = HELPER.registerBlock("waxed_oxidized_copper_pipe", |
| 173 | + () -> new CopperPipeBlock(AbstractBlock.Settings.copy(OXIDIZED_COPPER_PIPE.get()))); |
| 174 | + |
| 175 | + public static void init() { |
| 176 | + } |
| 177 | + |
| 178 | + private static Registered<Block> registerCrate(String name) { |
| 179 | + return HELPER.registerBlock(name, () -> new Item.Settings().recipeRemainder(CRATE.get().asItem()), () -> new Block(ExtensionsKt.copySettingsSafely(CRATE.get()))); |
| 180 | + } |
| 181 | +} |
0 commit comments