diff --git a/src/main/java/techreborn/api/generator/EFluidGenerator.java b/src/main/java/techreborn/api/generator/EFluidGenerator.java index 33ce46fe5..2a7f5351e 100644 --- a/src/main/java/techreborn/api/generator/EFluidGenerator.java +++ b/src/main/java/techreborn/api/generator/EFluidGenerator.java @@ -27,15 +27,16 @@ package techreborn.api.generator; import javax.annotation.Nonnull; public enum EFluidGenerator { - THERMAL("TechReborn.ThermalGenerator"), GAS("TechReborn.GasGenerator"), DIESEL( - "TechReborn.DieselGenerator"), SEMIFLUID("TechReborn.SemifluidGenerator"); + THERMAL("TechReborn.ThermalGenerator"), + GAS("TechReborn.GasGenerator"), + DIESEL("TechReborn.DieselGenerator"), + SEMIFLUID("TechReborn.SemifluidGenerator"), + PLASMA("TechReborn.PlasmaGenerator"); @Nonnull private final String recipeID; - private EFluidGenerator( - @Nonnull - String recipeID) { + private EFluidGenerator(@Nonnull String recipeID) { this.recipeID = recipeID; } diff --git a/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java b/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java index b2be1b93d..3e8ffcb72 100644 --- a/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java +++ b/src/main/java/techreborn/blocks/generator/BlockPlasmaGenerator.java @@ -24,34 +24,38 @@ package techreborn.blocks.generator; -import java.util.List; - -import net.minecraft.block.material.Material; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import prospector.shootingstar.ShootingStar; +import prospector.shootingstar.model.ModelCompound; import reborncore.api.tile.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; +import techreborn.client.EGui; import techreborn.client.TechRebornCreativeTab; +import techreborn.lib.ModInfo; +import techreborn.tiles.generator.TilePlasmaGenerator; +/** + * Block for Plasma Generator + */ public class BlockPlasmaGenerator extends BlockMachineBase { - public BlockPlasmaGenerator(Material material) { + /** + * + */ + public BlockPlasmaGenerator() { super(); - setUnlocalizedName("techreborn.plasmagenerator"); setCreativeTab(TechRebornCreativeTab.instance); + ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/generators")); } - + @Override - public void addInformation(ItemStack stack, World world, List tooltip, ITooltipFlag flag) { - tooltip.add(TextFormatting.RED + "WIP Coming Soon"); - // TODO - // Remember to remove WIP override and imports once complete + public TileEntity createNewTileEntity(final World world, final int meta) { + return new TilePlasmaGenerator(); } @Override public IMachineGuiHandler getGui() { - return null; + return EGui.PLASMA_GENERATOR; } } diff --git a/src/main/java/techreborn/client/EGui.java b/src/main/java/techreborn/client/EGui.java index 545a5e195..03ddc01a4 100644 --- a/src/main/java/techreborn/client/EGui.java +++ b/src/main/java/techreborn/client/EGui.java @@ -63,6 +63,7 @@ public enum EGui implements IMachineGuiHandler { MANUAL(false), MATTER_FABRICATOR(true), MEDIUM_VOLTAGE_SU(true), + PLASMA_GENERATOR(true), QUANTUM_CHEST(true), QUANTUM_TANK(true), RECYCLER(true), diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index e9f901630..f07c99f3a 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -154,6 +154,8 @@ public class GuiHandler implements IGuiHandler { return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile); case AUTO_CRAFTING_TABLE: return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile); + case PLASMA_GENERATOR: + return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile); default: break; diff --git a/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java new file mode 100644 index 000000000..6a73ab27c --- /dev/null +++ b/src/main/java/techreborn/client/gui/GuiPlasmaGenerator.java @@ -0,0 +1,72 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 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.gui; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import techreborn.tiles.generator.TilePlasmaGenerator; + +/** + * @author drcrazy + * + */ +@SideOnly(Side.CLIENT) +public class GuiPlasmaGenerator extends GuiBase { + + /** + * @param player + * @param tile + * @param container + */ + TilePlasmaGenerator tile; + + public GuiPlasmaGenerator(final EntityPlayer player, final TilePlasmaGenerator tile) { + super(player, tile, tile.createContainer(player)); + this.tile = tile; + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { + super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; + drawSlot(25, 35, layer); + drawSlot(25, 55, layer); + this.builder.drawJEIButton(this, 150, 4, layer); + } + + + @Override + protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; + + this.builder.drawProgressBar(this, this.tile.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + this.builder.drawMultiEnergyBar(this, 130, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + this.builder.drawTank(this, 44, 25, mouseX, mouseY, this.tile.tank.getFluid(), this.tile.tank.getCapacity(), this.tile.tank.isEmpty(), layer); + + } + +} diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 568beca76..661a8c29f 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -297,8 +297,8 @@ public class TechRebornJeiPlugin implements IModPlugin { registry.addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID()); registry.addRecipeClickArea(GuiThermalGenerator.class, 150, 4, 18, 18, EFluidGenerator.THERMAL.getRecipeID()); registry.addRecipeClickArea(GuiAlloySmelter.class, 150, 4, 18, 18, RecipeCategoryUids.ALLOY_SMELTER); + registry.addRecipeClickArea(GuiPlasmaGenerator.class, 150, 4, 18, 18, EFluidGenerator.PLASMA.getRecipeID()); - //OLD ONES registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER, VanillaRecipeCategoryUid.FUEL); diff --git a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeHandler.java b/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeHandler.java deleted file mode 100644 index f336c25e6..000000000 --- a/src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2017 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.compat.jei.generators.fluid; - -import mezz.jei.api.IJeiHelpers; -import mezz.jei.api.recipe.IRecipeHandler; -import mezz.jei.api.recipe.IRecipeWrapper; -import techreborn.api.generator.FluidGeneratorRecipe; - -import javax.annotation.Nonnull; - -public class FluidGeneratorRecipeHandler implements IRecipeHandler { - @Nonnull - private final IJeiHelpers jeiHelpers; - - public FluidGeneratorRecipeHandler( - @Nonnull - IJeiHelpers jeiHelpers) { - this.jeiHelpers = jeiHelpers; - } - - @Nonnull - @Override - public Class getRecipeClass() { - return FluidGeneratorRecipe.class; - } - - @Nonnull - @Override - public String getRecipeCategoryUid(FluidGeneratorRecipe recipe) { - return recipe.getGeneratorType().getRecipeID(); - } - - @Nonnull - @Override - public IRecipeWrapper getRecipeWrapper(FluidGeneratorRecipe recipe) { - return new FluidGeneratorRecipeWrapper(jeiHelpers, recipe); - } - - @Override - public boolean isRecipeValid(FluidGeneratorRecipe recipe) { - return true; - } -} diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index 0f69d997f..3b19c84e6 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -145,6 +145,7 @@ public class ModBlocks { public static Block CABLE; public static Block COMPUTER_CUBE; + public static Block PLASMA_GENERATOR; /** * Register blocks @@ -406,6 +407,10 @@ public class ModBlocks { COMPUTER_CUBE = new BlockComputerCube(); registerBlock(COMPUTER_CUBE, "computer_cube"); + + PLASMA_GENERATOR = new BlockPlasmaGenerator(); + registerBlock(PLASMA_GENERATOR, "plasma_generator"); + GameRegistry.registerTileEntity(TilePlasmaGenerator.class, "TilePlasmalGeneratorTR"); //TODO enable when done // flare = new BlockFlare(); @@ -472,7 +477,6 @@ public class ModBlocks { OreUtil.registerOre("blockIridium", BlockStorage.getStorageBlockByName("iridium")); OreUtil.registerOre("blockCopper", BlockStorage2.getStorageBlockByName("copper", 1)); OreUtil.registerOre("blockTin", BlockStorage2.getStorageBlockByName("tin", 1)); - OreUtil.registerOre("blockTungstensteel", BlockStorage2.getStorageBlockByName("tungstensteel", 1)); OreUtil.registerOre("blockRuby", BlockStorage2.getStorageBlockByName("ruby", 1)); OreUtil.registerOre("blockSapphire", BlockStorage2.getStorageBlockByName("sapphire", 1)); diff --git a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java index da670e2d7..65fae291a 100644 --- a/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java +++ b/src/main/java/techreborn/init/recipes/CraftingTableRecipes.java @@ -149,6 +149,7 @@ public class CraftingTableRecipes extends RecipeMethods { registerShaped(getStack(ModBlocks.COMPUTER_CUBE), "OMC", "MFM", "CMO", 'O', getMaterial("data_orb", Type.PART), 'M', getMaterial("computer_monitor", Type.PART), 'C', getMaterial("energy_flow_circuit", Type.PART), 'F', "machineBlockAdvanced"); registerShaped(getStack(ModBlocks.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', getMaterial("data_storage_circuit", Type.PART), 'C', "circuitAdvanced", 'F', getStack(ModBlocks.COMPUTER_CUBE)); registerShaped(getStack(ModBlocks.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(IC2Duplicates.MFE), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(ModItems.LAPOTRONIC_ORB)); + registerShaped(getStack(ModBlocks.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(IC2Duplicates.HVT), 'C', "circuitMaster", 'G', getStack(IC2Duplicates.GENERATOR)); if (!IC2Duplicates.deduplicate()) { registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV)); diff --git a/src/main/java/techreborn/init/recipes/FluidGeneratorRecipes.java b/src/main/java/techreborn/init/recipes/FluidGeneratorRecipes.java index c5f3ba504..53d867d4c 100644 --- a/src/main/java/techreborn/init/recipes/FluidGeneratorRecipes.java +++ b/src/main/java/techreborn/init/recipes/FluidGeneratorRecipes.java @@ -48,6 +48,8 @@ public class FluidGeneratorRecipes extends RecipeMethods { register(EFluidGenerator.GAS, ModFluids.HYDROGEN, 15); register(EFluidGenerator.GAS, ModFluids.METHANE, 45); + + register(EFluidGenerator.PLASMA, ModFluids.HELIUMPLASMA, 8192); } static void register(EFluidGenerator generator, Fluid fluid, int euPerMB) { diff --git a/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java new file mode 100644 index 000000000..aabaefb8e --- /dev/null +++ b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java @@ -0,0 +1,72 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2017 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.tiles.generator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import reborncore.common.registration.impl.ConfigRegistry; +import techreborn.api.generator.EFluidGenerator; +import techreborn.client.container.IContainerProvider; +import techreborn.client.container.builder.BuiltContainer; +import techreborn.client.container.builder.ContainerBuilder; +import techreborn.init.ModBlocks; + +public class TilePlasmaGenerator extends TileBaseFluidGenerator implements IContainerProvider { + + @ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorMaxOutput", comment = "Plasma Generator Max Output (Value in EU)") + public static int maxOutput = 2048; + @ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorMaxEnergy", comment = "Plasma Generator Max Energy (Value in EU)") + public static double maxEnergy = 500000000; + @ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorTankCapacity", comment = "Plasma Generator Tank Capacity") + public static int tankCapacity = 10000; + @ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorEnergyPerTick", comment = "Plasma Generator Energy Per Tick (Value in EU)") + public static int energyPerTick = 400; + + public TilePlasmaGenerator() { + super(EFluidGenerator.PLASMA, "TilePlasmaGenerator", tankCapacity, energyPerTick); + } + + @Override + public ItemStack getToolDrop(EntityPlayer p0) { + return new ItemStack(ModBlocks.PLASMA_GENERATOR, 1); + } + + @Override + public double getBaseMaxPower() { + return maxEnergy; + } + + @Override + public double getBaseMaxOutput() { + return maxOutput; + } + + @Override + public BuiltContainer createContainer(final EntityPlayer player) { + return new ContainerBuilder("plasmagenerator").player(player.inventory).inventory().hotbar().addInventory() + .tile(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue().addInventory().create(this); + } + +} diff --git a/src/main/resources/assets/techreborn/blockstates/machines/generators/plasma_generator.json b/src/main/resources/assets/techreborn/blockstates/machines/generators/plasma_generator.json new file mode 100644 index 000000000..2bf1ff754 --- /dev/null +++ b/src/main/resources/assets/techreborn/blockstates/machines/generators/plasma_generator.json @@ -0,0 +1,51 @@ +{ + "forge_marker": 1, + "defaults": { + "transform": "forge:default-block", + "model": "cube_bottom_top", + "textures": { + "particle": "techreborn:blocks/machines/generators/plasmagenerator_side_off", + "down": "techreborn:blocks/machines/generators/plasmagenerator_bottom" + } + }, + "variants": { + "inventory": { + "transform": "forge:default-block", + "model": "cube_bottom_top", + "textures": { + "particle": "techreborn:blocks/machines/generators/plasmagenerator_side_off", + "down": "techreborn:blocks/machines/generators/plasmagenerator_bottom", + "top": "techreborn:blocks/machines/generators/plasmagenerator_top_off", + "side": "techreborn:blocks/machines/generators/plasmagenerator_side_off" + } + }, + "facing": { + "north": { + + }, + "east": { + "y": 90 + }, + "south": { + "y": 180 + }, + "west": { + "y": 270 + } + }, + "active": { + "true": { + "textures": { + "top": "techreborn:blocks/machines/generators/plasmagenerator_top_on", + "side": "techreborn:blocks/machines/generators/plasmagenerator_side_on" + } + }, + "false": { + "textures": { + "top": "techreborn:blocks/machines/generators/plasmagenerator_top_off", + "side": "techreborn:blocks/machines/generators/plasmagenerator_side_off" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/lang/en_us.lang b/src/main/resources/assets/techreborn/lang/en_us.lang index fc99548da..2c5479c92 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.lang +++ b/src/main/resources/assets/techreborn/lang/en_us.lang @@ -688,6 +688,7 @@ techreborn.jei.category.generator.gas=Gas Generator techreborn.jei.category.generator.semifluid=Semifluid Generator techreborn.jei.category.generator.diesel=Diesel Generator techreborn.jei.category.generator.thermal=Thermal Generator +techreborn.jei.category.generator.plasma=Plasma Generator #Death Messages death.attack.shock=%s was electrocuted