From 71a0a631ff3f57328a451af227b1e1d0bce247cb Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 18 Jun 2020 13:50:50 +0100 Subject: [PATCH] remove usages of reflection, should help cut down on errors and IDE warnings. --- src/main/java/techreborn/init/ModRecipes.java | 42 ++--- .../java/techreborn/init/TRBlockEntities.java | 143 +++++++++--------- 2 files changed, 89 insertions(+), 96 deletions(-) diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 55ce231e2..ef5527e3a 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -33,27 +33,27 @@ import techreborn.api.recipe.recipes.*; public class ModRecipes { - public static final RebornRecipeType ALLOY_SMELTER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:alloy_smelter")); - public static final RebornRecipeType ASSEMBLING_MACHINE = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:assembling_machine")); - public static final RebornRecipeType BLAST_FURNACE = RecipeManager.newRecipeType(BlastFurnaceRecipe.class, new Identifier("techreborn:blast_furnace")); - public static final RebornRecipeType CENTRIFUGE = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:centrifuge")); - public static final RebornRecipeType CHEMICAL_REACTOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:chemical_reactor")); - public static final RebornRecipeType COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:compressor")); - public static final RebornRecipeType DISTILLATION_TOWER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:distillation_tower")); - public static final RebornRecipeType EXTRACTOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:extractor")); - public static final RebornRecipeType GRINDER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:grinder")); - public static final RebornRecipeType IMPLOSION_COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:implosion_compressor")); - public static final RebornRecipeType INDUSTRIAL_ELECTROLYZER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:industrial_electrolyzer")); - public static final RebornRecipeType INDUSTRIAL_GRINDER = RecipeManager.newRecipeType(IndustrialGrinderRecipe.class, new Identifier("techreborn:industrial_grinder")); - public static final RebornRecipeType INDUSTRIAL_SAWMILL = RecipeManager.newRecipeType(IndustrialSawmillRecipe.class, new Identifier("techreborn:industrial_sawmill")); - public static final RebornRecipeType RECYCLER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:recycler")); - public static final RebornRecipeType SCRAPBOX = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:scrapbox")); - public static final RebornRecipeType VACUUM_FREEZER = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:vacuum_freezer")); - public static final RebornRecipeType FLUID_REPLICATOR = RecipeManager.newRecipeType(FluidReplicatorRecipe.class, new Identifier("techreborn:fluid_replicator")); - public static final RebornRecipeType FUSION_REACTOR = RecipeManager.newRecipeType(FusionReactorRecipe.class, new Identifier("techreborn:fusion_reactor")); - public static final RebornRecipeType ROLLING_MACHINE = RecipeManager.newRecipeType(RollingMachineRecipe.class, new Identifier("techreborn:rolling_machine")); - public static final RebornRecipeType SOLID_CANNING_MACHINE = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:solid_canning_machine")); - public static final RebornRecipeType WIRE_MILL = RecipeManager.newRecipeType(RebornRecipe.class, new Identifier("techreborn:wire_mill")); + public static final RebornRecipeType ALLOY_SMELTER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:alloy_smelter")); + public static final RebornRecipeType ASSEMBLING_MACHINE = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:assembling_machine")); + public static final RebornRecipeType BLAST_FURNACE = RecipeManager.newRecipeType(BlastFurnaceRecipe::new, new Identifier("techreborn:blast_furnace")); + public static final RebornRecipeType CENTRIFUGE = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:centrifuge")); + public static final RebornRecipeType CHEMICAL_REACTOR = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:chemical_reactor")); + public static final RebornRecipeType COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:compressor")); + public static final RebornRecipeType DISTILLATION_TOWER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:distillation_tower")); + public static final RebornRecipeType EXTRACTOR = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:extractor")); + public static final RebornRecipeType GRINDER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:grinder")); + public static final RebornRecipeType IMPLOSION_COMPRESSOR = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:implosion_compressor")); + public static final RebornRecipeType INDUSTRIAL_ELECTROLYZER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:industrial_electrolyzer")); + public static final RebornRecipeType INDUSTRIAL_GRINDER = RecipeManager.newRecipeType(IndustrialGrinderRecipe::new, new Identifier("techreborn:industrial_grinder")); + public static final RebornRecipeType INDUSTRIAL_SAWMILL = RecipeManager.newRecipeType(IndustrialSawmillRecipe::new, new Identifier("techreborn:industrial_sawmill")); + public static final RebornRecipeType RECYCLER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:recycler")); + public static final RebornRecipeType SCRAPBOX = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:scrapbox")); + public static final RebornRecipeType VACUUM_FREEZER = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:vacuum_freezer")); + public static final RebornRecipeType FLUID_REPLICATOR = RecipeManager.newRecipeType(FluidReplicatorRecipe::new, new Identifier("techreborn:fluid_replicator")); + public static final RebornRecipeType FUSION_REACTOR = RecipeManager.newRecipeType(FusionReactorRecipe::new, new Identifier("techreborn:fusion_reactor")); + public static final RebornRecipeType ROLLING_MACHINE = RecipeManager.newRecipeType(RollingMachineRecipe::new, new Identifier("techreborn:rolling_machine")); + public static final RebornRecipeType SOLID_CANNING_MACHINE = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:solid_canning_machine")); + public static final RebornRecipeType WIRE_MILL = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:wire_mill")); public static RebornRecipeType byName(Identifier identifier){ return (RebornRecipeType) Registry.RECIPE_SERIALIZER.get(identifier); diff --git a/src/main/java/techreborn/init/TRBlockEntities.java b/src/main/java/techreborn/init/TRBlockEntities.java index 2177a3b0a..2d7748e86 100644 --- a/src/main/java/techreborn/init/TRBlockEntities.java +++ b/src/main/java/techreborn/init/TRBlockEntities.java @@ -74,91 +74,84 @@ import techreborn.blockentity.transformers.MVTransformerBlockEntity; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Supplier; public class TRBlockEntities { private static List> TYPES = new ArrayList<>(); - public static final BlockEntityType STORAGE_UNIT = register(StorageUnitBaseBlockEntity.class, "storage_unit", TRContent.StorageUnit.values()); - public static final BlockEntityType TANK_UNIT = register(TankUnitBaseBlockEntity.class, "tank_unit", TRContent.TankUnit.values()); - public static final BlockEntityType QUANTUM_TANK = register(QuantumTankBlockEntity.class, "quantum_tank", TRContent.Machine.QUANTUM_TANK); - public static final BlockEntityType QUANTUM_CHEST = register(QuantumChestBlockEntity.class, "quantum_chest", TRContent.Machine.QUANTUM_CHEST); - public static final BlockEntityType DIGITAL_CHEST = register(DigitalChestBlockEntity.class, "digital_chest", TRContent.Machine.DIGITAL_CHEST); - public static final BlockEntityType CREATIVE_QUANTUM_CHEST = register(CreativeQuantumChestBlockEntity.class, "creative_quantum_chest", TRContent.Machine.CREATIVE_QUANTUM_CHEST); - public static final BlockEntityType CREATIVE_QUANTUM_TANK = register(CreativeQuantumTankBlockEntity.class, "creative_quantum_tank", TRContent.Machine.CREATIVE_QUANTUM_TANK); - public static final BlockEntityType DRAIN = register(DrainBlockEntity.class, "drain", TRContent.Machine.DRAIN); - public static final BlockEntityType THERMAL_GEN = register(ThermalGeneratorBlockEntity.class, "thermal_generator", TRContent.Machine.THERMAL_GENERATOR); - public static final BlockEntityType INDUSTRIAL_CENTRIFUGE = register(IndustrialCentrifugeBlockEntity.class, "industrial_centrifuge", TRContent.Machine.INDUSTRIAL_CENTRIFUGE); - public static final BlockEntityType ROLLING_MACHINE = register(RollingMachineBlockEntity.class, "rolling_machine", TRContent.Machine.ROLLING_MACHINE); - public static final BlockEntityType INDUSTRIAL_BLAST_FURNACE = register(IndustrialBlastFurnaceBlockEntity.class, "industrial_blast_furnace", TRContent.Machine.INDUSTRIAL_BLAST_FURNACE); - public static final BlockEntityType ALLOY_SMELTER = register(AlloySmelterBlockEntity.class, "alloy_smelter", TRContent.Machine.ALLOY_SMELTER); - public static final BlockEntityType INDUSTRIAL_GRINDER = register(IndustrialGrinderBlockEntity.class, "industrial_grinder", TRContent.Machine.INDUSTRIAL_GRINDER); - public static final BlockEntityType IMPLOSION_COMPRESSOR = register(ImplosionCompressorBlockEntity.class, "implosion_compressor", TRContent.Machine.IMPLOSION_COMPRESSOR); - public static final BlockEntityType MATTER_FABRICATOR = register(MatterFabricatorBlockEntity.class, "matter_fabricator", TRContent.Machine.MATTER_FABRICATOR); - public static final BlockEntityType CHUNK_LOADER = register(ChunkLoaderBlockEntity.class, "chunk_loader", TRContent.Machine.CHUNK_LOADER); - public static final BlockEntityType CHARGE_O_MAT = register(ChargeOMatBlockEntity.class, "charge_o_mat", TRContent.Machine.CHARGE_O_MAT); - public static final BlockEntityType PLAYER_DETECTOR = register(PlayerDectectorBlockEntity.class, "player_detector", TRContent.Machine.PLAYER_DETECTOR); - public static final BlockEntityType CABLE = register(CableBlockEntity.class, "cable", TRContent.Cables.values()); - public static final BlockEntityType MACHINE_CASINGS = register(MachineCasingBlockEntity.class, "machine_casing", TRContent.MachineBlocks.getCasings()); - public static final BlockEntityType DRAGON_EGG_SYPHON = register(DragonEggSyphonBlockEntity.class, "dragon_egg_syphon", TRContent.Machine.DRAGON_EGG_SYPHON); - public static final BlockEntityType ASSEMBLY_MACHINE = register(AssemblingMachineBlockEntity.class, "assembly_machine", TRContent.Machine.ASSEMBLY_MACHINE); - public static final BlockEntityType DIESEL_GENERATOR = register(DieselGeneratorBlockEntity.class, "diesel_generator", TRContent.Machine.DIESEL_GENERATOR); - public static final BlockEntityType INDUSTRIAL_ELECTROLYZER = register(IndustrialElectrolyzerBlockEntity.class, "industrial_electrolyzer", TRContent.Machine.INDUSTRIAL_ELECTROLYZER); - public static final BlockEntityType SEMI_FLUID_GENERATOR = register(SemiFluidGeneratorBlockEntity.class, "semi_fluid_generator", TRContent.Machine.SEMI_FLUID_GENERATOR); - public static final BlockEntityType GAS_TURBINE = register(GasTurbineBlockEntity.class, "gas_turbine", TRContent.Machine.GAS_TURBINE); - public static final BlockEntityType IRON_ALLOY_FURNACE = register(IronAlloyFurnaceBlockEntity.class, "iron_alloy_furnace", TRContent.Machine.IRON_ALLOY_FURNACE); - public static final BlockEntityType CHEMICAL_REACTOR = register(ChemicalReactorBlockEntity.class, "chemical_reactor", TRContent.Machine.CHEMICAL_REACTOR); - public static final BlockEntityType INTERDIMENSIONAL_SU = register(InterdimensionalSUBlockEntity.class, "interdimensional_su", TRContent.Machine.INTERDIMENSIONAL_SU); - public static final BlockEntityType ADJUSTABLE_SU = register(AdjustableSUBlockEntity.class, "adjustable_su", TRContent.Machine.ADJUSTABLE_SU); - public static final BlockEntityType LAPOTRONIC_SU = register(LapotronicSUBlockEntity.class, "lapotronic_su", TRContent.Machine.LAPOTRONIC_SU); - public static final BlockEntityType LSU_STORAGE = register(LSUStorageBlockEntity.class, "lsu_storage", TRContent.Machine.LSU_STORAGE); - public static final BlockEntityType DISTILLATION_TOWER = register(DistillationTowerBlockEntity.class, "distillation_tower", TRContent.Machine.DISTILLATION_TOWER); - public static final BlockEntityType VACUUM_FREEZER = register(VacuumFreezerBlockEntity.class, "vacuum_freezer", TRContent.Machine.VACUUM_FREEZER); - public static final BlockEntityType FUSION_CONTROL_COMPUTER = register(FusionControlComputerBlockEntity.class, "fusion_control_computer", TRContent.Machine.FUSION_CONTROL_COMPUTER); - public static final BlockEntityType LIGHTNING_ROD = register(LightningRodBlockEntity.class, "lightning_rod", TRContent.Machine.LIGHTNING_ROD); - public static final BlockEntityType INDUSTRIAL_SAWMILL = register(IndustrialSawmillBlockEntity.class, "industrial_sawmill", TRContent.Machine.INDUSTRIAL_SAWMILL); - public static final BlockEntityType SOLID_FUEL_GENEREATOR = register(SolidFuelGeneratorBlockEntity.class, "solid_fuel_generator", TRContent.Machine.SOLID_FUEL_GENERATOR); - public static final BlockEntityType EXTRACTOR = register(ExtractorBlockEntity.class, "extractor", TRContent.Machine.EXTRACTOR); - public static final BlockEntityType COMPRESSOR = register(CompressorBlockEntity.class, "compressor", TRContent.Machine.COMPRESSOR); - public static final BlockEntityType ELECTRIC_FURNACE = register(ElectricFurnaceBlockEntity.class, "electric_furnace", TRContent.Machine.ELECTRIC_FURNACE); - public static final BlockEntityType SOLAR_PANEL = register(SolarPanelBlockEntity.class, "solar_panel", TRContent.SolarPanels.values()); - public static final BlockEntityType WATER_MILL = register(WaterMillBlockEntity.class, "water_mill", TRContent.Machine.WATER_MILL); - public static final BlockEntityType WIND_MILL = register(WindMillBlockEntity.class, "wind_mill", TRContent.Machine.WIND_MILL); - public static final BlockEntityType RECYCLER = register(RecyclerBlockEntity.class, "recycler", TRContent.Machine.RECYCLER); - public static final BlockEntityType LOW_VOLTAGE_SU = register(LowVoltageSUBlockEntity.class, "low_voltage_su", TRContent.Machine.LOW_VOLTAGE_SU); - public static final BlockEntityType MEDIUM_VOLTAGE_SU = register(MediumVoltageSUBlockEntity.class, "medium_voltage_su", TRContent.Machine.MEDIUM_VOLTAGE_SU); - public static final BlockEntityType HIGH_VOLTAGE_SU = register(HighVoltageSUBlockEntity.class, "high_voltage_su", TRContent.Machine.HIGH_VOLTAGE_SU); - public static final BlockEntityType LV_TRANSFORMER = register(LVTransformerBlockEntity.class, "lv_transformer", TRContent.Machine.LV_TRANSFORMER); - public static final BlockEntityType MV_TRANSFORMER = register(MVTransformerBlockEntity.class, "mv_transformer", TRContent.Machine.MV_TRANSFORMER); - public static final BlockEntityType HV_TRANSFORMER = register(HVTransformerBlockEntity.class, "hv_transformer", TRContent.Machine.HV_TRANSFORMER); - public static final BlockEntityType EV_TRANSFORMER = register(EVTransformerBlockEntity.class, "ev_transformer", TRContent.Machine.EV_TRANSFORMER); - public static final BlockEntityType AUTO_CRAFTING_TABLE = register(AutoCraftingTableBlockEntity.class, "auto_crafting_table", TRContent.Machine.AUTO_CRAFTING_TABLE); - public static final BlockEntityType IRON_FURNACE = register(IronFurnaceBlockEntity.class, "iron_furnace", TRContent.Machine.IRON_FURNACE); - public static final BlockEntityType SCRAPBOXINATOR = register(ScrapboxinatorBlockEntity.class, "scrapboxinator", TRContent.Machine.SCRAPBOXINATOR); - public static final BlockEntityType PLASMA_GENERATOR = register(PlasmaGeneratorBlockEntity.class, "plasma_generator", TRContent.Machine.PLASMA_GENERATOR); - public static final BlockEntityType LAMP = register(LampBlockEntity.class, "lamp", TRContent.Machine.LAMP_INCANDESCENT, TRContent.Machine.LAMP_LED); - public static final BlockEntityType ALARM = register(AlarmBlockEntity.class, "alarm", TRContent.Machine.ALARM); - public static final BlockEntityType FLUID_REPLICATOR = register(FluidReplicatorBlockEntity.class, "fluid_replicator", TRContent.Machine.FLUID_REPLICATOR); - public static final BlockEntityType SOLID_CANNING_MACHINE = register(SoildCanningMachineBlockEntity.class, "solid_canning_machine", TRContent.Machine.SOLID_CANNING_MACHINE); - public static final BlockEntityType WIRE_MILL = register(WireMillBlockEntity.class, "wire_mill", TRContent.Machine.WIRE_MILL); - public static final BlockEntityType GREENHOUSE_CONTROLLER = register(GreenhouseControllerBlockEntity.class, "greenhouse_controller", TRContent.Machine.GREENHOUSE_CONTROLLER); + public static final BlockEntityType STORAGE_UNIT = register(StorageUnitBaseBlockEntity::new, "storage_unit", TRContent.StorageUnit.values()); + public static final BlockEntityType TANK_UNIT = register(TankUnitBaseBlockEntity::new, "tank_unit", TRContent.TankUnit.values()); + public static final BlockEntityType QUANTUM_TANK = register(QuantumTankBlockEntity::new, "quantum_tank", TRContent.Machine.QUANTUM_TANK); + public static final BlockEntityType QUANTUM_CHEST = register(QuantumChestBlockEntity::new, "quantum_chest", TRContent.Machine.QUANTUM_CHEST); + public static final BlockEntityType DIGITAL_CHEST = register(DigitalChestBlockEntity::new, "digital_chest", TRContent.Machine.DIGITAL_CHEST); + public static final BlockEntityType CREATIVE_QUANTUM_CHEST = register(CreativeQuantumChestBlockEntity::new, "creative_quantum_chest", TRContent.Machine.CREATIVE_QUANTUM_CHEST); + public static final BlockEntityType CREATIVE_QUANTUM_TANK = register(CreativeQuantumTankBlockEntity::new, "creative_quantum_tank", TRContent.Machine.CREATIVE_QUANTUM_TANK); + public static final BlockEntityType DRAIN = register(DrainBlockEntity::new, "drain", TRContent.Machine.DRAIN); + public static final BlockEntityType THERMAL_GEN = register(ThermalGeneratorBlockEntity::new, "thermal_generator", TRContent.Machine.THERMAL_GENERATOR); + public static final BlockEntityType INDUSTRIAL_CENTRIFUGE = register(IndustrialCentrifugeBlockEntity::new, "industrial_centrifuge", TRContent.Machine.INDUSTRIAL_CENTRIFUGE); + public static final BlockEntityType ROLLING_MACHINE = register(RollingMachineBlockEntity::new, "rolling_machine", TRContent.Machine.ROLLING_MACHINE); + public static final BlockEntityType INDUSTRIAL_BLAST_FURNACE = register(IndustrialBlastFurnaceBlockEntity::new, "industrial_blast_furnace", TRContent.Machine.INDUSTRIAL_BLAST_FURNACE); + public static final BlockEntityType ALLOY_SMELTER = register(AlloySmelterBlockEntity::new, "alloy_smelter", TRContent.Machine.ALLOY_SMELTER); + public static final BlockEntityType INDUSTRIAL_GRINDER = register(IndustrialGrinderBlockEntity::new, "industrial_grinder", TRContent.Machine.INDUSTRIAL_GRINDER); + public static final BlockEntityType IMPLOSION_COMPRESSOR = register(ImplosionCompressorBlockEntity::new, "implosion_compressor", TRContent.Machine.IMPLOSION_COMPRESSOR); + public static final BlockEntityType MATTER_FABRICATOR = register(MatterFabricatorBlockEntity::new, "matter_fabricator", TRContent.Machine.MATTER_FABRICATOR); + public static final BlockEntityType CHUNK_LOADER = register(ChunkLoaderBlockEntity::new, "chunk_loader", TRContent.Machine.CHUNK_LOADER); + public static final BlockEntityType CHARGE_O_MAT = register(ChargeOMatBlockEntity::new, "charge_o_mat", TRContent.Machine.CHARGE_O_MAT); + public static final BlockEntityType PLAYER_DETECTOR = register(PlayerDectectorBlockEntity::new, "player_detector", TRContent.Machine.PLAYER_DETECTOR); + public static final BlockEntityType CABLE = register(CableBlockEntity::new, "cable", TRContent.Cables.values()); + public static final BlockEntityType MACHINE_CASINGS = register(MachineCasingBlockEntity::new, "machine_casing", TRContent.MachineBlocks.getCasings()); + public static final BlockEntityType DRAGON_EGG_SYPHON = register(DragonEggSyphonBlockEntity::new, "dragon_egg_syphon", TRContent.Machine.DRAGON_EGG_SYPHON); + public static final BlockEntityType ASSEMBLY_MACHINE = register(AssemblingMachineBlockEntity::new, "assembly_machine", TRContent.Machine.ASSEMBLY_MACHINE); + public static final BlockEntityType DIESEL_GENERATOR = register(DieselGeneratorBlockEntity::new, "diesel_generator", TRContent.Machine.DIESEL_GENERATOR); + public static final BlockEntityType INDUSTRIAL_ELECTROLYZER = register(IndustrialElectrolyzerBlockEntity::new, "industrial_electrolyzer", TRContent.Machine.INDUSTRIAL_ELECTROLYZER); + public static final BlockEntityType SEMI_FLUID_GENERATOR = register(SemiFluidGeneratorBlockEntity::new, "semi_fluid_generator", TRContent.Machine.SEMI_FLUID_GENERATOR); + public static final BlockEntityType GAS_TURBINE = register(GasTurbineBlockEntity::new, "gas_turbine", TRContent.Machine.GAS_TURBINE); + public static final BlockEntityType IRON_ALLOY_FURNACE = register(IronAlloyFurnaceBlockEntity::new, "iron_alloy_furnace", TRContent.Machine.IRON_ALLOY_FURNACE); + public static final BlockEntityType CHEMICAL_REACTOR = register(ChemicalReactorBlockEntity::new, "chemical_reactor", TRContent.Machine.CHEMICAL_REACTOR); + public static final BlockEntityType INTERDIMENSIONAL_SU = register(InterdimensionalSUBlockEntity::new, "interdimensional_su", TRContent.Machine.INTERDIMENSIONAL_SU); + public static final BlockEntityType ADJUSTABLE_SU = register(AdjustableSUBlockEntity::new, "adjustable_su", TRContent.Machine.ADJUSTABLE_SU); + public static final BlockEntityType LAPOTRONIC_SU = register(LapotronicSUBlockEntity::new, "lapotronic_su", TRContent.Machine.LAPOTRONIC_SU); + public static final BlockEntityType LSU_STORAGE = register(LSUStorageBlockEntity::new, "lsu_storage", TRContent.Machine.LSU_STORAGE); + public static final BlockEntityType DISTILLATION_TOWER = register(DistillationTowerBlockEntity::new, "distillation_tower", TRContent.Machine.DISTILLATION_TOWER); + public static final BlockEntityType VACUUM_FREEZER = register(VacuumFreezerBlockEntity::new, "vacuum_freezer", TRContent.Machine.VACUUM_FREEZER); + public static final BlockEntityType FUSION_CONTROL_COMPUTER = register(FusionControlComputerBlockEntity::new, "fusion_control_computer", TRContent.Machine.FUSION_CONTROL_COMPUTER); + public static final BlockEntityType LIGHTNING_ROD = register(LightningRodBlockEntity::new, "lightning_rod", TRContent.Machine.LIGHTNING_ROD); + public static final BlockEntityType INDUSTRIAL_SAWMILL = register(IndustrialSawmillBlockEntity::new, "industrial_sawmill", TRContent.Machine.INDUSTRIAL_SAWMILL); + public static final BlockEntityType SOLID_FUEL_GENEREATOR = register(SolidFuelGeneratorBlockEntity::new, "solid_fuel_generator", TRContent.Machine.SOLID_FUEL_GENERATOR); + public static final BlockEntityType EXTRACTOR = register(ExtractorBlockEntity::new, "extractor", TRContent.Machine.EXTRACTOR); + public static final BlockEntityType COMPRESSOR = register(CompressorBlockEntity::new, "compressor", TRContent.Machine.COMPRESSOR); + public static final BlockEntityType ELECTRIC_FURNACE = register(ElectricFurnaceBlockEntity::new, "electric_furnace", TRContent.Machine.ELECTRIC_FURNACE); + public static final BlockEntityType SOLAR_PANEL = register(SolarPanelBlockEntity::new, "solar_panel", TRContent.SolarPanels.values()); + public static final BlockEntityType WATER_MILL = register(WaterMillBlockEntity::new, "water_mill", TRContent.Machine.WATER_MILL); + public static final BlockEntityType WIND_MILL = register(WindMillBlockEntity::new, "wind_mill", TRContent.Machine.WIND_MILL); + public static final BlockEntityType RECYCLER = register(RecyclerBlockEntity::new, "recycler", TRContent.Machine.RECYCLER); + public static final BlockEntityType LOW_VOLTAGE_SU = register(LowVoltageSUBlockEntity::new, "low_voltage_su", TRContent.Machine.LOW_VOLTAGE_SU); + public static final BlockEntityType MEDIUM_VOLTAGE_SU = register(MediumVoltageSUBlockEntity::new, "medium_voltage_su", TRContent.Machine.MEDIUM_VOLTAGE_SU); + public static final BlockEntityType HIGH_VOLTAGE_SU = register(HighVoltageSUBlockEntity::new, "high_voltage_su", TRContent.Machine.HIGH_VOLTAGE_SU); + public static final BlockEntityType LV_TRANSFORMER = register(LVTransformerBlockEntity::new, "lv_transformer", TRContent.Machine.LV_TRANSFORMER); + public static final BlockEntityType MV_TRANSFORMER = register(MVTransformerBlockEntity::new, "mv_transformer", TRContent.Machine.MV_TRANSFORMER); + public static final BlockEntityType HV_TRANSFORMER = register(HVTransformerBlockEntity::new, "hv_transformer", TRContent.Machine.HV_TRANSFORMER); + public static final BlockEntityType EV_TRANSFORMER = register(EVTransformerBlockEntity::new, "ev_transformer", TRContent.Machine.EV_TRANSFORMER); + public static final BlockEntityType AUTO_CRAFTING_TABLE = register(AutoCraftingTableBlockEntity::new, "auto_crafting_table", TRContent.Machine.AUTO_CRAFTING_TABLE); + public static final BlockEntityType IRON_FURNACE = register(IronFurnaceBlockEntity::new, "iron_furnace", TRContent.Machine.IRON_FURNACE); + public static final BlockEntityType SCRAPBOXINATOR = register(ScrapboxinatorBlockEntity::new, "scrapboxinator", TRContent.Machine.SCRAPBOXINATOR); + public static final BlockEntityType PLASMA_GENERATOR = register(PlasmaGeneratorBlockEntity::new, "plasma_generator", TRContent.Machine.PLASMA_GENERATOR); + public static final BlockEntityType LAMP = register(LampBlockEntity::new, "lamp", TRContent.Machine.LAMP_INCANDESCENT, TRContent.Machine.LAMP_LED); + public static final BlockEntityType ALARM = register(AlarmBlockEntity::new, "alarm", TRContent.Machine.ALARM); + public static final BlockEntityType FLUID_REPLICATOR = register(FluidReplicatorBlockEntity::new, "fluid_replicator", TRContent.Machine.FLUID_REPLICATOR); + public static final BlockEntityType SOLID_CANNING_MACHINE = register(SoildCanningMachineBlockEntity::new, "solid_canning_machine", TRContent.Machine.SOLID_CANNING_MACHINE); + public static final BlockEntityType WIRE_MILL = register(WireMillBlockEntity::new, "wire_mill", TRContent.Machine.WIRE_MILL); + public static final BlockEntityType GREENHOUSE_CONTROLLER = register(GreenhouseControllerBlockEntity::new, "greenhouse_controller", TRContent.Machine.GREENHOUSE_CONTROLLER); - public static BlockEntityType register(Class tClass, String name, ItemConvertible... items) { - return register(tClass, name, Arrays.stream(items).map(itemConvertible -> Block.getBlockFromItem(itemConvertible.asItem())).toArray(Block[]::new)); + public static BlockEntityType register(Supplier supplier, String name, ItemConvertible... items) { + return register(supplier, name, Arrays.stream(items).map(itemConvertible -> Block.getBlockFromItem(itemConvertible.asItem())).toArray(Block[]::new)); } - public static BlockEntityType register(Class tClass, String name, Block... blocks) { + public static BlockEntityType register(Supplier supplier, String name, Block... blocks) { Validate.isTrue(blocks.length > 0, "no blocks for blockEntity entity type!"); - return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(() -> createBlockEntity(tClass), blocks)); - } - - private static T createBlockEntity(Class tClass){ - try { - return tClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - throw new RuntimeException("Failed to createBlockEntity blockEntity", e); - } + return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(supplier, blocks)); } public static BlockEntityType register(String id, BlockEntityType.Builder builder) {