diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index 19b0252b6..03c051fbc 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -38,7 +38,7 @@ import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.Torus; import reborncore.common.world.DataAttachment; import techreborn.blockentity.storage.energy.idsu.IDSUManager; -import techreborn.client.GuiHandler; +import techreborn.client.GuiType; import techreborn.config.TechRebornConfig; import techreborn.events.ModRegistry; import techreborn.init.FluidGeneratorRecipes; @@ -82,10 +82,10 @@ public class TechReborn implements ModInitializer { } ModLoot.init(); WorldGenerator.initBiomeFeatures(); - GuiHandler.register(); FluidGeneratorRecipes.init(); //Force loads the block entities at the right time TRBlockEntities.THERMAL_GEN.toString(); + GuiType.AESU.getIdentifier(); TRDispenserBehavior.init(); PoweredCraftingHandler.setup(); diff --git a/src/main/java/techreborn/blocks/DataDrivenMachineBlock.java b/src/main/java/techreborn/blocks/DataDrivenMachineBlock.java index 3825f87c8..b76cfcbdf 100644 --- a/src/main/java/techreborn/blocks/DataDrivenMachineBlock.java +++ b/src/main/java/techreborn/blocks/DataDrivenMachineBlock.java @@ -26,7 +26,7 @@ package techreborn.blocks; import net.minecraft.util.Identifier; import techreborn.blockentity.data.DataDrivenBEProvider; -import techreborn.client.EGui; +import techreborn.client.GuiType; /** * @author modmuss50 @@ -37,7 +37,7 @@ public class DataDrivenMachineBlock extends GenericMachineBlock { private final DataDrivenBEProvider provider; public DataDrivenMachineBlock(String ident){ - super(EGui.DATA_DRIVEN, null); + super(GuiType.DATA_DRIVEN, null); provider = DataDrivenBEProvider.create(this, new Identifier(ident)); blockEntityClass = provider; } diff --git a/src/main/java/techreborn/blocks/GenericMachineBlock.java b/src/main/java/techreborn/blocks/GenericMachineBlock.java index 1876655e4..467c4b7f8 100644 --- a/src/main/java/techreborn/blocks/GenericMachineBlock.java +++ b/src/main/java/techreborn/blocks/GenericMachineBlock.java @@ -28,7 +28,6 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; -import techreborn.client.EGui; import java.util.function.Supplier; @@ -38,10 +37,10 @@ import java.util.function.Supplier; */ public class GenericMachineBlock extends BlockMachineBase { - private EGui gui; + private IMachineGuiHandler gui; Supplier blockEntityClass; - public GenericMachineBlock(EGui gui, Supplier blockEntityClass) { + public GenericMachineBlock(IMachineGuiHandler gui, Supplier blockEntityClass) { super(); this.blockEntityClass = blockEntityClass; this.gui = gui; diff --git a/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java b/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java index de243b206..b8223e11e 100644 --- a/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java +++ b/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java @@ -39,9 +39,9 @@ import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.util.Torus; -import techreborn.client.EGui; -import techreborn.init.TRContent; import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity; +import techreborn.client.GuiType; +import techreborn.init.TRContent; import techreborn.utils.damageSources.FusionDamageSource; import java.util.List; @@ -78,7 +78,7 @@ public class BlockFusionControlComputer extends BlockMachineBase { @Override public IMachineGuiHandler getGui() { - return EGui.FUSION_CONTROLLER; + return GuiType.FUSION_CONTROLLER; } @Override diff --git a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java index 8b41f1f35..1f073e616 100644 --- a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java +++ b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java @@ -33,7 +33,7 @@ import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import techreborn.blockentity.generator.SolarPanelBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; import techreborn.init.TRContent.SolarPanels; /** @@ -58,7 +58,7 @@ public class BlockSolarPanel extends BlockMachineBase { if(this.panelType == SolarPanels.CREATIVE){ return null; } - return EGui.SOLAR_PANEL; + return GuiType.SOLAR_PANEL; } @Override diff --git a/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java b/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java index be962a622..945316210 100644 --- a/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java +++ b/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java @@ -28,9 +28,9 @@ import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import techreborn.blocks.GenericMachineBlock; -import techreborn.client.EGui; import java.util.function.Supplier; @@ -39,7 +39,7 @@ import java.util.function.Supplier; * for generators, like comparator output based on energy. */ public class GenericGeneratorBlock extends GenericMachineBlock { - public GenericGeneratorBlock(EGui gui, Supplier blockEntityClass) { + public GenericGeneratorBlock(IMachineGuiHandler gui, Supplier blockEntityClass) { super(gui, blockEntityClass); } diff --git a/src/main/java/techreborn/blocks/machine/tier0/IronAlloyFurnaceBlock.java b/src/main/java/techreborn/blocks/machine/tier0/IronAlloyFurnaceBlock.java index d61f86ac9..2b6512636 100644 --- a/src/main/java/techreborn/blocks/machine/tier0/IronAlloyFurnaceBlock.java +++ b/src/main/java/techreborn/blocks/machine/tier0/IronAlloyFurnaceBlock.java @@ -24,8 +24,6 @@ package techreborn.blocks.machine.tier0; -import java.util.Random; - import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.block.BlockState; @@ -35,14 +33,16 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import techreborn.client.EGui; import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; import techreborn.blocks.GenericMachineBlock; +import techreborn.client.GuiType; + +import java.util.Random; public class IronAlloyFurnaceBlock extends GenericMachineBlock { public IronAlloyFurnaceBlock() { - super(EGui.ALLOY_FURNACE, IronAlloyFurnaceBlockEntity::new); + super(GuiType.ALLOY_FURNACE, IronAlloyFurnaceBlockEntity::new); } // Block diff --git a/src/main/java/techreborn/blocks/machine/tier0/IronFurnaceBlock.java b/src/main/java/techreborn/blocks/machine/tier0/IronFurnaceBlock.java index 764b53071..f04026bf5 100644 --- a/src/main/java/techreborn/blocks/machine/tier0/IronFurnaceBlock.java +++ b/src/main/java/techreborn/blocks/machine/tier0/IronFurnaceBlock.java @@ -33,16 +33,16 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import techreborn.client.EGui; import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; import techreborn.blocks.GenericMachineBlock; +import techreborn.client.GuiType; import java.util.Random; public class IronFurnaceBlock extends GenericMachineBlock { public IronFurnaceBlock() { - super(EGui.IRON_FURNACE, IronFurnaceBlockEntity::new); + super(GuiType.IRON_FURNACE, IronFurnaceBlockEntity::new); } // Block diff --git a/src/main/java/techreborn/blocks/storage/OldBlock.java b/src/main/java/techreborn/blocks/storage/OldBlock.java index 553fd77bc..7d3ebe145 100644 --- a/src/main/java/techreborn/blocks/storage/OldBlock.java +++ b/src/main/java/techreborn/blocks/storage/OldBlock.java @@ -24,17 +24,16 @@ package techreborn.blocks.storage; -import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import techreborn.blocks.GenericMachineBlock; -import techreborn.client.EGui; +import techreborn.client.GuiType; import java.util.function.Supplier; @Deprecated public class OldBlock extends GenericMachineBlock { - public OldBlock(EGui gui, Supplier blockEntityClass) { + public OldBlock(GuiType gui, Supplier blockEntityClass) { super(gui, blockEntityClass); } } diff --git a/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java index c9380c777..5a209a7e0 100644 --- a/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java @@ -27,12 +27,12 @@ package techreborn.blocks.storage.energy; import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; public class AdjustableSUBlock extends EnergyStorageBlock { public AdjustableSUBlock() { - super("AESU", EGui.AESU); + super("AESU", GuiType.AESU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java index 098fdd54f..591d91066 100644 --- a/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java @@ -27,7 +27,7 @@ package techreborn.blocks.storage.energy; import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; /** * Created by modmuss50 on 14/03/2016. @@ -35,7 +35,7 @@ import techreborn.client.EGui; public class HighVoltageSUBlock extends EnergyStorageBlock { public HighVoltageSUBlock() { - super("high_voltage_su", EGui.HIGH_VOLTAGE_SU); + super("high_voltage_su", GuiType.HIGH_VOLTAGE_SU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java index 013a03dd3..d7c4781ff 100644 --- a/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java @@ -33,12 +33,12 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; import net.minecraft.world.World; import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; public class InterdimensionalSUBlock extends EnergyStorageBlock { public InterdimensionalSUBlock() { - super("IDSU", EGui.IDSU); + super("IDSU", GuiType.IDSU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java index dacfb75d4..23d331ec6 100644 --- a/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java @@ -27,12 +27,12 @@ package techreborn.blocks.storage.energy; import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; public class LapotronicSUBlock extends EnergyStorageBlock { public LapotronicSUBlock() { - super("LESU", EGui.LESU); + super("LESU", GuiType.LESU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java index 7a3ba96d0..9a4342157 100644 --- a/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java @@ -26,8 +26,8 @@ package techreborn.blocks.storage.energy; import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; -import techreborn.client.EGui; import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity; +import techreborn.client.GuiType; /** * Created by modmuss50 on 14/03/2016. @@ -35,7 +35,7 @@ import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity; public class LowVoltageSUBlock extends EnergyStorageBlock { public LowVoltageSUBlock() { - super("low_voltage_su", EGui.LOW_VOLTAGE_SU); + super("low_voltage_su", GuiType.LOW_VOLTAGE_SU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java index 181ed6903..1975c24e7 100644 --- a/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java @@ -27,7 +27,7 @@ package techreborn.blocks.storage.energy; import net.minecraft.block.entity.BlockEntity; import net.minecraft.world.BlockView; import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; /** * Created by modmuss50 on 14/03/2016. @@ -35,7 +35,7 @@ import techreborn.client.EGui; public class MediumVoltageSUBlock extends EnergyStorageBlock { public MediumVoltageSUBlock() { - super("medium_voltage_su", EGui.MEDIUM_VOLTAGE_SU); + super("medium_voltage_su", GuiType.MEDIUM_VOLTAGE_SU); } @Override diff --git a/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java b/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java index 00dffd7fa..58de15145 100644 --- a/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java +++ b/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java @@ -29,7 +29,7 @@ import net.minecraft.world.BlockView; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; import techreborn.init.TRContent; public class TankUnitBlock extends BlockMachineBase { @@ -48,6 +48,6 @@ public class TankUnitBlock extends BlockMachineBase { @Override public IMachineGuiHandler getGui() { - return EGui.TANK_UNIT; + return GuiType.TANK_UNIT; } } diff --git a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java index 0e76c9862..a528e75c9 100644 --- a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java +++ b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java @@ -37,7 +37,7 @@ import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; -import techreborn.client.EGui; +import techreborn.client.GuiType; import techreborn.init.TRContent; public class StorageUnitBlock extends BlockMachineBase { @@ -80,6 +80,6 @@ public class StorageUnitBlock extends BlockMachineBase { @Override public IMachineGuiHandler getGui() { - return EGui.STORAGE_UNIT; + return GuiType.STORAGE_UNIT; } } diff --git a/src/main/java/techreborn/client/EGui.java b/src/main/java/techreborn/client/EGui.java deleted file mode 100644 index f9668761f..000000000 --- a/src/main/java/techreborn/client/EGui.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2020 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.client; - -import net.fabricmc.fabric.api.container.ContainerProviderRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import reborncore.api.blockentity.IMachineGuiHandler; - -import java.util.Arrays; -import java.util.Locale; -import java.util.stream.Stream; - -public enum EGui implements IMachineGuiHandler { - - AESU, - ALLOY_FURNACE, - ALLOY_SMELTER, - ASSEMBLING_MACHINE, - AUTO_CRAFTING_TABLE, - BLAST_FURNACE, - CENTRIFUGE, - CHARGEBENCH, - CHEMICAL_REACTOR, - CHUNK_LOADER, - COMPRESSOR, - DIESEL_GENERATOR, - DISTILLATION_TOWER, - ELECTRIC_FURNACE, - EXTRACTOR, - FUSION_CONTROLLER, - GAS_TURBINE, - GENERATOR, - HIGH_VOLTAGE_SU, - IDSU, - IMPLOSION_COMPRESSOR, - INDUSTRIAL_ELECTROLYZER, - INDUSTRIAL_GRINDER, - IRON_FURNACE, - LESU, - LOW_VOLTAGE_SU, - MANUAL(false), - MATTER_FABRICATOR, - MEDIUM_VOLTAGE_SU, - PLASMA_GENERATOR, - STORAGE_UNIT, - TANK_UNIT, - RECYCLER, - ROLLING_MACHINE, - SAWMILL, - SCRAPBOXINATOR, - SOLAR_PANEL, - SEMIFLUID_GENERATOR, - THERMAL_GENERATOR, - VACUUM_FREEZER, - SOLID_CANNING_MACHINE, - WIRE_MILL, - GREENHOUSE_CONTROLLER, - FLUID_REPLICATOR, - - DATA_DRIVEN; - - private final boolean containerBuilder; - - EGui(final boolean containerBuilder) { - this.containerBuilder = containerBuilder; - } - - EGui(){ - this(true); - } - - public static EGui byID(Identifier resourceLocation){ - return Arrays.stream(values()) - .filter(eGui -> eGui.name().toLowerCase(Locale.ROOT).equals(resourceLocation.getPath())) - .findFirst() - .orElseThrow(() -> new RuntimeException("Failed to find gui for " + resourceLocation)); - } - - public static Stream stream(){ - return Arrays.stream(values()); - } - - public Identifier getID(){ - return new Identifier("techreborn", name().toLowerCase(Locale.ROOT)); - } - - @Override - public void open(PlayerEntity player, BlockPos pos, World world) { - if(!world.isClient){ - ContainerProviderRegistry.INSTANCE.openContainer(getID(), player, packetByteBuf -> packetByteBuf.writeBlockPos(pos)); - } - } - - public boolean useContainerBuilder() { - return this.containerBuilder; - } -} diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java deleted file mode 100644 index 5c6ae9330..000000000 --- a/src/main/java/techreborn/client/GuiHandler.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2020 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.client; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; -import net.fabricmc.fabric.api.container.ContainerProviderRegistry; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.BlockPos; -import reborncore.RebornCore; -import reborncore.client.containerBuilder.IContainerProvider; -import techreborn.blockentity.data.DataDrivenBEProvider; -import techreborn.blockentity.data.DataDrivenGui; -import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity; -import techreborn.blockentity.generator.SolarPanelBlockEntity; -import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity; -import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity; -import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity; -import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity; -import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity; -import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; -import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; -import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity; -import techreborn.blockentity.machine.multiblock.*; -import techreborn.blockentity.machine.tier1.*; -import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity; -import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity; -import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity; -import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity; -import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity; -import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity; -import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity; -import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity; -import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity; -import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity; -import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; -import techreborn.client.gui.*; - -public class GuiHandler { - - public static void register() { - - EGui.stream().forEach(gui -> ContainerProviderRegistry.INSTANCE.registerFactory(gui.getID(), (syncID, identifier, playerEntity, packetByteBuf) -> { - final BlockEntity blockEntity = playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos()); - return ((IContainerProvider) blockEntity).createContainer(syncID, playerEntity); - })); - - RebornCore.clientOnly(() -> () -> EGui.stream().forEach(gui -> ScreenProviderRegistry.INSTANCE.registerFactory(gui.getID(), (syncID, identifier, playerEntity, packetByteBuf) -> getClientGuiElement(EGui.byID(identifier), playerEntity, packetByteBuf.readBlockPos(), syncID)))); - } - - @Environment(EnvType.CLIENT) - private static ContainerScreen getClientGuiElement(final EGui gui, final PlayerEntity player, BlockPos pos, int syncID) { - final BlockEntity blockEntity = player.world.getBlockEntity(pos); - - if (blockEntity instanceof DataDrivenBEProvider.DataDrivenBlockEntity) { - return new DataDrivenGui(syncID, player, (DataDrivenBEProvider.DataDrivenBlockEntity) blockEntity); - } - - switch (gui) { - case AESU: - return new GuiAESU(syncID, player, (AdjustableSUBlockEntity) blockEntity); - case ALLOY_FURNACE: - return new GuiAlloyFurnace(syncID, player, (IronAlloyFurnaceBlockEntity) blockEntity); - case ALLOY_SMELTER: - return new GuiAlloySmelter(syncID, player, (AlloySmelterBlockEntity) blockEntity); - case ASSEMBLING_MACHINE: - return new GuiAssemblingMachine(syncID, player, (AssemblingMachineBlockEntity) blockEntity); - case LOW_VOLTAGE_SU: - return new GuiBatbox(syncID, player, (LowVoltageSUBlockEntity) blockEntity); - case BLAST_FURNACE: - return new GuiBlastFurnace(syncID, player, (IndustrialBlastFurnaceBlockEntity) blockEntity); - case CENTRIFUGE: - return new GuiCentrifuge(syncID, player, (IndustrialCentrifugeBlockEntity) blockEntity); - case CHARGEBENCH: - return new GuiChargeBench(syncID, player, (ChargeOMatBlockEntity) blockEntity); - case CHEMICAL_REACTOR: - return new GuiChemicalReactor(syncID, player, (ChemicalReactorBlockEntity) blockEntity); - case CHUNK_LOADER: - return new GuiChunkLoader(syncID, player, (ChunkLoaderBlockEntity) blockEntity); - case COMPRESSOR: - return new GuiCompressor(syncID, player, (CompressorBlockEntity) blockEntity); - case DIESEL_GENERATOR: - return new GuiDieselGenerator(syncID, player, (DieselGeneratorBlockEntity) blockEntity); - case ELECTRIC_FURNACE: - return new GuiElectricFurnace(syncID, player, (ElectricFurnaceBlockEntity) blockEntity); - case EXTRACTOR: - return new GuiExtractor(syncID, player, (ExtractorBlockEntity) blockEntity); - case FUSION_CONTROLLER: - return new GuiFusionReactor(syncID, player, (FusionControlComputerBlockEntity) blockEntity); - case GAS_TURBINE: - return new GuiGasTurbine(syncID, player, (GasTurbineBlockEntity) blockEntity); - case GENERATOR: - return new GuiGenerator(syncID, player, (SolidFuelGeneratorBlockEntity) blockEntity); - case IDSU: - return new GuiIDSU(syncID, player, (InterdimensionalSUBlockEntity) blockEntity); - case IMPLOSION_COMPRESSOR: - return new GuiImplosionCompressor(syncID, player, (ImplosionCompressorBlockEntity) blockEntity); - case INDUSTRIAL_ELECTROLYZER: - return new GuiIndustrialElectrolyzer(syncID, player, (IndustrialElectrolyzerBlockEntity) blockEntity); - case INDUSTRIAL_GRINDER: - return new GuiIndustrialGrinder(syncID, player, (IndustrialGrinderBlockEntity) blockEntity); - case IRON_FURNACE: - return new GuiIronFurnace(syncID, player, (IronFurnaceBlockEntity) blockEntity); - case LESU: - return new GuiLESU(syncID, player, (LapotronicSUBlockEntity) blockEntity); - case MATTER_FABRICATOR: - return new GuiMatterFabricator(syncID, player, (MatterFabricatorBlockEntity) blockEntity); - case MEDIUM_VOLTAGE_SU: - return new GuiMFE(syncID, player, (MediumVoltageSUBlockEntity) blockEntity); - case HIGH_VOLTAGE_SU: - return new GuiMFSU(syncID, player, (HighVoltageSUBlockEntity) blockEntity); - case STORAGE_UNIT: - return new GuiStorageUnit(syncID, player, (StorageUnitBaseBlockEntity) blockEntity); - case TANK_UNIT: - return new GuiTankUnit(syncID, player, (TankUnitBaseBlockEntity) blockEntity); - case RECYCLER: - return new GuiRecycler(syncID, player, (RecyclerBlockEntity) blockEntity); - case ROLLING_MACHINE: - return new GuiRollingMachine(syncID, player, (RollingMachineBlockEntity) blockEntity); - case SAWMILL: - return new GuiIndustrialSawmill(syncID, player, (IndustrialSawmillBlockEntity) blockEntity); - case SCRAPBOXINATOR: - return new GuiScrapboxinator(syncID, player, (ScrapboxinatorBlockEntity) blockEntity); - case SOLAR_PANEL: - return new GuiSolar(syncID, player, (SolarPanelBlockEntity) blockEntity); - case SEMIFLUID_GENERATOR: - return new GuiSemifluidGenerator(syncID, player, (SemiFluidGeneratorBlockEntity) blockEntity); - case THERMAL_GENERATOR: - return new GuiThermalGenerator(syncID, player, (ThermalGeneratorBlockEntity) blockEntity); - case VACUUM_FREEZER: - return new GuiVacuumFreezer(syncID, player, (VacuumFreezerBlockEntity) blockEntity); - case AUTO_CRAFTING_TABLE: - return new GuiAutoCrafting(syncID, player, (AutoCraftingTableBlockEntity) blockEntity); - case PLASMA_GENERATOR: - return new GuiPlasmaGenerator(syncID, player, (PlasmaGeneratorBlockEntity) blockEntity); - case DISTILLATION_TOWER: - return new GuiDistillationTower(syncID, player, (DistillationTowerBlockEntity) blockEntity); - case FLUID_REPLICATOR: - return new GuiFluidReplicator(syncID, player, (FluidReplicatorBlockEntity) blockEntity); - case SOLID_CANNING_MACHINE: - return new GuiSolidCanningMachine(syncID, player, (SoildCanningMachineBlockEntity) blockEntity); - case WIRE_MILL: - return new GuiWireMill(syncID, player, (WireMillBlockEntity) blockEntity); - case GREENHOUSE_CONTROLLER: - return new GuiGreenhouseController(syncID, player, (GreenhouseControllerBlockEntity) blockEntity); - default: - break; - - } - return null; - } -} diff --git a/src/main/java/techreborn/client/GuiType.java b/src/main/java/techreborn/client/GuiType.java new file mode 100644 index 000000000..f46090a19 --- /dev/null +++ b/src/main/java/techreborn/client/GuiType.java @@ -0,0 +1,219 @@ +package techreborn.client; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; +import net.fabricmc.fabric.api.container.ContainerFactory; +import net.fabricmc.fabric.api.container.ContainerProviderRegistry; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Identifier; +import net.minecraft.util.PacketByteBuf; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import reborncore.RebornCore; +import reborncore.api.blockentity.IMachineGuiHandler; +import reborncore.client.containerBuilder.IContainerProvider; +import techreborn.blockentity.data.DataDrivenBEProvider; +import techreborn.blockentity.data.DataDrivenGui; +import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity; +import techreborn.blockentity.generator.SolarPanelBlockEntity; +import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity; +import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity; +import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity; +import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity; +import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity; +import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity; +import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity; +import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity; +import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity; +import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity; +import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity; +import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity; +import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity; +import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity; +import techreborn.blockentity.machine.tier1.AssemblingMachineBlockEntity; +import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity; +import techreborn.blockentity.machine.tier1.ChemicalReactorBlockEntity; +import techreborn.blockentity.machine.tier1.CompressorBlockEntity; +import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity; +import techreborn.blockentity.machine.tier1.ExtractorBlockEntity; +import techreborn.blockentity.machine.tier1.GreenhouseControllerBlockEntity; +import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity; +import techreborn.blockentity.machine.tier1.RecyclerBlockEntity; +import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity; +import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity; +import techreborn.blockentity.machine.tier1.SoildCanningMachineBlockEntity; +import techreborn.blockentity.machine.tier1.WireMillBlockEntity; +import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity; +import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity; +import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity; +import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity; +import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity; +import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity; +import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity; +import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity; +import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity; +import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity; +import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; +import techreborn.client.gui.GuiAESU; +import techreborn.client.gui.GuiAlloyFurnace; +import techreborn.client.gui.GuiAlloySmelter; +import techreborn.client.gui.GuiAssemblingMachine; +import techreborn.client.gui.GuiAutoCrafting; +import techreborn.client.gui.GuiBatbox; +import techreborn.client.gui.GuiBlastFurnace; +import techreborn.client.gui.GuiCentrifuge; +import techreborn.client.gui.GuiChargeBench; +import techreborn.client.gui.GuiChemicalReactor; +import techreborn.client.gui.GuiChunkLoader; +import techreborn.client.gui.GuiCompressor; +import techreborn.client.gui.GuiDieselGenerator; +import techreborn.client.gui.GuiDistillationTower; +import techreborn.client.gui.GuiElectricFurnace; +import techreborn.client.gui.GuiExtractor; +import techreborn.client.gui.GuiFluidReplicator; +import techreborn.client.gui.GuiFusionReactor; +import techreborn.client.gui.GuiGasTurbine; +import techreborn.client.gui.GuiGenerator; +import techreborn.client.gui.GuiGreenhouseController; +import techreborn.client.gui.GuiIDSU; +import techreborn.client.gui.GuiImplosionCompressor; +import techreborn.client.gui.GuiIndustrialElectrolyzer; +import techreborn.client.gui.GuiIndustrialGrinder; +import techreborn.client.gui.GuiIndustrialSawmill; +import techreborn.client.gui.GuiIronFurnace; +import techreborn.client.gui.GuiLESU; +import techreborn.client.gui.GuiMFE; +import techreborn.client.gui.GuiMFSU; +import techreborn.client.gui.GuiMatterFabricator; +import techreborn.client.gui.GuiPlasmaGenerator; +import techreborn.client.gui.GuiRecycler; +import techreborn.client.gui.GuiRollingMachine; +import techreborn.client.gui.GuiScrapboxinator; +import techreborn.client.gui.GuiSemifluidGenerator; +import techreborn.client.gui.GuiSolar; +import techreborn.client.gui.GuiSolidCanningMachine; +import techreborn.client.gui.GuiStorageUnit; +import techreborn.client.gui.GuiTankUnit; +import techreborn.client.gui.GuiThermalGenerator; +import techreborn.client.gui.GuiVacuumFreezer; +import techreborn.client.gui.GuiWireMill; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +//The meme is here the double suppliers dont cause the client side gui classes to load on the server +public final class GuiType implements IMachineGuiHandler { + private static final Map> TYPES = new HashMap<>(); + + public static final GuiType AESU = register("aesu", () -> () -> GuiAESU::new); + public static final GuiType ALLOY_FURNACE = register("alloy_furnace", () -> () -> GuiAlloyFurnace::new); + public static final GuiType ALLOY_SMELTER = register("alloy_smelter", () -> () -> GuiAlloySmelter::new); + public static final GuiType ASSEMBLING_MACHINE = register("assembling_machine", () -> () -> GuiAssemblingMachine::new); + public static final GuiType LOW_VOLTAGE_SU = register("low_voltage_su", () -> () -> GuiBatbox::new); + public static final GuiType AUTO_CRAFTING_TABLE = register("auto_crafting_table", () -> () -> GuiAutoCrafting::new); + public static final GuiType BLAST_FURNACE = register("blast_furnace", () -> () -> GuiBlastFurnace::new); + public static final GuiType CENTRIFUGE = register("centrifuge", () -> () -> GuiCentrifuge::new); + public static final GuiType CHARGEBENCH = register("chargebench", () -> () -> GuiChargeBench::new); + public static final GuiType CHEMICAL_REACTOR = register("chemical_reactor", () -> () -> GuiChemicalReactor::new); + public static final GuiType CHUNK_LOADER = register("chunk_loader", () -> () -> GuiChunkLoader::new); + public static final GuiType COMPRESSOR = register("compressor", () -> () -> GuiCompressor::new); + public static final GuiType DIESEL_GENERATOR = register("diesel_generator", () -> () -> GuiDieselGenerator::new); + public static final GuiType DISTILLATION_TOWER = register("distillation_tower", () -> () -> GuiDistillationTower::new); + public static final GuiType ELECTRIC_FURNACE = register("electric_furnace", () -> () -> GuiElectricFurnace::new); + public static final GuiType EXTRACTOR = register("extractor", () -> () -> GuiExtractor::new); + public static final GuiType FUSION_CONTROLLER = register("fusion_controller", () -> () -> GuiFusionReactor::new); + public static final GuiType GAS_TURBINE = register("gas_turbine", () -> () -> GuiGasTurbine::new); + public static final GuiType GENERATOR = register("generator", () -> () -> GuiGenerator::new); + public static final GuiType HIGH_VOLTAGE_SU = register("high_voltage_su", () -> () -> GuiMFSU::new); + public static final GuiType IDSU = register("idsu", () -> () -> GuiIDSU::new); + public static final GuiType IMPLOSION_COMPRESSOR = register("implosion_compressor", () -> () -> GuiImplosionCompressor::new); + public static final GuiType INDUSTRIAL_ELECTROLYZER = register("industrial_electrolyzer", () -> () -> GuiIndustrialElectrolyzer::new); + public static final GuiType INDUSTRIAL_GRINDER = register("industrial_grinder", () -> () -> GuiIndustrialGrinder::new); + public static final GuiType LESU = register("lesu", () -> () -> GuiLESU::new); + public static final GuiType MATTER_FABRICATOR = register("matter_fabricator", () -> () -> GuiMatterFabricator::new); + public static final GuiType MEDIUM_VOLTAGE_SU = register("medium_voltage_su", () -> () -> GuiMFE::new); + public static final GuiType PLASMA_GENERATOR = register("plasma_generator", () -> () -> GuiPlasmaGenerator::new); + public static final GuiType IRON_FURNACE = register("iron_furnace", () -> () -> GuiIronFurnace::new); + public static final GuiType STORAGE_UNIT = register("storage_unit", () -> () -> GuiStorageUnit::new); + public static final GuiType TANK_UNIT = register("tank_unit", () -> () -> GuiTankUnit::new); + public static final GuiType RECYCLER = register("recycler", () -> () -> GuiRecycler::new); + public static final GuiType ROLLING_MACHINE = register("rolling_machine", () -> () -> GuiRollingMachine::new); + public static final GuiType SAWMILL = register("sawmill", () -> () -> GuiIndustrialSawmill::new); + public static final GuiType SCRAPBOXINATOR = register("scrapboxinator", () -> () -> GuiScrapboxinator::new); + public static final GuiType SOLAR_PANEL = register("solar_panel", () -> () -> GuiSolar::new); + public static final GuiType SEMIFLUID_GENERATOR = register("semifluid_generator", () -> () -> GuiSemifluidGenerator::new); + public static final GuiType THERMAL_GENERATOR = register("thermal_generator", () -> () -> GuiThermalGenerator::new); + public static final GuiType VACUUM_FREEZER = register("vacuum_freezer", () -> () -> GuiVacuumFreezer::new); + public static final GuiType SOLID_CANNING_MACHINE = register("solid_canning_machine", () -> () -> GuiSolidCanningMachine::new); + public static final GuiType WIRE_MILL = register("wire_mill", () -> () -> GuiWireMill::new); + public static final GuiType GREENHOUSE_CONTROLLER = register("greenhouse_controller", () -> () -> GuiGreenhouseController::new); + public static final GuiType FLUID_REPLICATOR = register("fluid_replicator", () -> () -> GuiFluidReplicator::new); + + public static final GuiType DATA_DRIVEN = register("data_driven", () -> () -> DataDrivenGui::new); + + private static GuiType register(String id, Supplier>> factorySupplierMeme) { + return register(new Identifier("techreborn", id), factorySupplierMeme); + } + + public static GuiType register(Identifier identifier, Supplier>> factorySupplierMeme) { + if (TYPES.containsKey(identifier)) { + throw new RuntimeException("Duplicate gui type found"); + } + GuiType type = new GuiType<>(identifier, factorySupplierMeme); + TYPES.put(identifier, type); + return type; + } + + private final Identifier identifier; + private final Supplier>> factorySupplierMeme; + + private GuiType(Identifier identifier, Supplier>> factorySupplierMeme) { + this.identifier = identifier; + this.factorySupplierMeme = factorySupplierMeme; + register(); + } + + @Environment(EnvType.CLIENT) + private GuiFactory getFactory() { + return factorySupplierMeme.get().get(); + } + + @Override + public void open(PlayerEntity player, BlockPos pos, World world) { + if(!world.isClient){ + ContainerProviderRegistry.INSTANCE.openContainer(identifier, player, packetByteBuf -> packetByteBuf.writeBlockPos(pos)); + } + } + + private void register() { + ContainerProviderRegistry.INSTANCE.registerFactory(identifier, (syncID, identifier, playerEntity, packetByteBuf) -> { + final BlockEntity blockEntity = playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos()); + return ((IContainerProvider) blockEntity).createContainer(syncID, playerEntity); + }); + RebornCore.clientOnly(() -> () -> ScreenProviderRegistry.INSTANCE.registerFactory(identifier, getFactory())); + } + + public Identifier getIdentifier() { + return identifier; + } + + @Environment(EnvType.CLIENT) + public interface GuiFactory extends ContainerFactory { + ContainerScreen create(int syncId, PlayerEntity playerEntity, T blockEntity); + + @Override + default ContainerScreen create(int syncId, Identifier identifier, PlayerEntity playerEntity, PacketByteBuf packetByteBuf) { + //noinspection unchecked + T blockEntity = (T) playerEntity.world.getBlockEntity(packetByteBuf.readBlockPos()); + return create(syncId, playerEntity, blockEntity); + } + } + +} diff --git a/src/main/java/techreborn/init/TRContent.java b/src/main/java/techreborn/init/TRContent.java index 7e87431d5..ee035dc56 100644 --- a/src/main/java/techreborn/init/TRContent.java +++ b/src/main/java/techreborn/init/TRContent.java @@ -40,14 +40,37 @@ import team.reborn.energy.EnergyTier; import techreborn.TechReborn; import techreborn.blockentity.generator.LightningRodBlockEntity; import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity; -import techreborn.blockentity.generator.advanced.*; +import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity; +import techreborn.blockentity.generator.advanced.DragonEggSyphonBlockEntity; +import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity; +import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity; +import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity; import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity; import techreborn.blockentity.generator.basic.WaterMillBlockEntity; import techreborn.blockentity.generator.basic.WindMillBlockEntity; import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity; import techreborn.blockentity.machine.misc.DrainBlockEntity; -import techreborn.blockentity.machine.multiblock.*; -import techreborn.blockentity.machine.tier1.*; +import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity; +import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity; +import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity; +import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity; +import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity; +import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity; +import techreborn.blockentity.machine.tier1.AssemblingMachineBlockEntity; +import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity; +import techreborn.blockentity.machine.tier1.ChemicalReactorBlockEntity; +import techreborn.blockentity.machine.tier1.CompressorBlockEntity; +import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity; +import techreborn.blockentity.machine.tier1.ExtractorBlockEntity; +import techreborn.blockentity.machine.tier1.GreenhouseControllerBlockEntity; +import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity; +import techreborn.blockentity.machine.tier1.RecyclerBlockEntity; +import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity; +import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity; +import techreborn.blockentity.machine.tier1.SoildCanningMachineBlockEntity; +import techreborn.blockentity.machine.tier1.WireMillBlockEntity; import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity; import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity; import techreborn.blockentity.machine.tier3.MatterFabricatorBlockEntity; @@ -73,14 +96,20 @@ import techreborn.blocks.misc.BlockMachineCasing; import techreborn.blocks.misc.BlockMachineFrame; import techreborn.blocks.misc.BlockStorage; import techreborn.blocks.storage.OldBlock; -import techreborn.blocks.storage.energy.*; +import techreborn.blocks.storage.energy.AdjustableSUBlock; +import techreborn.blocks.storage.energy.HighVoltageSUBlock; +import techreborn.blocks.storage.energy.InterdimensionalSUBlock; +import techreborn.blocks.storage.energy.LSUStorageBlock; +import techreborn.blocks.storage.energy.LapotronicSUBlock; +import techreborn.blocks.storage.energy.LowVoltageSUBlock; +import techreborn.blocks.storage.energy.MediumVoltageSUBlock; import techreborn.blocks.storage.fluid.TankUnitBlock; import techreborn.blocks.storage.item.StorageUnitBlock; import techreborn.blocks.transformers.BlockEVTransformer; import techreborn.blocks.transformers.BlockHVTransformer; import techreborn.blocks.transformers.BlockLVTransformer; import techreborn.blocks.transformers.BlockMVTransformer; -import techreborn.client.EGui; +import techreborn.client.GuiType; import techreborn.config.TechRebornConfig; import techreborn.entities.EntityNukePrimed; import techreborn.items.DynamicCellItem; @@ -467,43 +496,43 @@ public class TRContent { public enum Machine implements ItemConvertible { - ALLOY_SMELTER(new GenericMachineBlock(EGui.ALLOY_SMELTER, AlloySmelterBlockEntity::new)), - ASSEMBLY_MACHINE(new GenericMachineBlock(EGui.ASSEMBLING_MACHINE, AssemblingMachineBlockEntity::new)), - AUTO_CRAFTING_TABLE(new GenericMachineBlock(EGui.AUTO_CRAFTING_TABLE, AutoCraftingTableBlockEntity::new)), - CHEMICAL_REACTOR(new GenericMachineBlock(EGui.CHEMICAL_REACTOR, ChemicalReactorBlockEntity::new)), - COMPRESSOR(new GenericMachineBlock(EGui.COMPRESSOR, CompressorBlockEntity::new)), - DISTILLATION_TOWER(new GenericMachineBlock(EGui.DISTILLATION_TOWER, DistillationTowerBlockEntity::new)), - EXTRACTOR(new GenericMachineBlock(EGui.EXTRACTOR, ExtractorBlockEntity::new)), - FLUID_REPLICATOR(new GenericMachineBlock(EGui.FLUID_REPLICATOR, FluidReplicatorBlockEntity::new)), + ALLOY_SMELTER(new GenericMachineBlock(GuiType.ALLOY_SMELTER, AlloySmelterBlockEntity::new)), + ASSEMBLY_MACHINE(new GenericMachineBlock(GuiType.ASSEMBLING_MACHINE, AssemblingMachineBlockEntity::new)), + AUTO_CRAFTING_TABLE(new GenericMachineBlock(GuiType.AUTO_CRAFTING_TABLE, AutoCraftingTableBlockEntity::new)), + CHEMICAL_REACTOR(new GenericMachineBlock(GuiType.CHEMICAL_REACTOR, ChemicalReactorBlockEntity::new)), + COMPRESSOR(new GenericMachineBlock(GuiType.COMPRESSOR, CompressorBlockEntity::new)), + DISTILLATION_TOWER(new GenericMachineBlock(GuiType.DISTILLATION_TOWER, DistillationTowerBlockEntity::new)), + EXTRACTOR(new GenericMachineBlock(GuiType.EXTRACTOR, ExtractorBlockEntity::new)), + FLUID_REPLICATOR(new GenericMachineBlock(GuiType.FLUID_REPLICATOR, FluidReplicatorBlockEntity::new)), GRINDER(new DataDrivenMachineBlock("techreborn:grinder")), - ELECTRIC_FURNACE(new GenericMachineBlock(EGui.ELECTRIC_FURNACE, ElectricFurnaceBlockEntity::new)), - IMPLOSION_COMPRESSOR(new GenericMachineBlock(EGui.IMPLOSION_COMPRESSOR, ImplosionCompressorBlockEntity::new)), - INDUSTRIAL_BLAST_FURNACE(new GenericMachineBlock(EGui.BLAST_FURNACE, IndustrialBlastFurnaceBlockEntity::new)), - INDUSTRIAL_CENTRIFUGE(new GenericMachineBlock(EGui.CENTRIFUGE, IndustrialCentrifugeBlockEntity::new)), - INDUSTRIAL_ELECTROLYZER(new GenericMachineBlock(EGui.INDUSTRIAL_ELECTROLYZER, IndustrialElectrolyzerBlockEntity::new)), - INDUSTRIAL_GRINDER(new GenericMachineBlock(EGui.INDUSTRIAL_GRINDER, IndustrialGrinderBlockEntity::new)), - INDUSTRIAL_SAWMILL(new GenericMachineBlock(EGui.SAWMILL, IndustrialSawmillBlockEntity::new)), + ELECTRIC_FURNACE(new GenericMachineBlock(GuiType.ELECTRIC_FURNACE, ElectricFurnaceBlockEntity::new)), + IMPLOSION_COMPRESSOR(new GenericMachineBlock(GuiType.IMPLOSION_COMPRESSOR, ImplosionCompressorBlockEntity::new)), + INDUSTRIAL_BLAST_FURNACE(new GenericMachineBlock(GuiType.BLAST_FURNACE, IndustrialBlastFurnaceBlockEntity::new)), + INDUSTRIAL_CENTRIFUGE(new GenericMachineBlock(GuiType.CENTRIFUGE, IndustrialCentrifugeBlockEntity::new)), + INDUSTRIAL_ELECTROLYZER(new GenericMachineBlock(GuiType.INDUSTRIAL_ELECTROLYZER, IndustrialElectrolyzerBlockEntity::new)), + INDUSTRIAL_GRINDER(new GenericMachineBlock(GuiType.INDUSTRIAL_GRINDER, IndustrialGrinderBlockEntity::new)), + INDUSTRIAL_SAWMILL(new GenericMachineBlock(GuiType.SAWMILL, IndustrialSawmillBlockEntity::new)), IRON_ALLOY_FURNACE(new IronAlloyFurnaceBlock()), IRON_FURNACE(new IronFurnaceBlock()), - MATTER_FABRICATOR(new GenericMachineBlock(EGui.MATTER_FABRICATOR, MatterFabricatorBlockEntity::new)), - RECYCLER(new GenericMachineBlock(EGui.RECYCLER, RecyclerBlockEntity::new)), - ROLLING_MACHINE(new GenericMachineBlock(EGui.ROLLING_MACHINE, RollingMachineBlockEntity::new)), - SCRAPBOXINATOR(new GenericMachineBlock(EGui.SCRAPBOXINATOR, ScrapboxinatorBlockEntity::new)), - VACUUM_FREEZER(new GenericMachineBlock(EGui.VACUUM_FREEZER, VacuumFreezerBlockEntity::new)), - SOLID_CANNING_MACHINE(new GenericMachineBlock(EGui.SOLID_CANNING_MACHINE, SoildCanningMachineBlockEntity::new)), - WIRE_MILL(new GenericMachineBlock(EGui.WIRE_MILL, WireMillBlockEntity::new)), - GREENHOUSE_CONTROLLER(new GenericMachineBlock(EGui.GREENHOUSE_CONTROLLER, GreenhouseControllerBlockEntity::new)), + MATTER_FABRICATOR(new GenericMachineBlock(GuiType.MATTER_FABRICATOR, MatterFabricatorBlockEntity::new)), + RECYCLER(new GenericMachineBlock(GuiType.RECYCLER, RecyclerBlockEntity::new)), + ROLLING_MACHINE(new GenericMachineBlock(GuiType.ROLLING_MACHINE, RollingMachineBlockEntity::new)), + SCRAPBOXINATOR(new GenericMachineBlock(GuiType.SCRAPBOXINATOR, ScrapboxinatorBlockEntity::new)), + VACUUM_FREEZER(new GenericMachineBlock(GuiType.VACUUM_FREEZER, VacuumFreezerBlockEntity::new)), + SOLID_CANNING_MACHINE(new GenericMachineBlock(GuiType.SOLID_CANNING_MACHINE, SoildCanningMachineBlockEntity::new)), + WIRE_MILL(new GenericMachineBlock(GuiType.WIRE_MILL, WireMillBlockEntity::new)), + GREENHOUSE_CONTROLLER(new GenericMachineBlock(GuiType.GREENHOUSE_CONTROLLER, GreenhouseControllerBlockEntity::new)), - DIESEL_GENERATOR(new GenericGeneratorBlock(EGui.DIESEL_GENERATOR, DieselGeneratorBlockEntity::new)), + DIESEL_GENERATOR(new GenericGeneratorBlock(GuiType.DIESEL_GENERATOR, DieselGeneratorBlockEntity::new)), DRAGON_EGG_SYPHON(new GenericGeneratorBlock(null, DragonEggSyphonBlockEntity::new)), FUSION_COIL(new BlockFusionCoil()), FUSION_CONTROL_COMPUTER(new BlockFusionControlComputer()), - GAS_TURBINE(new GenericGeneratorBlock(EGui.GAS_TURBINE, GasTurbineBlockEntity::new)), + GAS_TURBINE(new GenericGeneratorBlock(GuiType.GAS_TURBINE, GasTurbineBlockEntity::new)), LIGHTNING_ROD(new GenericGeneratorBlock(null, LightningRodBlockEntity::new)), - PLASMA_GENERATOR(new GenericGeneratorBlock(EGui.PLASMA_GENERATOR, PlasmaGeneratorBlockEntity::new)), - SEMI_FLUID_GENERATOR(new GenericGeneratorBlock(EGui.SEMIFLUID_GENERATOR, SemiFluidGeneratorBlockEntity::new)), - SOLID_FUEL_GENERATOR(new GenericGeneratorBlock(EGui.GENERATOR, SolidFuelGeneratorBlockEntity::new)), - THERMAL_GENERATOR(new GenericGeneratorBlock(EGui.THERMAL_GENERATOR, ThermalGeneratorBlockEntity::new)), + PLASMA_GENERATOR(new GenericGeneratorBlock(GuiType.PLASMA_GENERATOR, PlasmaGeneratorBlockEntity::new)), + SEMI_FLUID_GENERATOR(new GenericGeneratorBlock(GuiType.SEMIFLUID_GENERATOR, SemiFluidGeneratorBlockEntity::new)), + SOLID_FUEL_GENERATOR(new GenericGeneratorBlock(GuiType.GENERATOR, SolidFuelGeneratorBlockEntity::new)), + THERMAL_GENERATOR(new GenericGeneratorBlock(GuiType.THERMAL_GENERATOR, ThermalGeneratorBlockEntity::new)), WATER_MILL(new GenericGeneratorBlock(null, WaterMillBlockEntity::new)), WIND_MILL(new GenericGeneratorBlock(null, WindMillBlockEntity::new)), @@ -518,7 +547,7 @@ public class TRContent { ADJUSTABLE_SU(new AdjustableSUBlock()), - CHARGE_O_MAT(new GenericMachineBlock(EGui.CHARGEBENCH, ChargeOMatBlockEntity::new)), + CHARGE_O_MAT(new GenericMachineBlock(GuiType.CHARGEBENCH, ChargeOMatBlockEntity::new)), INTERDIMENSIONAL_SU(new InterdimensionalSUBlock()), LAPOTRONIC_SU(new LapotronicSUBlock()), LSU_STORAGE(new LSUStorageBlock()), @@ -531,7 +560,7 @@ public class TRContent { EV_TRANSFORMER(new BlockEVTransformer()), ALARM(new BlockAlarm()), - CHUNK_LOADER(new GenericMachineBlock(EGui.CHUNK_LOADER, ChunkLoaderBlockEntity::new)), + CHUNK_LOADER(new GenericMachineBlock(GuiType.CHUNK_LOADER, ChunkLoaderBlockEntity::new)), LAMP_INCANDESCENT(new BlockLamp(4, 10, 8)), LAMP_LED(new BlockLamp(1, 1, 12)), PLAYER_DETECTOR(new BlockPlayerDetector());