diff --git a/src/main/java/com/refinedmods/refinedstorage/RS.java b/src/main/java/com/refinedmods/refinedstorage/RS.java index c31f743f5..49c5e3910 100644 --- a/src/main/java/com/refinedmods/refinedstorage/RS.java +++ b/src/main/java/com/refinedmods/refinedstorage/RS.java @@ -40,11 +40,11 @@ public final class RS { ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CLIENT_CONFIG.getSpec()); CommonSetup commonSetup = new CommonSetup(); + RSBlocks.register(); + RSItems.register(); FMLJavaModLoadingContext.get().getModEventBus().addListener(commonSetup::onCommonSetup); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Block.class, commonSetup::onRegisterBlocks); FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(TileEntityType.class, commonSetup::onRegisterTiles); - FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, commonSetup::onRegisterItems); FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(IRecipeSerializer.class, commonSetup::onRegisterRecipeSerializers); FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(ContainerType.class, commonSetup::onRegisterContainers); diff --git a/src/main/java/com/refinedmods/refinedstorage/RSBlocks.java b/src/main/java/com/refinedmods/refinedstorage/RSBlocks.java index 055cc3674..825d3befd 100644 --- a/src/main/java/com/refinedmods/refinedstorage/RSBlocks.java +++ b/src/main/java/com/refinedmods/refinedstorage/RSBlocks.java @@ -1,88 +1,99 @@ package com.refinedmods.refinedstorage; +import com.refinedmods.refinedstorage.api.network.NetworkType; +import com.refinedmods.refinedstorage.api.network.grid.GridType; +import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType; +import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType; import com.refinedmods.refinedstorage.block.*; -import net.minecraftforge.registries.ObjectHolder; +import com.refinedmods.refinedstorage.item.blockitem.PortableGridBlockItem; +import net.minecraft.block.Block; +import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.HashMap; +import java.util.Map; -@ObjectHolder(RS.ID) public final class RSBlocks { - @ObjectHolder("importer") - public static final ImporterBlock IMPORTER = null; - @ObjectHolder("exporter") - public static final ExporterBlock EXPORTER = null; - @ObjectHolder("detector") - public static final DetectorBlock DETECTOR = null; - @ObjectHolder("relay") - public static final RelayBlock RELAY = null; - @ObjectHolder("network_transmitter") - public static final NetworkTransmitterBlock NETWORK_TRANSMITTER = null; - @ObjectHolder("network_receiver") - public static final NetworkReceiverBlock NETWORK_RECEIVER = null; - @ObjectHolder("quartz_enriched_iron_block") - public static final QuartzEnrichedIronBlock QUARTZ_ENRICHED_IRON = null; - @ObjectHolder("machine_casing") - public static final MachineCasingBlock MACHINE_CASING = null; - @ObjectHolder("controller") - public static final ControllerBlock CONTROLLER = null; - @ObjectHolder("creative_controller") - public static final ControllerBlock CREATIVE_CONTROLLER = null; - @ObjectHolder("cable") - public static final CableBlock CABLE = null; - @ObjectHolder("disk_drive") - public static final DiskDriveBlock DISK_DRIVE = null; - @ObjectHolder("external_storage") - public static final ExternalStorageBlock EXTERNAL_STORAGE = null; - @ObjectHolder("grid") - public static final GridBlock GRID = null; - @ObjectHolder("crafting_grid") - public static final GridBlock CRAFTING_GRID = null; - @ObjectHolder("pattern_grid") - public static final GridBlock PATTERN_GRID = null; - @ObjectHolder("fluid_grid") - public static final GridBlock FLUID_GRID = null; - @ObjectHolder("1k_storage_block") - public static final StorageBlock ONE_K_STORAGE_BLOCK = null; - @ObjectHolder("4k_storage_block") - public static final StorageBlock FOUR_K_STORAGE_BLOCK = null; - @ObjectHolder("16k_storage_block") - public static final StorageBlock SIXTEEN_K_STORAGE_BLOCK = null; - @ObjectHolder("64k_storage_block") - public static final StorageBlock SIXTY_FOUR_K_STORAGE_BLOCK = null; - @ObjectHolder("creative_storage_block") - public static final StorageBlock CREATIVE_STORAGE_BLOCK = null; - @ObjectHolder("64k_fluid_storage_block") - public static final FluidStorageBlock SIXTY_FOUR_K_FLUID_STORAGE_BLOCK = null; - @ObjectHolder("256k_fluid_storage_block") - public static final FluidStorageBlock TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK = null; - @ObjectHolder("1024k_fluid_storage_block") - public static final FluidStorageBlock THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK = null; - @ObjectHolder("4096k_fluid_storage_block") - public static final FluidStorageBlock FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK = null; - @ObjectHolder("creative_fluid_storage_block") - public static final FluidStorageBlock CREATIVE_FLUID_STORAGE_BLOCK = null; - @ObjectHolder("security_manager") - public static final SecurityManagerBlock SECURITY_MANAGER = null; - @ObjectHolder("interface") - public static final InterfaceBlock INTERFACE = null; - @ObjectHolder("fluid_interface") - public static final FluidInterfaceBlock FLUID_INTERFACE = null; - @ObjectHolder("wireless_transmitter") - public static final WirelessTransmitterBlock WIRELESS_TRANSMITTER = null; - @ObjectHolder("storage_monitor") - public static final StorageMonitorBlock STORAGE_MONITOR = null; - @ObjectHolder("constructor") - public static final ConstructorBlock CONSTRUCTOR = null; - @ObjectHolder("destructor") - public static final DestructorBlock DESTRUCTOR = null; - @ObjectHolder("disk_manipulator") - public static final DiskManipulatorBlock DISK_MANIPULATOR = null; - @ObjectHolder("portable_grid") - public static final PortableGridBlock PORTABLE_GRID = null; - @ObjectHolder("creative_portable_grid") - public static final PortableGridBlock CREATIVE_PORTABLE_GRID = null; - @ObjectHolder("crafter") - public static final CrafterBlock CRAFTER = null; - @ObjectHolder("crafter_manager") - public static final CrafterManagerBlock CRAFTER_MANAGER = null; - @ObjectHolder("crafting_monitor") - public static final CraftingMonitorBlock CRAFTING_MONITOR = null; + private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, RS.ID); + + public static final RegistryObject IMPORTER; + public static final RegistryObject EXPORTER; + public static final RegistryObject DETECTOR; + public static final RegistryObject RELAY; + public static final RegistryObject NETWORK_TRANSMITTER; + public static final RegistryObject NETWORK_RECEIVER; + public static final RegistryObject QUARTZ_ENRICHED_IRON; + public static final RegistryObject MACHINE_CASING; + public static final RegistryObject CONTROLLER; + public static final RegistryObject CREATIVE_CONTROLLER; + public static final RegistryObject CABLE; + public static final RegistryObject DISK_DRIVE; + public static final RegistryObject EXTERNAL_STORAGE; + public static final RegistryObject GRID; + public static final RegistryObject CRAFTING_GRID; + public static final RegistryObject PATTERN_GRID; + public static final RegistryObject FLUID_GRID; + public static final Map> STORAGE_BLOCKS = new HashMap<>(); + public static final Map> FLUID_STORAGE_BLOCKS = new HashMap<>(); + public static final RegistryObject SECURITY_MANAGER; + public static final RegistryObject INTERFACE; + public static final RegistryObject FLUID_INTERFACE; + public static final RegistryObject WIRELESS_TRANSMITTER; + public static final RegistryObject STORAGE_MONITOR; + public static final RegistryObject CONSTRUCTOR; + public static final RegistryObject DESTRUCTOR; + public static final RegistryObject DISK_MANIPULATOR; + public static final RegistryObject PORTABLE_GRID; + public static final RegistryObject CREATIVE_PORTABLE_GRID; + public static final RegistryObject CRAFTER; + public static final RegistryObject CRAFTER_MANAGER; + public static final RegistryObject CRAFTING_MONITOR; + + static { + QUARTZ_ENRICHED_IRON = BLOCKS.register("quartz_enriched_iron_block", QuartzEnrichedIronBlock::new); + CONTROLLER = BLOCKS.register("controller", () -> new ControllerBlock(NetworkType.NORMAL)); + CREATIVE_CONTROLLER = BLOCKS.register("creative_controller", () -> new ControllerBlock(NetworkType.CREATIVE)); + MACHINE_CASING = BLOCKS.register("machine_casing", MachineCasingBlock::new); + CABLE = BLOCKS.register("cable", CableBlock::new); + DISK_DRIVE = BLOCKS.register("disk_drive", DiskDriveBlock::new); + GRID = BLOCKS.register("grid", () -> new GridBlock(GridType.NORMAL)); + CRAFTING_GRID = BLOCKS.register(GridType.CRAFTING.getString() + "_grid", () -> new GridBlock(GridType.CRAFTING)); + PATTERN_GRID = BLOCKS.register(GridType.PATTERN.getString() + "_grid", () -> new GridBlock(GridType.PATTERN)); + FLUID_GRID = BLOCKS.register(GridType.FLUID.getString() + "_grid", () -> new GridBlock(GridType.FLUID)); + + for (ItemStorageType type : ItemStorageType.values()) { + STORAGE_BLOCKS.put(type, BLOCKS.register(type.getName() + "_storage_block", () -> new StorageBlock(type))); + } + + for (FluidStorageType type : FluidStorageType.values()) { + FLUID_STORAGE_BLOCKS.put(type, BLOCKS.register(type.getName() + "_fluid_storage_block", () -> new FluidStorageBlock(type))); + } + + EXTERNAL_STORAGE = BLOCKS.register("external_storage", ExternalStorageBlock::new); + IMPORTER = BLOCKS.register("importer", ImporterBlock::new); + EXPORTER = BLOCKS.register("exporter", ExporterBlock::new); + NETWORK_RECEIVER = BLOCKS.register("network_receiver", NetworkReceiverBlock::new); + NETWORK_TRANSMITTER = BLOCKS.register("network_transmitter", NetworkTransmitterBlock::new); + RELAY = BLOCKS.register("relay", RelayBlock::new); + DETECTOR = BLOCKS.register("detector", DetectorBlock::new); + SECURITY_MANAGER = BLOCKS.register("security_manager", SecurityManagerBlock::new); + INTERFACE = BLOCKS.register("interface", InterfaceBlock::new); + FLUID_INTERFACE = BLOCKS.register("fluid_interface", FluidInterfaceBlock::new); + WIRELESS_TRANSMITTER = BLOCKS.register("wireless_transmitter", WirelessTransmitterBlock::new); + STORAGE_MONITOR = BLOCKS.register("storage_monitor", StorageMonitorBlock::new); + CONSTRUCTOR = BLOCKS.register("constructor", ConstructorBlock::new); + DESTRUCTOR = BLOCKS.register("destructor", DestructorBlock::new); + DISK_MANIPULATOR = BLOCKS.register("disk_manipulator", DiskManipulatorBlock::new); + CREATIVE_PORTABLE_GRID = BLOCKS.register("creative_portable_grid", () -> new PortableGridBlock(PortableGridBlockItem.Type.CREATIVE)); + PORTABLE_GRID = BLOCKS.register("portable_grid", () -> new PortableGridBlock(PortableGridBlockItem.Type.NORMAL)); + CRAFTER = BLOCKS.register("crafter", CrafterBlock::new); + CRAFTER_MANAGER = BLOCKS.register("crafter_manager", CrafterManagerBlock::new); + CRAFTING_MONITOR = BLOCKS.register("crafting_monitor", CraftingMonitorBlock::new); + } + + public static void register() { + BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } } \ No newline at end of file diff --git a/src/main/java/com/refinedmods/refinedstorage/RSItems.java b/src/main/java/com/refinedmods/refinedstorage/RSItems.java index 871eb1118..a389a8090 100644 --- a/src/main/java/com/refinedmods/refinedstorage/RSItems.java +++ b/src/main/java/com/refinedmods/refinedstorage/RSItems.java @@ -1,118 +1,150 @@ package com.refinedmods.refinedstorage; +import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType; +import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType; +import com.refinedmods.refinedstorage.block.BaseBlock; import com.refinedmods.refinedstorage.item.*; -import com.refinedmods.refinedstorage.item.blockitem.ControllerBlockItem; -import com.refinedmods.refinedstorage.item.blockitem.PortableGridBlockItem; -import net.minecraftforge.registries.ObjectHolder; +import com.refinedmods.refinedstorage.item.blockitem.*; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraftforge.fml.RegistryObject; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.HashMap; +import java.util.Map; -@ObjectHolder(RS.ID) public final class RSItems { - @ObjectHolder("quartz_enriched_iron") - public static final QuartzEnrichedIronItem QUARTZ_ENRICHED_IRON = null; - @ObjectHolder("silicon") - public static final SiliconItem SILICON = null; - @ObjectHolder("processor_binding") - public static final ProcessorBindingItem PROCESSOR_BINDING = null; - @ObjectHolder("wrench") - public static final WrenchItem WRENCH = null; - @ObjectHolder("pattern") - public static final PatternItem PATTERN = null; - @ObjectHolder("filter") - public static final FilterItem FILTER = null; - @ObjectHolder("storage_housing") - public static final StorageHousingItem STORAGE_HOUSING = null; - @ObjectHolder("network_card") - public static final NetworkCardItem NETWORK_CARD = null; - @ObjectHolder("security_card") - public static final SecurityCardItem SECURITY_CARD = null; - @ObjectHolder("controller") - public static final ControllerBlockItem CONTROLLER = null; - @ObjectHolder("creative_controller") - public static final ControllerBlockItem CREATIVE_CONTROLLER = null; - @ObjectHolder("construction_core") - public static final CoreItem CONSTRUCTION_CORE = null; - @ObjectHolder("destruction_core") - public static final CoreItem DESTRUCTION_CORE = null; - @ObjectHolder("raw_basic_processor") - public static final ProcessorItem RAW_BASIC_PROCESSOR = null; - @ObjectHolder("raw_improved_processor") - public static final ProcessorItem RAW_IMPROVED_PROCESSOR = null; - @ObjectHolder("raw_advanced_processor") - public static final ProcessorItem RAW_ADVANCED_PROCESSOR = null; - @ObjectHolder("basic_processor") - public static final ProcessorItem BASIC_PROCESSOR = null; - @ObjectHolder("improved_processor") - public static final ProcessorItem IMPROVED_PROCESSOR = null; - @ObjectHolder("advanced_processor") - public static final ProcessorItem ADVANCED_PROCESSOR = null; - @ObjectHolder("upgrade") - public static final UpgradeItem UPGRADE = null; - @ObjectHolder("speed_upgrade") - public static final UpgradeItem SPEED_UPGRADE = null; - @ObjectHolder("range_upgrade") - public static final UpgradeItem RANGE_UPGRADE = null; - @ObjectHolder("crafting_upgrade") - public static final UpgradeItem CRAFTING_UPGRADE = null; - @ObjectHolder("stack_upgrade") - public static final UpgradeItem STACK_UPGRADE = null; - @ObjectHolder("silk_touch_upgrade") - public static final UpgradeItem SILK_TOUCH_UPGRADE = null; - @ObjectHolder("fortune_1_upgrade") - public static final UpgradeItem FORTUNE_1_UPGRADE = null; - @ObjectHolder("fortune_2_upgrade") - public static final UpgradeItem FORTUNE_2_UPGRADE = null; - @ObjectHolder("fortune_3_upgrade") - public static final UpgradeItem FORTUNE_3_UPGRADE = null; - @ObjectHolder("wireless_grid") - public static final WirelessGridItem WIRELESS_GRID = null; - @ObjectHolder("creative_wireless_grid") - public static final WirelessGridItem CREATIVE_WIRELESS_GRID = null; - @ObjectHolder("wireless_fluid_grid") - public static final WirelessFluidGridItem WIRELESS_FLUID_GRID = null; - @ObjectHolder("creative_wireless_fluid_grid") - public static final WirelessFluidGridItem CREATIVE_WIRELESS_FLUID_GRID = null; - @ObjectHolder("1k_storage_part") - public static final StoragePartItem ONE_K_STORAGE_PART = null; - @ObjectHolder("4k_storage_part") - public static final StoragePartItem FOUR_K_STORAGE_PART = null; - @ObjectHolder("16k_storage_part") - public static final StoragePartItem SIXTEEN_K_STORAGE_PART = null; - @ObjectHolder("64k_storage_part") - public static final StoragePartItem SIXTY_FOUR_K_STORAGE_PART = null; - @ObjectHolder("1k_storage_disk") - public static final StorageDiskItem ONE_K_STORAGE_DISK = null; - @ObjectHolder("4k_storage_disk") - public static final StorageDiskItem FOUR_K_STORAGE_DISK = null; - @ObjectHolder("16k_storage_disk") - public static final StorageDiskItem SIXTEEN_K_STORAGE_DISK = null; - @ObjectHolder("64k_storage_disk") - public static final StorageDiskItem SIXTY_FOUR_K_STORAGE_DISK = null; - @ObjectHolder("creative_storage_disk") - public static final StorageDiskItem CREATIVE_STORAGE_DISK = null; - @ObjectHolder("64k_fluid_storage_part") - public static final FluidStoragePartItem SIXTY_FOUR_K_FLUID_STORAGE_PART = null; - @ObjectHolder("256k_fluid_storage_part") - public static final FluidStoragePartItem TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_PART = null; - @ObjectHolder("1024k_fluid_storage_part") - public static final FluidStoragePartItem THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_PART = null; - @ObjectHolder("4096k_fluid_storage_part") - public static final FluidStoragePartItem FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_PART = null; - @ObjectHolder("64k_fluid_storage_disk") - public static final FluidStorageDiskItem SIXTY_FOUR_K_FLUID_STORAGE_DISK = null; - @ObjectHolder("256k_fluid_storage_disk") - public static final FluidStorageDiskItem TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_DISK = null; - @ObjectHolder("1024k_fluid_storage_disk") - public static final FluidStorageDiskItem THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_DISK = null; - @ObjectHolder("4096k_fluid_storage_disk") - public static final FluidStorageDiskItem FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_DISK = null; - @ObjectHolder("creative_fluid_storage_disk") - public static final FluidStorageDiskItem CREATIVE_FLUID_STORAGE_DISK = null; - @ObjectHolder("portable_grid") - public static final PortableGridBlockItem PORTABLE_GRID = null; - @ObjectHolder("creative_portable_grid") - public static final PortableGridBlockItem CREATIVE_PORTABLE_GRID = null; - @ObjectHolder("wireless_crafting_monitor") - public static final WirelessCraftingMonitorItem WIRELESS_CRAFTING_MONITOR = null; - @ObjectHolder("creative_wireless_crafting_monitor") - public static final WirelessCraftingMonitorItem CREATIVE_WIRELESS_CRAFTING_MONITOR = null; + private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, RS.ID); + + public static final RegistryObject QUARTZ_ENRICHED_IRON; + public static final RegistryObject SILICON; + public static final RegistryObject PROCESSOR_BINDING; + public static final RegistryObject WRENCH; + public static final RegistryObject PATTERN; + public static final RegistryObject FILTER; + public static final RegistryObject STORAGE_HOUSING; + public static final RegistryObject NETWORK_CARD; + public static final RegistryObject SECURITY_CARD; + public static final RegistryObject CONTROLLER; + public static final RegistryObject CREATIVE_CONTROLLER; + public static final RegistryObject CONSTRUCTION_CORE; + public static final RegistryObject DESTRUCTION_CORE; + public static final RegistryObject WIRELESS_GRID; + public static final RegistryObject CREATIVE_WIRELESS_GRID; + public static final RegistryObject WIRELESS_FLUID_GRID; + public static final RegistryObject CREATIVE_WIRELESS_FLUID_GRID; + public static final RegistryObject PORTABLE_GRID; + public static final RegistryObject CREATIVE_PORTABLE_GRID; + public static final RegistryObject WIRELESS_CRAFTING_MONITOR; + public static final RegistryObject CREATIVE_WIRELESS_CRAFTING_MONITOR; + + public static final Map> PROCESSORS = new HashMap<>(); + + public static final Map> ITEM_STORAGE_PARTS = new HashMap<>(); + public static final Map> ITEM_STORAGE_DISKS = new HashMap<>(); + public static final Map> STORAGE_BLOCKS = new HashMap<>(); + + public static final Map> FLUID_STORAGE_PARTS = new HashMap<>(); + public static final Map> FLUID_STORAGE_DISKS = new HashMap<>(); + public static final Map> FLUID_STORAGE_BLOCKS = new HashMap<>(); + + public static final Map> UPGRADE_ITEMS = new HashMap<>(); + + static { + CONSTRUCTION_CORE = ITEMS.register("construction_core", CoreItem::new); + DESTRUCTION_CORE = ITEMS.register("destruction_core", CoreItem::new); + QUARTZ_ENRICHED_IRON = ITEMS.register("quartz_enriched_iron", QuartzEnrichedIronItem::new); + PROCESSOR_BINDING = ITEMS.register("processor_binding", ProcessorBindingItem::new); + + for (ProcessorItem.Type type : ProcessorItem.Type.values()) { + PROCESSORS.put(type, ITEMS.register(type.getName() + "_processor", ProcessorItem::new)); + } + + SILICON = ITEMS.register("silicon", SiliconItem::new); + SECURITY_CARD = ITEMS.register("security_card", SecurityCardItem::new); + NETWORK_CARD = ITEMS.register("network_card", NetworkCardItem::new); + + for (ItemStorageType type : ItemStorageType.values()) { + if (type != ItemStorageType.CREATIVE) { + ITEM_STORAGE_PARTS.put(type, ITEMS.register(type.getName() + "_storage_part", StoragePartItem::new)); + } + + ITEM_STORAGE_DISKS.put(type, ITEMS.register(type.getName() + "_storage_disk", () -> new StorageDiskItem(type))); + } + + for (FluidStorageType type : FluidStorageType.values()) { + if (type != FluidStorageType.CREATIVE) { + FLUID_STORAGE_PARTS.put(type, ITEMS.register(type.getName() + "_fluid_storage_part", FluidStoragePartItem::new)); + } + + FLUID_STORAGE_DISKS.put(type, ITEMS.register(type.getName() + "_fluid_storage_disk", () -> new FluidStorageDiskItem(type))); + } + + STORAGE_HOUSING = ITEMS.register("storage_housing", StorageHousingItem::new); + + for (UpgradeItem.Type type : UpgradeItem.Type.values()) { + UPGRADE_ITEMS.put(type, ITEMS.register(type == UpgradeItem.Type.NORMAL ? "upgrade" : type.getName() + "_upgrade", () -> new UpgradeItem(type))); + } + + WRENCH = ITEMS.register("wrench", WrenchItem::new); + PATTERN = ITEMS.register("pattern", PatternItem::new); + FILTER = ITEMS.register("filter", FilterItem::new); + PORTABLE_GRID = ITEMS.register("portable_grid", () -> new PortableGridBlockItem(PortableGridBlockItem.Type.NORMAL)); + CREATIVE_PORTABLE_GRID = ITEMS.register("creative_portable_grid", () -> new PortableGridBlockItem(PortableGridBlockItem.Type.CREATIVE)); + + createBlockItemFor(RSBlocks.QUARTZ_ENRICHED_IRON); + CONTROLLER = ITEMS.register(RSBlocks.CONTROLLER.getId().getPath(), () -> new ControllerBlockItem(RSBlocks.CONTROLLER.get())); + CREATIVE_CONTROLLER = ITEMS.register(RSBlocks.CREATIVE_CONTROLLER.getId().getPath(), () -> new ControllerBlockItem(RSBlocks.CREATIVE_CONTROLLER.get())); + createBlockItemFor(RSBlocks.MACHINE_CASING); + createBlockItemFor(RSBlocks.CABLE); + createBlockItemFor(RSBlocks.DISK_DRIVE); + createBlockItemFor(RSBlocks.GRID); + createBlockItemFor(RSBlocks.CRAFTING_GRID); + createBlockItemFor(RSBlocks.PATTERN_GRID); + createBlockItemFor(RSBlocks.FLUID_GRID); + + for (ItemStorageType type : ItemStorageType.values()) { + STORAGE_BLOCKS.put(type, ITEMS.register(RSBlocks.STORAGE_BLOCKS.get(type).getId().getPath(), () -> new StorageBlockItem(RSBlocks.STORAGE_BLOCKS.get(type).get()))); + } + + for (FluidStorageType type : FluidStorageType.values()) { + FLUID_STORAGE_BLOCKS.put(type, ITEMS.register(RSBlocks.FLUID_STORAGE_BLOCKS.get(type).getId().getPath(), () -> new FluidStorageBlockItem(RSBlocks.FLUID_STORAGE_BLOCKS.get(type).get()))); + } + + createBlockItemFor(RSBlocks.EXTERNAL_STORAGE); + createBlockItemFor(RSBlocks.IMPORTER); + createBlockItemFor(RSBlocks.EXPORTER); + createBlockItemFor(RSBlocks.NETWORK_RECEIVER); + createBlockItemFor(RSBlocks.NETWORK_TRANSMITTER); + createBlockItemFor(RSBlocks.RELAY); + createBlockItemFor(RSBlocks.DETECTOR); + createBlockItemFor(RSBlocks.SECURITY_MANAGER); + createBlockItemFor(RSBlocks.INTERFACE); + createBlockItemFor(RSBlocks.FLUID_INTERFACE); + createBlockItemFor(RSBlocks.WIRELESS_TRANSMITTER); + createBlockItemFor(RSBlocks.STORAGE_MONITOR); + createBlockItemFor(RSBlocks.CONSTRUCTOR); + createBlockItemFor(RSBlocks.DESTRUCTOR); + createBlockItemFor(RSBlocks.DISK_MANIPULATOR); + createBlockItemFor(RSBlocks.CRAFTER); + createBlockItemFor(RSBlocks.CRAFTER_MANAGER); + createBlockItemFor(RSBlocks.CRAFTING_MONITOR); + + WIRELESS_GRID = ITEMS.register("wireless_grid", () -> new WirelessGridItem(WirelessGridItem.Type.NORMAL)); + CREATIVE_WIRELESS_GRID = ITEMS.register("creative_wireless_grid", () -> new WirelessGridItem(WirelessGridItem.Type.CREATIVE)); + WIRELESS_FLUID_GRID = ITEMS.register("wireless_fluid_grid", () -> new WirelessFluidGridItem(WirelessFluidGridItem.Type.NORMAL)); + CREATIVE_WIRELESS_FLUID_GRID = ITEMS.register("creative_wireless_fluid_grid", () -> new WirelessFluidGridItem(WirelessFluidGridItem.Type.CREATIVE)); + WIRELESS_CRAFTING_MONITOR = ITEMS.register("wireless_crafting_monitor", () -> new WirelessCraftingMonitorItem(WirelessCraftingMonitorItem.Type.NORMAL)); + CREATIVE_WIRELESS_CRAFTING_MONITOR = ITEMS.register("creative_wireless_crafting_monitor", () -> new WirelessCraftingMonitorItem(WirelessCraftingMonitorItem.Type.CREATIVE)); + } + + private static RegistryObject createBlockItemFor(RegistryObject block) { + return ITEMS.register(block.getId().getPath(), () -> new BaseBlockItem(block.get(), new Item.Properties().group(RS.MAIN_GROUP))); + } + + public static void register() { + ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } } diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/DetectorNetworkNode.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/DetectorNetworkNode.java index f72860540..78b587d86 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/DetectorNetworkNode.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/DetectorNetworkNode.java @@ -65,7 +65,7 @@ public class DetectorNetworkNode extends NetworkNode implements IComparable, ITy wasPowered = powered; world.setBlockState(pos, world.getBlockState(pos).with(DetectorBlock.POWERED, powered)); - world.notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR); + world.notifyNeighborsOfStateChange(pos, RSBlocks.DETECTOR.get()); } if (canUpdate() && ticks % SPEED == 0) { diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/GridNetworkNode.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/GridNetworkNode.java index 7e936f3d4..a30aad782 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/GridNetworkNode.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/GridNetworkNode.java @@ -138,7 +138,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I return stack; } } - .addValidator(new ItemValidator(RSItems.PATTERN)) + .addValidator(new ItemValidator(RSItems.PATTERN.get())) .addListener(new NetworkNodeInventoryListener(this)) .addListener(((handler, slot, reading) -> { ItemStack pattern = handler.getStackInSlot(slot); @@ -455,7 +455,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I patterns.extractItem(0, 1, false); } - ItemStack pattern = new ItemStack(RSItems.PATTERN); + ItemStack pattern = new ItemStack(RSItems.PATTERN.get()); PatternItem.setToCurrentVersion(pattern); PatternItem.setProcessing(pattern, processingPattern); diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/NetworkTransmitterNetworkNode.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/NetworkTransmitterNetworkNode.java index 4f8cedc7a..94bb24e42 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/NetworkTransmitterNetworkNode.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/NetworkTransmitterNetworkNode.java @@ -24,7 +24,7 @@ public class NetworkTransmitterNetworkNode extends NetworkNode { public static final ResourceLocation ID = new ResourceLocation(RS.ID, "network_transmitter"); private final BaseItemHandler networkCard = new BaseItemHandler(1) - .addValidator(new ItemValidator(RSItems.NETWORK_CARD)) + .addValidator(new ItemValidator(RSItems.NETWORK_CARD.get())) .addListener(new NetworkNodeInventoryListener(this)) .addListener((handler, slot, reading) -> { ItemStack card = handler.getStackInSlot(slot); diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/SecurityManagerNetworkNode.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/SecurityManagerNetworkNode.java index 9db9a7fe0..33258b997 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/SecurityManagerNetworkNode.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/node/SecurityManagerNetworkNode.java @@ -32,7 +32,7 @@ public class SecurityManagerNetworkNode extends NetworkNode implements ISecurity private ISecurityCard globalCard; private final BaseItemHandler cardsInv = new BaseItemHandler(9 * 2) - .addValidator(new ItemValidator(RSItems.SECURITY_CARD)) + .addValidator(new ItemValidator(RSItems.SECURITY_CARD.get())) .addListener(new NetworkNodeInventoryListener(this)) .addListener(((handler, slot, reading) -> { if (!world.isRemote) { @@ -45,7 +45,7 @@ public class SecurityManagerNetworkNode extends NetworkNode implements ISecurity })); private final BaseItemHandler editCard = new BaseItemHandler(1) - .addValidator(new ItemValidator(RSItems.SECURITY_CARD)) + .addValidator(new ItemValidator(RSItems.SECURITY_CARD.get())) .addListener(new NetworkNodeInventoryListener(this)); public SecurityManagerNetworkNode(World world, BlockPos pos) { diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/FluidStorageDiskFactory.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/FluidStorageDiskFactory.java index e4cec314b..24745d791 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/FluidStorageDiskFactory.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/FluidStorageDiskFactory.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RSItems; import com.refinedmods.refinedstorage.api.storage.disk.IStorageDisk; import com.refinedmods.refinedstorage.api.storage.disk.IStorageDiskFactory; +import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType; import com.refinedmods.refinedstorage.apiimpl.storage.disk.FluidStorageDisk; import com.refinedmods.refinedstorage.item.FluidStorageDiskItem; import net.minecraft.item.ItemStack; @@ -46,19 +47,19 @@ public class FluidStorageDiskFactory implements IStorageDiskFactory FluidStorageDiskItem item; switch (disk.getCapacity()) { case 64_000: - item = RSItems.SIXTY_FOUR_K_FLUID_STORAGE_DISK; + item = RSItems.FLUID_STORAGE_DISKS.get(FluidStorageType.SIXTY_FOUR_K).get(); break; case 256_000: - item = RSItems.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_DISK; + item = RSItems.FLUID_STORAGE_DISKS.get(FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K).get(); break; case 1024_000: - item = RSItems.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_DISK; + item = RSItems.FLUID_STORAGE_DISKS.get(FluidStorageType.THOUSAND_TWENTY_FOUR_K).get(); break; case 4096_000: - item = RSItems.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_DISK; + item = RSItems.FLUID_STORAGE_DISKS.get(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K).get(); break; default: - item = RSItems.CREATIVE_FLUID_STORAGE_DISK; + item = RSItems.FLUID_STORAGE_DISKS.get(FluidStorageType.CREATIVE).get(); break; } diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/ItemStorageDiskFactory.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/ItemStorageDiskFactory.java index 5e174ce8b..5582273f3 100644 --- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/ItemStorageDiskFactory.java +++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/storage/disk/factory/ItemStorageDiskFactory.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.RSItems; import com.refinedmods.refinedstorage.api.storage.disk.IStorageDisk; import com.refinedmods.refinedstorage.api.storage.disk.IStorageDiskFactory; +import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType; import com.refinedmods.refinedstorage.apiimpl.storage.disk.ItemStorageDisk; import com.refinedmods.refinedstorage.item.StorageDiskItem; import com.refinedmods.refinedstorage.util.StackUtils; @@ -46,19 +47,19 @@ public class ItemStorageDiskFactory implements IStorageDiskFactory { StorageDiskItem item; switch (disk.getCapacity()) { case 1_000: - item = RSItems.ONE_K_STORAGE_DISK; + item = RSItems.ITEM_STORAGE_DISKS.get(ItemStorageType.ONE_K).get(); break; case 4_000: - item = RSItems.FOUR_K_STORAGE_DISK; + item = RSItems.ITEM_STORAGE_DISKS.get(ItemStorageType.FOUR_K).get(); break; case 16_000: - item = RSItems.SIXTEEN_K_STORAGE_DISK; + item = RSItems.ITEM_STORAGE_DISKS.get(ItemStorageType.SIXTEEN_K).get(); break; case 64_000: - item = RSItems.SIXTY_FOUR_K_STORAGE_DISK; + item = RSItems.ITEM_STORAGE_DISKS.get(ItemStorageType.SIXTY_FOUR_K).get(); break; default: - item = RSItems.CREATIVE_STORAGE_DISK; + item = RSItems.ITEM_STORAGE_DISKS.get(ItemStorageType.CREATIVE).get(); break; } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java index 13298291b..ad6101535 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/CableBlock.java @@ -58,7 +58,6 @@ public class CableBlock extends NetworkNodeBlock implements IWaterLoggable { public CableBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - this.setRegistryName(RS.ID, "cable"); this.setDefaultState(getDefaultState().with(NORTH, false).with(EAST, false).with(SOUTH, false).with(WEST, false).with(UP, false).with(DOWN, false).with(WATERLOGGED, false)); } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/ConstructorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/ConstructorBlock.java index bccd3ccd0..2f2952050 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/ConstructorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/ConstructorBlock.java @@ -37,8 +37,6 @@ public class ConstructorBlock extends CableBlock { public ConstructorBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - - this.setRegistryName(RS.ID, "constructor"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/ControllerBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/ControllerBlock.java index 1605503be..276910a75 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/ControllerBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/ControllerBlock.java @@ -68,7 +68,6 @@ public class ControllerBlock extends BaseBlock { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); this.type = type; - this.setRegistryName(RS.ID, type == NetworkType.CREATIVE ? "creative_controller" : "controller"); this.setDefaultState(getStateContainer().getBaseState().with(ENERGY_TYPE, EnergyType.OFF)); } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/CrafterBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/CrafterBlock.java index 0848af43c..37b0f9d1c 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/CrafterBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/CrafterBlock.java @@ -26,8 +26,6 @@ import javax.annotation.Nullable; public class CrafterBlock extends NetworkNodeBlock { public CrafterBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "crafter"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/CrafterManagerBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/CrafterManagerBlock.java index a57685d94..928871973 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/CrafterManagerBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/CrafterManagerBlock.java @@ -23,8 +23,6 @@ import javax.annotation.Nullable; public class CrafterManagerBlock extends NetworkNodeBlock { public CrafterManagerBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "crafter_manager"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/CraftingMonitorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/CraftingMonitorBlock.java index ce5ac9e85..8c700a4ee 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/CraftingMonitorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/CraftingMonitorBlock.java @@ -24,8 +24,6 @@ import javax.annotation.Nullable; public class CraftingMonitorBlock extends NetworkNodeBlock { public CraftingMonitorBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "crafting_monitor"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/DestructorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/DestructorBlock.java index 999111471..ce8fac3ca 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/DestructorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/DestructorBlock.java @@ -37,8 +37,6 @@ public class DestructorBlock extends CableBlock { public DestructorBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - - this.setRegistryName(RS.ID, "destructor"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/DetectorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/DetectorBlock.java index 68b1200ca..7b73bbc23 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/DetectorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/DetectorBlock.java @@ -35,7 +35,6 @@ public class DetectorBlock extends NetworkNodeBlock { public DetectorBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - this.setRegistryName(RS.ID, "detector"); this.setDefaultState(this.getStateContainer().getBaseState().with(POWERED, false)); } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/DiskDriveBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/DiskDriveBlock.java index cd6155fe3..a84c66980 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/DiskDriveBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/DiskDriveBlock.java @@ -24,8 +24,6 @@ import javax.annotation.Nullable; public class DiskDriveBlock extends NetworkNodeBlock { public DiskDriveBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "disk_drive"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/DiskManipulatorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/DiskManipulatorBlock.java index ae8016ebf..8068c1836 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/DiskManipulatorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/DiskManipulatorBlock.java @@ -24,8 +24,6 @@ import javax.annotation.Nullable; public class DiskManipulatorBlock extends NetworkNodeBlock { public DiskManipulatorBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "disk_manipulator"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/ExporterBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/ExporterBlock.java index b0a86230f..807f72512 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/ExporterBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/ExporterBlock.java @@ -60,8 +60,6 @@ public class ExporterBlock extends CableBlock { public ExporterBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - - this.setRegistryName(RS.ID, "exporter"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/ExternalStorageBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/ExternalStorageBlock.java index e203a2f41..fd6cb5250 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/ExternalStorageBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/ExternalStorageBlock.java @@ -41,8 +41,6 @@ public class ExternalStorageBlock extends CableBlock { public ExternalStorageBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - - this.setRegistryName(RS.ID, "external_storage"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/FluidInterfaceBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/FluidInterfaceBlock.java index c9593b812..704f5d670 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/FluidInterfaceBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/FluidInterfaceBlock.java @@ -25,8 +25,6 @@ import javax.annotation.Nullable; public class FluidInterfaceBlock extends NetworkNodeBlock { public FluidInterfaceBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "fluid_interface"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/FluidStorageBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/FluidStorageBlock.java index 3338c2b64..d9529bd1b 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/FluidStorageBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/FluidStorageBlock.java @@ -31,8 +31,6 @@ public class FluidStorageBlock extends NetworkNodeBlock { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); this.type = type; - - this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_block"); } public FluidStorageType getType() { diff --git a/src/main/java/com/refinedmods/refinedstorage/block/GridBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/GridBlock.java index 1e7dc5201..7d1dd5e6d 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/GridBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/GridBlock.java @@ -23,11 +23,10 @@ import javax.annotation.Nullable; public class GridBlock extends NetworkNodeBlock { private final GridType type; - public GridBlock(GridType type, ResourceLocation registryName) { + public GridBlock(GridType type) { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); this.type = type; - setRegistryName(registryName); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/ImporterBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/ImporterBlock.java index 02e5ca1c0..554c00d31 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/ImporterBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/ImporterBlock.java @@ -60,8 +60,6 @@ public class ImporterBlock extends CableBlock { public ImporterBlock() { super(BlockUtils.DEFAULT_GLASS_PROPERTIES); - - this.setRegistryName(RS.ID, "importer"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/InterfaceBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/InterfaceBlock.java index af441013d..d68743472 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/InterfaceBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/InterfaceBlock.java @@ -25,8 +25,6 @@ import javax.annotation.Nullable; public class InterfaceBlock extends NetworkNodeBlock { public InterfaceBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "interface"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/MachineCasingBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/MachineCasingBlock.java index 254a3be30..accf5fc0a 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/MachineCasingBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/MachineCasingBlock.java @@ -1,12 +1,9 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.util.BlockUtils; public class MachineCasingBlock extends BaseBlock { public MachineCasingBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "machine_casing"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/NetworkReceiverBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/NetworkReceiverBlock.java index e63a54c3d..6a74b4a2a 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/NetworkReceiverBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/NetworkReceiverBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.tile.NetworkReceiverTile; import com.refinedmods.refinedstorage.util.BlockUtils; import net.minecraft.block.BlockState; @@ -12,8 +11,6 @@ import javax.annotation.Nullable; public class NetworkReceiverBlock extends NetworkNodeBlock { public NetworkReceiverBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "network_receiver"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/NetworkTransmitterBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/NetworkTransmitterBlock.java index 2446e62a0..cd83e7b37 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/NetworkTransmitterBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/NetworkTransmitterBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.container.NetworkTransmitterContainer; import com.refinedmods.refinedstorage.container.factory.PositionalTileContainerProvider; import com.refinedmods.refinedstorage.tile.NetworkTransmitterTile; @@ -24,8 +23,6 @@ import javax.annotation.Nullable; public class NetworkTransmitterBlock extends NetworkNodeBlock { public NetworkTransmitterBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "network_transmitter"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/PortableGridBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/PortableGridBlock.java index 4ed803ced..2e964dc2a 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/PortableGridBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/PortableGridBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.apiimpl.API; import com.refinedmods.refinedstorage.apiimpl.network.grid.factory.PortableGridBlockGridFactory; import com.refinedmods.refinedstorage.item.blockitem.PortableGridBlockItem; @@ -40,7 +39,6 @@ public class PortableGridBlock extends BaseBlock { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); this.type = type; - this.setRegistryName(RS.ID, (type == PortableGridBlockItem.Type.CREATIVE ? "creative_" : "") + "portable_grid"); this.setDefaultState(getDefaultState().with(DISK_STATE, PortableGridDiskState.NONE).with(ACTIVE, false)); } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/QuartzEnrichedIronBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/QuartzEnrichedIronBlock.java index a49a14322..7c6bca8df 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/QuartzEnrichedIronBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/QuartzEnrichedIronBlock.java @@ -1,12 +1,9 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.util.BlockUtils; public class QuartzEnrichedIronBlock extends BaseBlock { public QuartzEnrichedIronBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "quartz_enriched_iron_block"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/block/RelayBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/RelayBlock.java index bf8ee611c..1ee2346ef 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/RelayBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/RelayBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.container.RelayContainer; import com.refinedmods.refinedstorage.container.factory.PositionalTileContainerProvider; import com.refinedmods.refinedstorage.tile.RelayTile; @@ -24,8 +23,6 @@ import javax.annotation.Nullable; public class RelayBlock extends NetworkNodeBlock { public RelayBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "relay"); } @Nullable diff --git a/src/main/java/com/refinedmods/refinedstorage/block/SecurityManagerBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/SecurityManagerBlock.java index cce194bfe..cd6941d7e 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/SecurityManagerBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/SecurityManagerBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.api.network.security.Permission; import com.refinedmods.refinedstorage.container.SecurityManagerContainer; import com.refinedmods.refinedstorage.container.factory.PositionalTileContainerProvider; @@ -25,8 +24,6 @@ import javax.annotation.Nullable; public class SecurityManagerBlock extends NetworkNodeBlock { public SecurityManagerBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "security_manager"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/StorageBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/StorageBlock.java index 6a59b06d2..81022779a 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/StorageBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/StorageBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode; import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType; import com.refinedmods.refinedstorage.container.StorageContainer; @@ -31,8 +30,6 @@ public class StorageBlock extends NetworkNodeBlock { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); this.type = type; - - this.setRegistryName(RS.ID, type.getName() + "_storage_block"); } public ItemStorageType getType() { diff --git a/src/main/java/com/refinedmods/refinedstorage/block/StorageMonitorBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/StorageMonitorBlock.java index 139e0d55e..13d2416f4 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/StorageMonitorBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/StorageMonitorBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.apiimpl.network.node.StorageMonitorNetworkNode; import com.refinedmods.refinedstorage.container.StorageMonitorContainer; import com.refinedmods.refinedstorage.container.factory.PositionalTileContainerProvider; @@ -28,8 +27,6 @@ import javax.annotation.Nullable; public class StorageMonitorBlock extends NetworkNodeBlock { public StorageMonitorBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "storage_monitor"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/block/WirelessTransmitterBlock.java b/src/main/java/com/refinedmods/refinedstorage/block/WirelessTransmitterBlock.java index a4751c987..db962a84c 100644 --- a/src/main/java/com/refinedmods/refinedstorage/block/WirelessTransmitterBlock.java +++ b/src/main/java/com/refinedmods/refinedstorage/block/WirelessTransmitterBlock.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage.block; -import com.refinedmods.refinedstorage.RS; import com.refinedmods.refinedstorage.container.WirelessTransmitterContainer; import com.refinedmods.refinedstorage.container.factory.PositionalTileContainerProvider; import com.refinedmods.refinedstorage.tile.WirelessTransmitterTile; @@ -34,8 +33,6 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock { public WirelessTransmitterBlock() { super(BlockUtils.DEFAULT_ROCK_PROPERTIES); - - this.setRegistryName(RS.ID, "wireless_transmitter"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/inventory/item/FilterItemHandler.java b/src/main/java/com/refinedmods/refinedstorage/inventory/item/FilterItemHandler.java index 28f41dd2c..c324b1ac5 100644 --- a/src/main/java/com/refinedmods/refinedstorage/inventory/item/FilterItemHandler.java +++ b/src/main/java/com/refinedmods/refinedstorage/inventory/item/FilterItemHandler.java @@ -29,7 +29,7 @@ public class FilterItemHandler extends BaseItemHandler { this.filters = filters; this.tabs = tabs; - this.addValidator(new ItemValidator(RSItems.FILTER)); + this.addValidator(new ItemValidator(RSItems.FILTER.get())); } @Override @@ -62,7 +62,7 @@ public class FilterItemHandler extends BaseItemHandler { FilterItemsItemHandler items = new FilterItemsItemHandler(filter); for (ItemStack stack : items.getFilteredItems()) { - if (stack.getItem() == RSItems.FILTER) { + if (stack.getItem() == RSItems.FILTER.get()) { addFilter(stack); } else if (!stack.isEmpty()) { filters.add(new ItemFilter(stack, compare, mode, modFilter)); diff --git a/src/main/java/com/refinedmods/refinedstorage/item/CoreItem.java b/src/main/java/com/refinedmods/refinedstorage/item/CoreItem.java index d64335306..6e4f4df9d 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/CoreItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/CoreItem.java @@ -9,9 +9,7 @@ public class CoreItem extends Item { DESTRUCTION } - public CoreItem(Type type) { + public CoreItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, type == Type.CONSTRUCTION ? "construction_core" : "destruction_core"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/FilterItem.java b/src/main/java/com/refinedmods/refinedstorage/item/FilterItem.java index 0f5c93a5a..49df50716 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/FilterItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/FilterItem.java @@ -42,8 +42,6 @@ public class FilterItem extends Item { public FilterItem() { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); - - this.setRegistryName(RS.ID, "filter"); } @Override @@ -52,7 +50,7 @@ public class FilterItem extends Item { if (!world.isRemote) { if (player.isCrouching()) { - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.FILTER)); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.FILTER.get())); } player.openContainer(new INamedContainerProvider() { diff --git a/src/main/java/com/refinedmods/refinedstorage/item/FluidStorageDiskItem.java b/src/main/java/com/refinedmods/refinedstorage/item/FluidStorageDiskItem.java index e20be772d..563f3d478 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/FluidStorageDiskItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/FluidStorageDiskItem.java @@ -38,8 +38,6 @@ public class FluidStorageDiskItem extends Item implements IStorageDiskProvider { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); this.type = type; - - this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_disk"); } @Override @@ -97,7 +95,7 @@ public class FluidStorageDiskItem extends Item implements IStorageDiskProvider { API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack)); API.instance().getStorageDiskManager((ServerWorld) world).markForSaving(); - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING)); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING.get())); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/FluidStoragePartItem.java b/src/main/java/com/refinedmods/refinedstorage/item/FluidStoragePartItem.java index cf7403c5c..3a19f6dfe 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/FluidStoragePartItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/FluidStoragePartItem.java @@ -6,24 +6,11 @@ import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType; import net.minecraft.item.Item; public class FluidStoragePartItem extends Item { - public FluidStoragePartItem(FluidStorageType type) { + public FluidStoragePartItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, type.getName() + "_fluid_storage_part"); } public static FluidStoragePartItem getByType(FluidStorageType type) { - switch (type) { - case SIXTY_FOUR_K: - return RSItems.SIXTY_FOUR_K_FLUID_STORAGE_PART; - case TWO_HUNDRED_FIFTY_SIX_K: - return RSItems.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_PART; - case THOUSAND_TWENTY_FOUR_K: - return RSItems.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_PART; - case FOUR_THOUSAND_NINETY_SIX_K: - return RSItems.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_PART; - default: - throw new IllegalArgumentException("Cannot get fluid storage part of " + type); - } + return RSItems.FLUID_STORAGE_PARTS.get(type).get(); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/NetworkCardItem.java b/src/main/java/com/refinedmods/refinedstorage/item/NetworkCardItem.java index 1902dd7c4..3fcfa08e9 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/NetworkCardItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/NetworkCardItem.java @@ -29,15 +29,13 @@ public class NetworkCardItem extends Item { public NetworkCardItem() { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); - - this.setRegistryName(RS.ID, "network_card"); } @Override public ActionResultType onItemUse(ItemUseContext ctx) { Block block = ctx.getWorld().getBlockState(ctx.getPos()).getBlock(); - if (block == RSBlocks.NETWORK_RECEIVER) { + if (block == RSBlocks.NETWORK_RECEIVER.get()) { CompoundNBT tag = new CompoundNBT(); tag.putInt(NBT_RECEIVER_X, ctx.getPos().getX()); diff --git a/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java b/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java index c34e7dd87..bcbe3aa47 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/PatternItem.java @@ -50,8 +50,6 @@ public class PatternItem extends Item implements ICraftingPatternProvider { public PatternItem() { super(new Item.Properties().group(RS.MAIN_GROUP).setISTER(() -> PatternItemStackTileRenderer::new)); - - this.setRegistryName(RS.ID, "pattern"); } public static CraftingPattern fromCache(World world, ItemStack stack) { @@ -127,7 +125,7 @@ public class PatternItem extends Item implements ICraftingPatternProvider { @Override public ActionResult onItemRightClick(World world, PlayerEntity player, Hand hand) { if (!world.isRemote && player.isCrouching()) { - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.PATTERN, player.getHeldItem(hand).getCount())); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.PATTERN.get(), player.getHeldItem(hand).getCount())); } return new ActionResult<>(ActionResultType.PASS, player.getHeldItem(hand)); diff --git a/src/main/java/com/refinedmods/refinedstorage/item/ProcessorBindingItem.java b/src/main/java/com/refinedmods/refinedstorage/item/ProcessorBindingItem.java index 0345284b7..654a4ce24 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/ProcessorBindingItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/ProcessorBindingItem.java @@ -6,7 +6,5 @@ import net.minecraft.item.Item; public class ProcessorBindingItem extends Item { public ProcessorBindingItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, "processor_binding"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/ProcessorItem.java b/src/main/java/com/refinedmods/refinedstorage/item/ProcessorItem.java index 137e5dc17..6f16d7f03 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/ProcessorItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/ProcessorItem.java @@ -17,11 +17,13 @@ public class ProcessorItem extends Item { Type(String name) { this.name = name; } + + public String getName() { + return name; + } } - public ProcessorItem(Type type) { + public ProcessorItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, type.name + "_processor"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/QuartzEnrichedIronItem.java b/src/main/java/com/refinedmods/refinedstorage/item/QuartzEnrichedIronItem.java index 77744edff..4e978227d 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/QuartzEnrichedIronItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/QuartzEnrichedIronItem.java @@ -6,7 +6,5 @@ import net.minecraft.item.Item; public class QuartzEnrichedIronItem extends Item { public QuartzEnrichedIronItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, "quartz_enriched_iron"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/SecurityCardItem.java b/src/main/java/com/refinedmods/refinedstorage/item/SecurityCardItem.java index 7bd8b234a..2deea659d 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/SecurityCardItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/SecurityCardItem.java @@ -26,8 +26,6 @@ public class SecurityCardItem extends Item { public SecurityCardItem() { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); - - this.setRegistryName(RS.ID, "security_card"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/item/SiliconItem.java b/src/main/java/com/refinedmods/refinedstorage/item/SiliconItem.java index 252ee7ff7..8a5ab2630 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/SiliconItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/SiliconItem.java @@ -6,7 +6,5 @@ import net.minecraft.item.Item; public class SiliconItem extends Item { public SiliconItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, "silicon"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/StorageDiskItem.java b/src/main/java/com/refinedmods/refinedstorage/item/StorageDiskItem.java index ac909e7b6..b0007d10f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/StorageDiskItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/StorageDiskItem.java @@ -38,8 +38,6 @@ public class StorageDiskItem extends Item implements IStorageDiskProvider { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); this.type = type; - - this.setRegistryName(RS.ID, type.getName() + "_storage_disk"); } @Override @@ -97,7 +95,7 @@ public class StorageDiskItem extends Item implements IStorageDiskProvider { API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack)); API.instance().getStorageDiskManager((ServerWorld) world).markForSaving(); - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING)); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.STORAGE_HOUSING.get())); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/StorageHousingItem.java b/src/main/java/com/refinedmods/refinedstorage/item/StorageHousingItem.java index e398d8e46..488ba9752 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/StorageHousingItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/StorageHousingItem.java @@ -6,7 +6,5 @@ import net.minecraft.item.Item; public class StorageHousingItem extends Item { public StorageHousingItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, "storage_housing"); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/StoragePartItem.java b/src/main/java/com/refinedmods/refinedstorage/item/StoragePartItem.java index 7398c12cd..82a08987c 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/StoragePartItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/StoragePartItem.java @@ -6,24 +6,11 @@ import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType; import net.minecraft.item.Item; public class StoragePartItem extends Item { - public StoragePartItem(ItemStorageType type) { + public StoragePartItem() { super(new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, type.getName() + "_storage_part"); } public static StoragePartItem getByType(ItemStorageType type) { - switch (type) { - case ONE_K: - return RSItems.ONE_K_STORAGE_PART; - case FOUR_K: - return RSItems.FOUR_K_STORAGE_PART; - case SIXTEEN_K: - return RSItems.SIXTEEN_K_STORAGE_PART; - case SIXTY_FOUR_K: - return RSItems.SIXTY_FOUR_K_STORAGE_PART; - default: - throw new IllegalArgumentException("Cannot get storage part of " + type); - } + return RSItems.ITEM_STORAGE_PARTS.get(type).get(); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/UpgradeItem.java b/src/main/java/com/refinedmods/refinedstorage/item/UpgradeItem.java index 66f554b27..e0da6720f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/UpgradeItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/UpgradeItem.java @@ -82,8 +82,6 @@ public class UpgradeItem extends Item { super(new Item.Properties().group(RS.MAIN_GROUP)); this.type = type; - - this.setRegistryName(RS.ID, type == Type.NORMAL ? "upgrade" : type.getName() + "_upgrade"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/item/WirelessCraftingMonitorItem.java b/src/main/java/com/refinedmods/refinedstorage/item/WirelessCraftingMonitorItem.java index 62bf2f8ae..9e27aa2e2 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/WirelessCraftingMonitorItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/WirelessCraftingMonitorItem.java @@ -27,8 +27,6 @@ public class WirelessCraftingMonitorItem extends NetworkItem { public WirelessCraftingMonitorItem(Type type) { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), type == Type.CREATIVE, () -> RS.SERVER_CONFIG.getWirelessCraftingMonitor().getCapacity()); - this.setRegistryName(RS.ID, (type == Type.CREATIVE ? "creative_" : "") + "wireless_crafting_monitor"); - this.type = type; } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/WirelessFluidGridItem.java b/src/main/java/com/refinedmods/refinedstorage/item/WirelessFluidGridItem.java index 244d5c12d..ff2750ddc 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/WirelessFluidGridItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/WirelessFluidGridItem.java @@ -24,8 +24,6 @@ public class WirelessFluidGridItem extends NetworkItem { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), type == Type.CREATIVE, () -> RS.SERVER_CONFIG.getWirelessFluidGrid().getCapacity()); this.type = type; - - this.setRegistryName(RS.ID, (type == Type.CREATIVE ? "creative_" : "") + "wireless_fluid_grid"); } public Type getType() { diff --git a/src/main/java/com/refinedmods/refinedstorage/item/WirelessGridItem.java b/src/main/java/com/refinedmods/refinedstorage/item/WirelessGridItem.java index 46115bfbb..e9778f934 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/WirelessGridItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/WirelessGridItem.java @@ -24,8 +24,6 @@ public class WirelessGridItem extends NetworkItem { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), type == Type.CREATIVE, () -> RS.SERVER_CONFIG.getWirelessGrid().getCapacity()); this.type = type; - - this.setRegistryName(RS.ID, (type == Type.CREATIVE ? "creative_" : "") + "wireless_grid"); } public Type getType() { diff --git a/src/main/java/com/refinedmods/refinedstorage/item/WrenchItem.java b/src/main/java/com/refinedmods/refinedstorage/item/WrenchItem.java index e505f63b7..28c6afd7b 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/WrenchItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/WrenchItem.java @@ -15,8 +15,6 @@ import net.minecraft.util.Rotation; public class WrenchItem extends Item { public WrenchItem() { super(new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1)); - - this.setRegistryName(RS.ID, "wrench"); } @Override diff --git a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/ControllerBlockItem.java b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/ControllerBlockItem.java index 2e4231599..6666fc41f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/ControllerBlockItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/ControllerBlockItem.java @@ -8,7 +8,5 @@ import net.minecraft.item.Item; public class ControllerBlockItem extends EnergyBlockItem { public ControllerBlockItem(ControllerBlock block) { super(block, new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), block.getType() == NetworkType.CREATIVE, () -> RS.SERVER_CONFIG.getController().getCapacity()); - - this.setRegistryName(block.getRegistryName()); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/FluidStorageBlockItem.java b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/FluidStorageBlockItem.java index 955587bbb..570bacba0 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/FluidStorageBlockItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/FluidStorageBlockItem.java @@ -10,6 +10,7 @@ import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageN import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType; import com.refinedmods.refinedstorage.block.FluidStorageBlock; import com.refinedmods.refinedstorage.item.FluidStoragePartItem; +import com.refinedmods.refinedstorage.item.ProcessorItem; import com.refinedmods.refinedstorage.render.Styles; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; @@ -37,8 +38,6 @@ public class FluidStorageBlockItem extends BaseBlockItem { super(block, new Item.Properties().group(RS.MAIN_GROUP)); this.type = block.getType(); - - this.setRegistryName(block.getRegistryName()); } @Override @@ -86,7 +85,7 @@ public class FluidStorageBlockItem extends BaseBlockItem { InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), fluidStoragePart); } - ItemStack processor = new ItemStack(RSItems.BASIC_PROCESSOR); + ItemStack processor = new ItemStack(RSItems.PROCESSORS.get(ProcessorItem.Type.BASIC).get()); if (!player.inventory.addItemStackToInventory(processor.copy())) { InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), processor); @@ -103,7 +102,7 @@ public class FluidStorageBlockItem extends BaseBlockItem { API.instance().getStorageDiskManager((ServerWorld) world).markForSaving(); } - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING)); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING.get())); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/PortableGridBlockItem.java b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/PortableGridBlockItem.java index c738a355d..ba3a7020b 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/PortableGridBlockItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/PortableGridBlockItem.java @@ -32,14 +32,13 @@ public class PortableGridBlockItem extends EnergyBlockItem { public PortableGridBlockItem(Type type) { super( - type == Type.CREATIVE ? RSBlocks.CREATIVE_PORTABLE_GRID : RSBlocks.PORTABLE_GRID, + type == Type.CREATIVE ? RSBlocks.CREATIVE_PORTABLE_GRID.get() : RSBlocks.PORTABLE_GRID.get(), new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), type == Type.CREATIVE, () -> RS.SERVER_CONFIG.getPortableGrid().getCapacity() ); this.type = type; - this.setRegistryName(RS.ID, (type == Type.CREATIVE ? "creative_" : "") + "portable_grid"); } public Type getType() { diff --git a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/StorageBlockItem.java b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/StorageBlockItem.java index 52d47ae30..2ef830927 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/StorageBlockItem.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/StorageBlockItem.java @@ -35,8 +35,6 @@ public class StorageBlockItem extends BaseBlockItem { super(block, new Item.Properties().group(RS.MAIN_GROUP)); this.type = block.getType(); - - this.setRegistryName(block.getRegistryName()); } @Override @@ -89,7 +87,7 @@ public class StorageBlockItem extends BaseBlockItem { API.instance().getStorageDiskManager((ServerWorld) world).markForSaving(); } - return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING)); + return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSBlocks.MACHINE_CASING.get())); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/WirelessTransmitterBlockItem.java b/src/main/java/com/refinedmods/refinedstorage/item/blockitem/WirelessTransmitterBlockItem.java deleted file mode 100644 index fa08536e0..000000000 --- a/src/main/java/com/refinedmods/refinedstorage/item/blockitem/WirelessTransmitterBlockItem.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.refinedmods.refinedstorage.item.blockitem; - -import com.refinedmods.refinedstorage.RS; -import com.refinedmods.refinedstorage.RSBlocks; -import com.refinedmods.refinedstorage.render.Styles; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TranslationTextComponent; -import net.minecraft.world.World; - -import javax.annotation.Nullable; -import java.util.List; - -public class WirelessTransmitterBlockItem extends BaseBlockItem { - public WirelessTransmitterBlockItem() { - super(RSBlocks.WIRELESS_TRANSMITTER, new Item.Properties().group(RS.MAIN_GROUP)); - - this.setRegistryName(RS.ID, "wireless_transmitter"); - } - - @Override - public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { - super.addInformation(stack, world, tooltip, flag); - - tooltip.add(new TranslationTextComponent("block.refinedstorage.wireless_transmitter.tooltip", new TranslationTextComponent("block.refinedstorage.cable")).setStyle(Styles.GRAY)); - } -} diff --git a/src/main/java/com/refinedmods/refinedstorage/item/group/MainItemGroup.java b/src/main/java/com/refinedmods/refinedstorage/item/group/MainItemGroup.java index 93d2c9dd9..80e35781f 100644 --- a/src/main/java/com/refinedmods/refinedstorage/item/group/MainItemGroup.java +++ b/src/main/java/com/refinedmods/refinedstorage/item/group/MainItemGroup.java @@ -12,6 +12,6 @@ public class MainItemGroup extends ItemGroup { @Override public ItemStack createIcon() { - return new ItemStack(RSBlocks.CREATIVE_CONTROLLER); + return new ItemStack(RSBlocks.CREATIVE_CONTROLLER.get()); } } diff --git a/src/main/java/com/refinedmods/refinedstorage/recipe/UpgradeWithEnchantedBookRecipe.java b/src/main/java/com/refinedmods/refinedstorage/recipe/UpgradeWithEnchantedBookRecipe.java index 99d9950c6..b93286949 100644 --- a/src/main/java/com/refinedmods/refinedstorage/recipe/UpgradeWithEnchantedBookRecipe.java +++ b/src/main/java/com/refinedmods/refinedstorage/recipe/UpgradeWithEnchantedBookRecipe.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.recipe; import com.refinedmods.refinedstorage.RSItems; +import com.refinedmods.refinedstorage.item.UpgradeItem; import net.minecraft.block.Blocks; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentData; @@ -22,15 +23,15 @@ public class UpgradeWithEnchantedBookRecipe extends ShapedRecipe { public UpgradeWithEnchantedBookRecipe(ResourceLocation recipeId, Enchantment enchantment, int enchantmentLevel, ItemStack result) { super(recipeId, "", 3, 3, NonNullList.from(Ingredient.EMPTY, - Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)), + Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON.get())), Ingredient.fromStacks(EnchantedBookItem.getEnchantedItemStack(new EnchantmentData(enchantment, enchantmentLevel))), - Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)), + Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON.get())), Ingredient.fromStacks(new ItemStack(Blocks.BOOKSHELF)), - Ingredient.fromStacks(new ItemStack(RSItems.UPGRADE)), + Ingredient.fromStacks(new ItemStack(RSItems.UPGRADE_ITEMS.get(UpgradeItem.Type.NORMAL).get())), Ingredient.fromStacks(new ItemStack(Blocks.BOOKSHELF)), - Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)), - Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)), - Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)) + Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON.get())), + Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON.get())), + Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON.get())) ), result); this.enchant = new EnchantmentData(enchantment, enchantmentLevel); diff --git a/src/main/java/com/refinedmods/refinedstorage/render/model/DiskDriveBakedModel.java b/src/main/java/com/refinedmods/refinedstorage/render/model/DiskDriveBakedModel.java index 99342a471..201e5316d 100644 --- a/src/main/java/com/refinedmods/refinedstorage/render/model/DiskDriveBakedModel.java +++ b/src/main/java/com/refinedmods/refinedstorage/render/model/DiskDriveBakedModel.java @@ -76,7 +76,7 @@ public class DiskDriveBakedModel extends DelegateBakedModel { @Override @SuppressWarnings("deprecation") public List load(CacheKey key) { - Direction facing = key.state.get(RSBlocks.DISK_DRIVE.getDirection().getProperty()); + Direction facing = key.state.get(RSBlocks.DISK_DRIVE.get().getDirection().getProperty()); List quads = new ArrayList<>(QuadTransformer.getTransformedQuads(base, facing, null, key.state, key.random, key.side)); diff --git a/src/main/java/com/refinedmods/refinedstorage/render/model/DiskManipulatorBakedModel.java b/src/main/java/com/refinedmods/refinedstorage/render/model/DiskManipulatorBakedModel.java index 633cf8e82..f66314b01 100644 --- a/src/main/java/com/refinedmods/refinedstorage/render/model/DiskManipulatorBakedModel.java +++ b/src/main/java/com/refinedmods/refinedstorage/render/model/DiskManipulatorBakedModel.java @@ -78,7 +78,7 @@ public class DiskManipulatorBakedModel extends DelegateBakedModel { @Override @SuppressWarnings("deprecation") public List load(CacheKey key) { - Direction facing = key.state.get(RSBlocks.DISK_MANIPULATOR.getDirection().getProperty()); + Direction facing = key.state.get(RSBlocks.DISK_MANIPULATOR.get().getDirection().getProperty()); boolean connected = key.state.get(DiskManipulatorBlock.CONNECTED); List quads = new ArrayList<>(QuadTransformer.getTransformedQuads( diff --git a/src/main/java/com/refinedmods/refinedstorage/render/model/PortableGridBakedModel.java b/src/main/java/com/refinedmods/refinedstorage/render/model/PortableGridBakedModel.java index 7a1986e27..ee4e675a9 100644 --- a/src/main/java/com/refinedmods/refinedstorage/render/model/PortableGridBakedModel.java +++ b/src/main/java/com/refinedmods/refinedstorage/render/model/PortableGridBakedModel.java @@ -37,7 +37,7 @@ public class PortableGridBakedModel extends DelegateBakedModel { @Override @SuppressWarnings("deprecation") public List load(@Nonnull CacheKey key) { - Direction direction = key.state.get(RSBlocks.PORTABLE_GRID.getDirection().getProperty()); + Direction direction = key.state.get(RSBlocks.PORTABLE_GRID.get().getDirection().getProperty()); boolean active = key.state.get(PortableGridBlock.ACTIVE); PortableGridDiskState diskState = key.state.get(PortableGridBlock.DISK_STATE); diff --git a/src/main/java/com/refinedmods/refinedstorage/render/tesr/StorageMonitorTileRenderer.java b/src/main/java/com/refinedmods/refinedstorage/render/tesr/StorageMonitorTileRenderer.java index c5d2946c2..c0c8dd166 100644 --- a/src/main/java/com/refinedmods/refinedstorage/render/tesr/StorageMonitorTileRenderer.java +++ b/src/main/java/com/refinedmods/refinedstorage/render/tesr/StorageMonitorTileRenderer.java @@ -38,7 +38,7 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID); + findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_GRID.get(), RSItems.CREATIVE_WIRELESS_GRID.get()); } else if (RSKeyBindings.OPEN_WIRELESS_FLUID_GRID.isKeyDown()) { - findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_FLUID_GRID, RSItems.CREATIVE_WIRELESS_FLUID_GRID); + findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_FLUID_GRID.get(), RSItems.CREATIVE_WIRELESS_FLUID_GRID.get()); } else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) { - findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.PORTABLE_GRID, RSItems.CREATIVE_PORTABLE_GRID); + findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.PORTABLE_GRID.get(), RSItems.CREATIVE_PORTABLE_GRID.get()); } else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) { - findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_CRAFTING_MONITOR, RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR); + findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error, Util.DUMMY_UUID), RSItems.WIRELESS_CRAFTING_MONITOR.get(), RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR.get()); } } } diff --git a/src/main/java/com/refinedmods/refinedstorage/setup/ClientSetup.java b/src/main/java/com/refinedmods/refinedstorage/setup/ClientSetup.java index d853718c8..c61b703e0 100644 --- a/src/main/java/com/refinedmods/refinedstorage/setup/ClientSetup.java +++ b/src/main/java/com/refinedmods/refinedstorage/setup/ClientSetup.java @@ -146,6 +146,7 @@ public class ClientSetup { ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_disconnected")); ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_connected")); + ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_connected")); ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected")); ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk")); @@ -223,46 +224,46 @@ public class ClientSetup { ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR); ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_PORTABLE_GRID); - RenderTypeLookup.setRenderLayer(RSBlocks.CONTROLLER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CREATIVE_CONTROLLER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CABLE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER_MANAGER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_MONITOR, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.DETECTOR, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.DISK_MANIPULATOR, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.GRID, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_GRID, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.PATTERN_GRID, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.FLUID_GRID, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_RECEIVER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_TRANSMITTER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.RELAY, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.SECURITY_MANAGER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.WIRELESS_TRANSMITTER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.IMPORTER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.EXPORTER, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.EXTERNAL_STORAGE, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.CONSTRUCTOR, RenderType.getCutout()); - RenderTypeLookup.setRenderLayer(RSBlocks.DESTRUCTOR, RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CONTROLLER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CREATIVE_CONTROLLER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CABLE.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER_MANAGER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_MONITOR.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.DETECTOR.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.DISK_MANIPULATOR.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.GRID.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_GRID.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.PATTERN_GRID.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.FLUID_GRID.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_RECEIVER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_TRANSMITTER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.RELAY.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.SECURITY_MANAGER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.WIRELESS_TRANSMITTER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.IMPORTER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.EXPORTER.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.EXTERNAL_STORAGE.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.CONSTRUCTOR.get(), RenderType.getCutout()); + RenderTypeLookup.setRenderLayer(RSBlocks.DESTRUCTOR.get(), RenderType.getCutout()); ClientRegistry.bindTileEntityRenderer(RSTiles.STORAGE_MONITOR, StorageMonitorTileRenderer::new); - e.getMinecraftSupplier().get().getItemColors().register(new PatternItemColor(), RSItems.PATTERN); + e.getMinecraftSupplier().get().getItemColors().register(new PatternItemColor(), RSItems.PATTERN.get()); - ItemModelsProperties.func_239418_a_(RSItems.SECURITY_CARD, new ResourceLocation("active"), new SecurityCardItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.SECURITY_CARD.get(), new ResourceLocation("active"), new SecurityCardItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.CONTROLLER, new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_CONTROLLER, new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.CONTROLLER.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_CONTROLLER.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_CRAFTING_MONITOR, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_CRAFTING_MONITOR.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_GRID, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_GRID, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_GRID.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_GRID.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_FLUID_GRID, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); - ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_FLUID_GRID, new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_FLUID_GRID.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); + ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_FLUID_GRID.get(), new ResourceLocation("connected"), new NetworkItemPropertyGetter()); } @SubscribeEvent diff --git a/src/main/java/com/refinedmods/refinedstorage/setup/CommonSetup.java b/src/main/java/com/refinedmods/refinedstorage/setup/CommonSetup.java index fba0fdbb2..41d96cf1e 100644 --- a/src/main/java/com/refinedmods/refinedstorage/setup/CommonSetup.java +++ b/src/main/java/com/refinedmods/refinedstorage/setup/CommonSetup.java @@ -29,7 +29,7 @@ import com.refinedmods.refinedstorage.apiimpl.storage.disk.factory.FluidStorageD import com.refinedmods.refinedstorage.apiimpl.storage.disk.factory.ItemStorageDiskFactory; import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.FluidExternalStorageProvider; import com.refinedmods.refinedstorage.apiimpl.storage.externalstorage.ItemExternalStorageProvider; -import com.refinedmods.refinedstorage.block.*; +import com.refinedmods.refinedstorage.block.BlockListener; import com.refinedmods.refinedstorage.capability.NetworkNodeProxyCapability; import com.refinedmods.refinedstorage.container.*; import com.refinedmods.refinedstorage.container.factory.*; @@ -44,14 +44,12 @@ import com.refinedmods.refinedstorage.tile.data.TileDataManager; import com.refinedmods.refinedstorage.tile.grid.GridTile; import com.refinedmods.refinedstorage.tile.grid.portable.PortableGridTile; import com.refinedmods.refinedstorage.util.BlockUtils; -import net.minecraft.block.Block; import net.minecraft.inventory.container.ContainerType; import net.minecraft.item.Item; import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.extensions.IForgeContainerType; import net.minecraftforge.event.RegistryEvent; @@ -151,93 +149,50 @@ public class CommonSetup { e.getRegistry().register(new UpgradeWithEnchantedBookRecipeSerializer().setRegistryName(RS.ID, "upgrade_with_enchanted_book")); } - @SubscribeEvent - public void onRegisterBlocks(RegistryEvent.Register e) { - e.getRegistry().register(new QuartzEnrichedIronBlock()); - e.getRegistry().register(new ControllerBlock(NetworkType.NORMAL)); - e.getRegistry().register(new ControllerBlock(NetworkType.CREATIVE)); - e.getRegistry().register(new MachineCasingBlock()); - e.getRegistry().register(new CableBlock()); - e.getRegistry().register(new DiskDriveBlock()); - e.getRegistry().register(new GridBlock(GridType.NORMAL, new ResourceLocation(RS.ID, "grid"))); - e.getRegistry().register(new GridBlock(GridType.CRAFTING, new ResourceLocation(RS.ID, GridType.CRAFTING.getString() + "_grid"))); - e.getRegistry().register(new GridBlock(GridType.PATTERN, new ResourceLocation(RS.ID, GridType.PATTERN.getString() + "_grid"))); - e.getRegistry().register(new GridBlock(GridType.FLUID, new ResourceLocation(RS.ID, GridType.FLUID.getString() + "_grid"))); - - for (ItemStorageType type : ItemStorageType.values()) { - e.getRegistry().register(new StorageBlock(type)); - } - - for (FluidStorageType type : FluidStorageType.values()) { - e.getRegistry().register(new FluidStorageBlock(type)); - } - - e.getRegistry().register(new ExternalStorageBlock()); - e.getRegistry().register(new ImporterBlock()); - e.getRegistry().register(new ExporterBlock()); - e.getRegistry().register(new NetworkReceiverBlock()); - e.getRegistry().register(new NetworkTransmitterBlock()); - e.getRegistry().register(new RelayBlock()); - e.getRegistry().register(new DetectorBlock()); - e.getRegistry().register(new SecurityManagerBlock()); - e.getRegistry().register(new InterfaceBlock()); - e.getRegistry().register(new FluidInterfaceBlock()); - e.getRegistry().register(new WirelessTransmitterBlock()); - e.getRegistry().register(new StorageMonitorBlock()); - e.getRegistry().register(new ConstructorBlock()); - e.getRegistry().register(new DestructorBlock()); - e.getRegistry().register(new DiskManipulatorBlock()); - e.getRegistry().register(new PortableGridBlock(PortableGridBlockItem.Type.NORMAL)); - e.getRegistry().register(new PortableGridBlock(PortableGridBlockItem.Type.CREATIVE)); - e.getRegistry().register(new CrafterBlock()); - e.getRegistry().register(new CrafterManagerBlock()); - e.getRegistry().register(new CraftingMonitorBlock()); - } - @SubscribeEvent public void onRegisterTiles(RegistryEvent.Register> e) { - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new ControllerTile(NetworkType.NORMAL), RSBlocks.CONTROLLER).build(null).setRegistryName(RS.ID, "controller"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new ControllerTile(NetworkType.CREATIVE), RSBlocks.CREATIVE_CONTROLLER).build(null).setRegistryName(RS.ID, "creative_controller"))); - e.getRegistry().register(TileEntityType.Builder.create(CableTile::new, RSBlocks.CABLE).build(null).setRegistryName(RS.ID, "cable")); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DiskDriveTile::new, RSBlocks.DISK_DRIVE).build(null).setRegistryName(RS.ID, "disk_drive"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.NORMAL), RSBlocks.GRID).build(null).setRegistryName(RS.ID, "grid"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.CRAFTING), RSBlocks.CRAFTING_GRID).build(null).setRegistryName(RS.ID, "crafting_grid"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.PATTERN), RSBlocks.PATTERN_GRID).build(null).setRegistryName(RS.ID, "pattern_grid"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.FLUID), RSBlocks.FLUID_GRID).build(null).setRegistryName(RS.ID, "fluid_grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new ControllerTile(NetworkType.NORMAL), RSBlocks.CONTROLLER.get()).build(null).setRegistryName(RS.ID, "controller"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new ControllerTile(NetworkType.CREATIVE), RSBlocks.CREATIVE_CONTROLLER.get()).build(null).setRegistryName(RS.ID, "creative_controller"))); + e.getRegistry().register(TileEntityType.Builder.create(CableTile::new, RSBlocks.CABLE.get()).build(null).setRegistryName(RS.ID, "cable")); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DiskDriveTile::new, RSBlocks.DISK_DRIVE.get()).build(null).setRegistryName(RS.ID, "disk_drive"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.NORMAL), RSBlocks.GRID.get()).build(null).setRegistryName(RS.ID, "grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.CRAFTING), RSBlocks.CRAFTING_GRID.get()).build(null).setRegistryName(RS.ID, "crafting_grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.PATTERN), RSBlocks.PATTERN_GRID.get()).build(null).setRegistryName(RS.ID, "pattern_grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new GridTile(GridType.FLUID), RSBlocks.FLUID_GRID.get()).build(null).setRegistryName(RS.ID, "fluid_grid"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.ONE_K), RSBlocks.ONE_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "1k_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.FOUR_K), RSBlocks.FOUR_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "4k_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTEEN_K), RSBlocks.SIXTEEN_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "16k_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTY_FOUR_K), RSBlocks.SIXTY_FOUR_K_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "64k_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.CREATIVE), RSBlocks.CREATIVE_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.ONE_K), RSBlocks.STORAGE_BLOCKS.get(ItemStorageType.ONE_K).get()).build(null).setRegistryName(RS.ID, "1k_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.FOUR_K), RSBlocks.STORAGE_BLOCKS.get(ItemStorageType.FOUR_K).get()).build(null).setRegistryName(RS.ID, "4k_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTEEN_K), RSBlocks.STORAGE_BLOCKS.get(ItemStorageType.SIXTEEN_K).get()).build(null).setRegistryName(RS.ID, "16k_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.SIXTY_FOUR_K), RSBlocks.STORAGE_BLOCKS.get(ItemStorageType.SIXTY_FOUR_K).get()).build(null).setRegistryName(RS.ID, "64k_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new StorageTile(ItemStorageType.CREATIVE), RSBlocks.STORAGE_BLOCKS.get(ItemStorageType.CREATIVE).get()).build(null).setRegistryName(RS.ID, "creative_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.SIXTY_FOUR_K), RSBlocks.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "64k_fluid_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K), RSBlocks.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "256k_fluid_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.THOUSAND_TWENTY_FOUR_K), RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "1024k_fluid_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K), RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "4096k_fluid_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.CREATIVE), RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.SIXTY_FOUR_K), RSBlocks.FLUID_STORAGE_BLOCKS.get(FluidStorageType.SIXTY_FOUR_K).get()).build(null).setRegistryName(RS.ID, "64k_fluid_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K), RSBlocks.FLUID_STORAGE_BLOCKS.get(FluidStorageType.TWO_HUNDRED_FIFTY_SIX_K).get()).build(null).setRegistryName(RS.ID, "256k_fluid_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.THOUSAND_TWENTY_FOUR_K), RSBlocks.FLUID_STORAGE_BLOCKS.get(FluidStorageType.THOUSAND_TWENTY_FOUR_K).get()).build(null).setRegistryName(RS.ID, "1024k_fluid_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K), RSBlocks.FLUID_STORAGE_BLOCKS.get(FluidStorageType.FOUR_THOUSAND_NINETY_SIX_K).get()).build(null).setRegistryName(RS.ID, "4096k_fluid_storage_block"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new FluidStorageTile(FluidStorageType.CREATIVE), RSBlocks.FLUID_STORAGE_BLOCKS.get(FluidStorageType.CREATIVE).get()).build(null).setRegistryName(RS.ID, "creative_fluid_storage_block"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExternalStorageTile::new, RSBlocks.EXTERNAL_STORAGE).build(null).setRegistryName(RS.ID, "external_storage"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ImporterTile::new, RSBlocks.IMPORTER).build(null).setRegistryName(RS.ID, "importer"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExporterTile::new, RSBlocks.EXPORTER).build(null).setRegistryName(RS.ID, "exporter"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(NetworkReceiverTile::new, RSBlocks.NETWORK_RECEIVER).build(null).setRegistryName(RS.ID, "network_receiver"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(NetworkTransmitterTile::new, RSBlocks.NETWORK_TRANSMITTER).build(null).setRegistryName(RS.ID, "network_transmitter"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(RelayTile::new, RSBlocks.RELAY).build(null).setRegistryName(RS.ID, "relay"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DetectorTile::new, RSBlocks.DETECTOR).build(null).setRegistryName(RS.ID, "detector"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(SecurityManagerTile::new, RSBlocks.SECURITY_MANAGER).build(null).setRegistryName(RS.ID, "security_manager"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(InterfaceTile::new, RSBlocks.INTERFACE).build(null).setRegistryName(RS.ID, "interface"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(FluidInterfaceTile::new, RSBlocks.FLUID_INTERFACE).build(null).setRegistryName(RS.ID, "fluid_interface"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(WirelessTransmitterTile::new, RSBlocks.WIRELESS_TRANSMITTER).build(null).setRegistryName(RS.ID, "wireless_transmitter"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(StorageMonitorTile::new, RSBlocks.STORAGE_MONITOR).build(null).setRegistryName(RS.ID, "storage_monitor"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ConstructorTile::new, RSBlocks.CONSTRUCTOR).build(null).setRegistryName(RS.ID, "constructor"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DestructorTile::new, RSBlocks.DESTRUCTOR).build(null).setRegistryName(RS.ID, "destructor"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DiskManipulatorTile::new, RSBlocks.DISK_MANIPULATOR).build(null).setRegistryName(RS.ID, "disk_manipulator"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CrafterTile::new, RSBlocks.CRAFTER).build(null).setRegistryName(RS.ID, "crafter"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CrafterManagerTile::new, RSBlocks.CRAFTER_MANAGER).build(null).setRegistryName(RS.ID, "crafter_manager"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CraftingMonitorTile::new, RSBlocks.CRAFTING_MONITOR).build(null).setRegistryName(RS.ID, "crafting_monitor"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExternalStorageTile::new, RSBlocks.EXTERNAL_STORAGE.get()).build(null).setRegistryName(RS.ID, "external_storage"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ImporterTile::new, RSBlocks.IMPORTER.get()).build(null).setRegistryName(RS.ID, "importer"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ExporterTile::new, RSBlocks.EXPORTER.get()).build(null).setRegistryName(RS.ID, "exporter"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(NetworkReceiverTile::new, RSBlocks.NETWORK_RECEIVER.get()).build(null).setRegistryName(RS.ID, "network_receiver"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(NetworkTransmitterTile::new, RSBlocks.NETWORK_TRANSMITTER.get()).build(null).setRegistryName(RS.ID, "network_transmitter"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(RelayTile::new, RSBlocks.RELAY.get()).build(null).setRegistryName(RS.ID, "relay"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DetectorTile::new, RSBlocks.DETECTOR.get()).build(null).setRegistryName(RS.ID, "detector"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(SecurityManagerTile::new, RSBlocks.SECURITY_MANAGER.get()).build(null).setRegistryName(RS.ID, "security_manager"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(InterfaceTile::new, RSBlocks.INTERFACE.get()).build(null).setRegistryName(RS.ID, "interface"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(FluidInterfaceTile::new, RSBlocks.FLUID_INTERFACE.get()).build(null).setRegistryName(RS.ID, "fluid_interface"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(WirelessTransmitterTile::new, RSBlocks.WIRELESS_TRANSMITTER.get()).build(null).setRegistryName(RS.ID, "wireless_transmitter"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(StorageMonitorTile::new, RSBlocks.STORAGE_MONITOR.get()).build(null).setRegistryName(RS.ID, "storage_monitor"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(ConstructorTile::new, RSBlocks.CONSTRUCTOR.get()).build(null).setRegistryName(RS.ID, "constructor"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DestructorTile::new, RSBlocks.DESTRUCTOR.get()).build(null).setRegistryName(RS.ID, "destructor"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(DiskManipulatorTile::new, RSBlocks.DISK_MANIPULATOR.get()).build(null).setRegistryName(RS.ID, "disk_manipulator"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CrafterTile::new, RSBlocks.CRAFTER.get()).build(null).setRegistryName(RS.ID, "crafter"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CrafterManagerTile::new, RSBlocks.CRAFTER_MANAGER.get()).build(null).setRegistryName(RS.ID, "crafter_manager"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(CraftingMonitorTile::new, RSBlocks.CRAFTING_MONITOR.get()).build(null).setRegistryName(RS.ID, "crafting_monitor"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new PortableGridTile(PortableGridBlockItem.Type.CREATIVE), RSBlocks.CREATIVE_PORTABLE_GRID).build(null).setRegistryName(RS.ID, "creative_portable_grid"))); - e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new PortableGridTile(PortableGridBlockItem.Type.NORMAL), RSBlocks.PORTABLE_GRID).build(null).setRegistryName(RS.ID, "portable_grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new PortableGridTile(PortableGridBlockItem.Type.CREATIVE), RSBlocks.CREATIVE_PORTABLE_GRID.get()).build(null).setRegistryName(RS.ID, "creative_portable_grid"))); + e.getRegistry().register(registerTileDataParameters(TileEntityType.Builder.create(() -> new PortableGridTile(PortableGridBlockItem.Type.NORMAL), RSBlocks.PORTABLE_GRID.get()).build(null).setRegistryName(RS.ID, "portable_grid"))); } private TileEntityType registerTileDataParameters(TileEntityType t) { @@ -275,98 +230,4 @@ public class CommonSetup { e.getRegistry().register(IForgeContainerType.create(new CraftingMonitorContainerFactory()).setRegistryName(RS.ID, "crafting_monitor")); e.getRegistry().register(IForgeContainerType.create(new WirelessCraftingMonitorContainerFactory()).setRegistryName(RS.ID, "wireless_crafting_monitor")); } - - @SubscribeEvent - public void onRegisterItems(RegistryEvent.Register e) { - e.getRegistry().register(new CoreItem(CoreItem.Type.CONSTRUCTION)); - e.getRegistry().register(new CoreItem(CoreItem.Type.DESTRUCTION)); - e.getRegistry().register(new QuartzEnrichedIronItem()); - e.getRegistry().register(new ProcessorBindingItem()); - - for (ProcessorItem.Type type : ProcessorItem.Type.values()) { - e.getRegistry().register(new ProcessorItem(type)); - } - - e.getRegistry().register(new SiliconItem()); - - e.getRegistry().register(new SecurityCardItem()); - e.getRegistry().register(new NetworkCardItem()); - - for (ItemStorageType type : ItemStorageType.values()) { - if (type != ItemStorageType.CREATIVE) { - e.getRegistry().register(new StoragePartItem(type)); - } - - e.getRegistry().register(new StorageDiskItem(type)); - } - - for (FluidStorageType type : FluidStorageType.values()) { - if (type != FluidStorageType.CREATIVE) { - e.getRegistry().register(new FluidStoragePartItem(type)); - } - - e.getRegistry().register(new FluidStorageDiskItem(type)); - } - - e.getRegistry().register(new StorageHousingItem()); - - for (UpgradeItem.Type type : UpgradeItem.Type.values()) { - e.getRegistry().register(new UpgradeItem(type)); - } - - e.getRegistry().register(new WrenchItem()); - e.getRegistry().register(new PatternItem()); - e.getRegistry().register(new FilterItem()); - e.getRegistry().register(new PortableGridBlockItem(PortableGridBlockItem.Type.NORMAL)); - e.getRegistry().register(new PortableGridBlockItem(PortableGridBlockItem.Type.CREATIVE)); - - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.QUARTZ_ENRICHED_IRON)); - e.getRegistry().register(new ControllerBlockItem(RSBlocks.CONTROLLER)); - e.getRegistry().register(new ControllerBlockItem(RSBlocks.CREATIVE_CONTROLLER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.MACHINE_CASING)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CABLE)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DISK_DRIVE)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.GRID)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CRAFTING_GRID)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.PATTERN_GRID)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.FLUID_GRID)); - - e.getRegistry().register(new StorageBlockItem(RSBlocks.ONE_K_STORAGE_BLOCK)); - e.getRegistry().register(new StorageBlockItem(RSBlocks.FOUR_K_STORAGE_BLOCK)); - e.getRegistry().register(new StorageBlockItem(RSBlocks.SIXTEEN_K_STORAGE_BLOCK)); - e.getRegistry().register(new StorageBlockItem(RSBlocks.SIXTY_FOUR_K_STORAGE_BLOCK)); - e.getRegistry().register(new StorageBlockItem(RSBlocks.CREATIVE_STORAGE_BLOCK)); - - e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK)); - e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK)); - e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK)); - e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK)); - e.getRegistry().register(new FluidStorageBlockItem(RSBlocks.CREATIVE_FLUID_STORAGE_BLOCK)); - - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXTERNAL_STORAGE)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.IMPORTER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.EXPORTER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.NETWORK_RECEIVER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.NETWORK_TRANSMITTER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.RELAY)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DETECTOR)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.SECURITY_MANAGER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.INTERFACE)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.FLUID_INTERFACE)); - e.getRegistry().register(new WirelessTransmitterBlockItem()); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.STORAGE_MONITOR)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CONSTRUCTOR)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DESTRUCTOR)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.DISK_MANIPULATOR)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CRAFTER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CRAFTER_MANAGER)); - e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.CRAFTING_MONITOR)); - - e.getRegistry().register(new WirelessGridItem(WirelessGridItem.Type.NORMAL)); - e.getRegistry().register(new WirelessGridItem(WirelessGridItem.Type.CREATIVE)); - e.getRegistry().register(new WirelessFluidGridItem(WirelessFluidGridItem.Type.NORMAL)); - e.getRegistry().register(new WirelessFluidGridItem(WirelessFluidGridItem.Type.CREATIVE)); - e.getRegistry().register(new WirelessCraftingMonitorItem(WirelessCraftingMonitorItem.Type.NORMAL)); - e.getRegistry().register(new WirelessCraftingMonitorItem(WirelessCraftingMonitorItem.Type.CREATIVE)); - } } diff --git a/src/main/java/com/refinedmods/refinedstorage/util/BlockUtils.java b/src/main/java/com/refinedmods/refinedstorage/util/BlockUtils.java index 1d3c6a225..e152db122 100644 --- a/src/main/java/com/refinedmods/refinedstorage/util/BlockUtils.java +++ b/src/main/java/com/refinedmods/refinedstorage/util/BlockUtils.java @@ -1,23 +1,10 @@ package com.refinedmods.refinedstorage.util; -import com.refinedmods.refinedstorage.RS; -import com.refinedmods.refinedstorage.block.BaseBlock; -import com.refinedmods.refinedstorage.item.blockitem.BaseBlockItem; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; public class BlockUtils { public static final Block.Properties DEFAULT_ROCK_PROPERTIES = Block.Properties.create(Material.ROCK).hardnessAndResistance(1.9F).sound(SoundType.STONE); public static final Block.Properties DEFAULT_GLASS_PROPERTIES = Block.Properties.create(Material.GLASS).sound(SoundType.GLASS).hardnessAndResistance(0.35F); - - public static BlockItem createBlockItemFor(BaseBlock block) { - BaseBlockItem blockItem = new BaseBlockItem(block, new Item.Properties().group(RS.MAIN_GROUP)); - - blockItem.setRegistryName(block.getRegistryName()); - - return blockItem; - } } diff --git a/src/main/resources/assets/refinedstorage/lang/en_us.json b/src/main/resources/assets/refinedstorage/lang/en_us.json index bbe0baf31..a1b2cd73d 100644 --- a/src/main/resources/assets/refinedstorage/lang/en_us.json +++ b/src/main/resources/assets/refinedstorage/lang/en_us.json @@ -236,7 +236,6 @@ "block.refinedstorage.interface": "Interface", "block.refinedstorage.crafting_monitor": "Crafting Monitor", "block.refinedstorage.wireless_transmitter": "Wireless Transmitter", - "block.refinedstorage.wireless_transmitter.tooltip": "Must be placed on %s.", "block.refinedstorage.crafter": "Crafter", "block.refinedstorage.network_receiver": "Network Receiver", "block.refinedstorage.network_transmitter": "Network Transmitter",