Added plasma generator. Some work on #884

This commit is contained in:
drcrazy 2017-10-13 03:20:34 +03:00
parent 709922b708
commit 47134cf2ab
13 changed files with 232 additions and 87 deletions

View file

@ -27,15 +27,16 @@ package techreborn.api.generator;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public enum EFluidGenerator { public enum EFluidGenerator {
THERMAL("TechReborn.ThermalGenerator"), GAS("TechReborn.GasGenerator"), DIESEL( THERMAL("TechReborn.ThermalGenerator"),
"TechReborn.DieselGenerator"), SEMIFLUID("TechReborn.SemifluidGenerator"); GAS("TechReborn.GasGenerator"),
DIESEL("TechReborn.DieselGenerator"),
SEMIFLUID("TechReborn.SemifluidGenerator"),
PLASMA("TechReborn.PlasmaGenerator");
@Nonnull @Nonnull
private final String recipeID; private final String recipeID;
private EFluidGenerator( private EFluidGenerator(@Nonnull String recipeID) {
@Nonnull
String recipeID) {
this.recipeID = recipeID; this.recipeID = recipeID;
} }

View file

@ -24,34 +24,38 @@
package techreborn.blocks.generator; package techreborn.blocks.generator;
import java.util.List; import net.minecraft.tileentity.TileEntity;
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.world.World; import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.generator.TilePlasmaGenerator;
/**
* Block for Plasma Generator
*/
public class BlockPlasmaGenerator extends BlockMachineBase { public class BlockPlasmaGenerator extends BlockMachineBase {
public BlockPlasmaGenerator(Material material) { /**
*
*/
public BlockPlasmaGenerator() {
super(); super();
setUnlocalizedName("techreborn.plasmagenerator");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/generators"));
} }
@Override @Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) { public TileEntity createNewTileEntity(final World world, final int meta) {
tooltip.add(TextFormatting.RED + "WIP Coming Soon"); return new TilePlasmaGenerator();
// TODO
// Remember to remove WIP override and imports once complete
} }
@Override @Override
public IMachineGuiHandler getGui() { public IMachineGuiHandler getGui() {
return null; return EGui.PLASMA_GENERATOR;
} }
} }

View file

@ -63,6 +63,7 @@ public enum EGui implements IMachineGuiHandler {
MANUAL(false), MANUAL(false),
MATTER_FABRICATOR(true), MATTER_FABRICATOR(true),
MEDIUM_VOLTAGE_SU(true), MEDIUM_VOLTAGE_SU(true),
PLASMA_GENERATOR(true),
QUANTUM_CHEST(true), QUANTUM_CHEST(true),
QUANTUM_TANK(true), QUANTUM_TANK(true),
RECYCLER(true), RECYCLER(true),

View file

@ -154,6 +154,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile); return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
case AUTO_CRAFTING_TABLE: case AUTO_CRAFTING_TABLE:
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile); return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
default: default:
break; break;

View file

@ -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);
}
}

View file

@ -297,8 +297,8 @@ public class TechRebornJeiPlugin implements IModPlugin {
registry.addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID()); registry.addRecipeClickArea(GuiGasTurbine.class, 150, 4, 18, 18, EFluidGenerator.GAS.getRecipeID());
registry.addRecipeClickArea(GuiThermalGenerator.class, 150, 4, 18, 18, EFluidGenerator.THERMAL.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(GuiAlloySmelter.class, 150, 4, 18, 18, RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeClickArea(GuiPlasmaGenerator.class, 150, 4, 18, 18, EFluidGenerator.PLASMA.getRecipeID());
//OLD ONES //OLD ONES
registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER, registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER,
VanillaRecipeCategoryUid.FUEL); VanillaRecipeCategoryUid.FUEL);

View file

@ -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<FluidGeneratorRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public FluidGeneratorRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<FluidGeneratorRecipe> 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;
}
}

View file

@ -145,6 +145,7 @@ public class ModBlocks {
public static Block CABLE; public static Block CABLE;
public static Block COMPUTER_CUBE; public static Block COMPUTER_CUBE;
public static Block PLASMA_GENERATOR;
/** /**
* Register blocks * Register blocks
@ -406,6 +407,10 @@ public class ModBlocks {
COMPUTER_CUBE = new BlockComputerCube(); COMPUTER_CUBE = new BlockComputerCube();
registerBlock(COMPUTER_CUBE, "computer_cube"); registerBlock(COMPUTER_CUBE, "computer_cube");
PLASMA_GENERATOR = new BlockPlasmaGenerator();
registerBlock(PLASMA_GENERATOR, "plasma_generator");
GameRegistry.registerTileEntity(TilePlasmaGenerator.class, "TilePlasmalGeneratorTR");
//TODO enable when done //TODO enable when done
// flare = new BlockFlare(); // flare = new BlockFlare();
@ -472,7 +477,6 @@ public class ModBlocks {
OreUtil.registerOre("blockIridium", BlockStorage.getStorageBlockByName("iridium")); OreUtil.registerOre("blockIridium", BlockStorage.getStorageBlockByName("iridium"));
OreUtil.registerOre("blockCopper", BlockStorage2.getStorageBlockByName("copper", 1)); OreUtil.registerOre("blockCopper", BlockStorage2.getStorageBlockByName("copper", 1));
OreUtil.registerOre("blockTin", BlockStorage2.getStorageBlockByName("tin", 1)); OreUtil.registerOre("blockTin", BlockStorage2.getStorageBlockByName("tin", 1));
OreUtil.registerOre("blockTungstensteel", BlockStorage2.getStorageBlockByName("tungstensteel", 1)); OreUtil.registerOre("blockTungstensteel", BlockStorage2.getStorageBlockByName("tungstensteel", 1));
OreUtil.registerOre("blockRuby", BlockStorage2.getStorageBlockByName("ruby", 1)); OreUtil.registerOre("blockRuby", BlockStorage2.getStorageBlockByName("ruby", 1));
OreUtil.registerOre("blockSapphire", BlockStorage2.getStorageBlockByName("sapphire", 1)); OreUtil.registerOre("blockSapphire", BlockStorage2.getStorageBlockByName("sapphire", 1));

View file

@ -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.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.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.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()) { if (!IC2Duplicates.deduplicate()) {
registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV)); registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV));

View file

@ -48,6 +48,8 @@ public class FluidGeneratorRecipes extends RecipeMethods {
register(EFluidGenerator.GAS, ModFluids.HYDROGEN, 15); register(EFluidGenerator.GAS, ModFluids.HYDROGEN, 15);
register(EFluidGenerator.GAS, ModFluids.METHANE, 45); register(EFluidGenerator.GAS, ModFluids.METHANE, 45);
register(EFluidGenerator.PLASMA, ModFluids.HELIUMPLASMA, 8192);
} }
static void register(EFluidGenerator generator, Fluid fluid, int euPerMB) { static void register(EFluidGenerator generator, Fluid fluid, int euPerMB) {

View file

@ -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);
}
}

View file

@ -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"
}
}
}
}
}

View file

@ -688,6 +688,7 @@ techreborn.jei.category.generator.gas=Gas Generator
techreborn.jei.category.generator.semifluid=Semifluid Generator techreborn.jei.category.generator.semifluid=Semifluid Generator
techreborn.jei.category.generator.diesel=Diesel Generator techreborn.jei.category.generator.diesel=Diesel Generator
techreborn.jei.category.generator.thermal=Thermal Generator techreborn.jei.category.generator.thermal=Thermal Generator
techreborn.jei.category.generator.plasma=Plasma Generator
#Death Messages #Death Messages
death.attack.shock=%s was electrocuted death.attack.shock=%s was electrocuted