More refactoring for tier1 machines.
This commit is contained in:
parent
80e36f0427
commit
54ee781bc7
13 changed files with 59 additions and 475 deletions
|
@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import techreborn.client.EGui;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileIndustrialElectrolyzer;
|
||||
import techreborn.tiles.tier1.TileIndustrialElectrolyzer;
|
||||
|
||||
public class BlockIndustrialElectrolyzer extends BlockMachineBase {
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import techreborn.client.EGui;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileAssemblingMachine;
|
||||
import techreborn.tiles.tier1.TileAssemblingMachine;
|
||||
|
||||
public class BlockAssemblingMachine extends BlockMachineBase {
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import techreborn.client.EGui;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileChemicalReactor;
|
||||
import techreborn.tiles.tier1.TileChemicalReactor;
|
||||
|
||||
public class BlockChemicalReactor extends BlockMachineBase {
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import techreborn.tiles.TileAssemblingMachine;
|
||||
import techreborn.tiles.tier1.TileAssemblingMachine;
|
||||
|
||||
public class GuiAssemblingMachine extends GuiContainer {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.tiles.TileChemicalReactor;
|
||||
import techreborn.tiles.tier1.TileChemicalReactor;
|
||||
|
||||
public class GuiChemicalReactor extends GuiBase {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.tiles.TileIndustrialElectrolyzer;
|
||||
import techreborn.tiles.tier1.TileIndustrialElectrolyzer;
|
||||
|
||||
public class GuiIndustrialElectrolyzer extends GuiBase {
|
||||
|
||||
|
|
|
@ -50,6 +50,13 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
public Inventory inventory;
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
/**
|
||||
* @param name String Name for a tile. Do we need it at all?
|
||||
* @param maxInput int Maximum energy input, value in EU
|
||||
* @param maxEnergy int Maximum energy buffer, value in EU
|
||||
* @param toolDrop Block Block to drop with wrench
|
||||
* @param energySlot int Energy slot to use to charge machine from battery
|
||||
*/
|
||||
public TileGenericMachine(String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) {
|
||||
this.name = "Tile" + name;
|
||||
this.maxInput = maxInput;
|
||||
|
@ -116,8 +123,4 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,13 +25,7 @@
|
|||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -44,82 +38,24 @@ import techreborn.client.container.builder.BuiltContainer;
|
|||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileAlloySmelter extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
public class TileAlloySmelter extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "alloy_smelter", key = "AlloySmelterMaxInput", comment = "Alloy Smelter Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "alloy_smelter", key = "AlloySmelterMaxEnergy", comment = "Alloy Smelter Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public static int maxEnergy = 1_000;
|
||||
|
||||
public TileAlloySmelter() {
|
||||
super();
|
||||
// Input slots
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
super("AlloySmelter", maxInput, maxEnergy, ModBlocks.ALLOY_SMELTER, 3);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2 };
|
||||
this.inventory = new Inventory(4, "TileAlloySmelter", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.ALLOY_SMELTER_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -136,10 +72,4 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
.outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,15 +22,9 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -41,81 +35,24 @@ import techreborn.client.container.builder.BuiltContainer;
|
|||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileAssemblingMachine extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileAssemblingMachine extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxInput", comment = "Assembling Machine Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxEnergy", comment = "Assembling Machine Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
|
||||
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public int tickTime;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public TileAssemblingMachine() {
|
||||
super();
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
super("AssemblingMachine", maxInput, maxEnergy, ModBlocks.ASSEMBLY_MACHINE, 3);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2 };
|
||||
this.inventory = new Inventory(4, "TileAssemblingMachine", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.ASSEMBLING_MACHINE_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ASSEMBLY_MACHINE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -123,11 +60,4 @@ public class TileAssemblingMachine extends TilePowerAcceptor
|
|||
.addInventory().tile(this).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,15 +22,9 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -39,82 +33,23 @@ import techreborn.client.container.IContainerProvider;
|
|||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
public class TileChemicalReactor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileChemicalReactor extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxInput", comment = "Chemical Reactor Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxEnergy", comment = "Chemical Reactor Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public Inventory inventory = new Inventory(8, "TileChemicalReactor", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileChemicalReactor() {
|
||||
super();
|
||||
// Input slots
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
super("ChemicalReactor", maxInput, maxEnergy, ModBlocks.CHEMICAL_REACTOR, 3);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2 };
|
||||
this.inventory = new Inventory(4, "TileChemicalReactor", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.CHEMICAL_REACTOR_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks > 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHEMICAL_REACTOR, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -122,11 +57,4 @@ public class TileChemicalReactor extends TilePowerAcceptor
|
|||
.addInventory().tile(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).energySlot(3, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
}
|
|
@ -25,12 +25,6 @@
|
|||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -39,79 +33,23 @@ import techreborn.client.container.IContainerProvider;
|
|||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
public class TileExtractor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileExtractor extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "extractor", key = "ExtractorInput", comment = "Extractor Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "extractor", key = "ExtractorMaxEnergy", comment = "Extractor Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileExtractor", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public static int maxEnergy = 1_000;
|
||||
|
||||
public TileExtractor() {
|
||||
super();
|
||||
final int[] inputs = new int[1];
|
||||
inputs[0] = 0;
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 1;
|
||||
super("Extractor", maxInput, maxEnergy, ModBlocks.EXTRACTOR, 2);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
final int[] outputs = new int[] { 1 };
|
||||
this.inventory = new Inventory(3, "TileExtractor", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.EXTRACTOR_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.EXTRACTOR, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -119,10 +57,4 @@ public class TileExtractor extends TilePowerAcceptor
|
|||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -39,80 +33,23 @@ import techreborn.client.container.IContainerProvider;
|
|||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
public class TileGrinder extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileGrinder extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "grinder", key = "GrinderInput", comment = "Grinder Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "grinder", key = "GrinderMaxEnergy", comment = "Grinder Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileGrinder", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public static int maxEnergy = 1_000;
|
||||
|
||||
public TileGrinder() {
|
||||
super();
|
||||
final int[] inputs = new int[1];
|
||||
inputs[0] = 0;
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 1;
|
||||
super("Grinder", maxInput, maxEnergy, ModBlocks.GRINDER, 2);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
final int[] outputs = new int[] { 1 };
|
||||
this.inventory = new Inventory(3, "TileGrinder", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.GRINDER_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.GRINDER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -120,10 +57,4 @@ public class TileGrinder extends TilePowerAcceptor
|
|||
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
|
@ -22,15 +22,12 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -43,9 +40,10 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.DynamicCell;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
||||
public class TileIndustrialElectrolyzer extends TileGenericMachine
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxInput", comment = "Industrial Electrolyzer Max Input (Value in EU)")
|
||||
|
@ -53,76 +51,14 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
@ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxEnergy", comment = "Industrial Electrolyzer Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileIndustrialElectrolyzer() {
|
||||
super();
|
||||
// Input slots
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
// Output slots
|
||||
final int[] outputs = new int[4];
|
||||
outputs[0] = 2;
|
||||
outputs[1] = 3;
|
||||
outputs[2] = 4;
|
||||
outputs[3] = 5;
|
||||
super("IndustrialElectrolyzer", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_ELECTROLYZER, 6);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2, 3, 4, 5 };
|
||||
this.inventory = new Inventory(7, "TileIndustrialElectrolyzer", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_ELECTROLYZER_RECIPE, this, 2, 4, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
super.update();
|
||||
this.charge(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -133,10 +69,4 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
.outputSlot(2, 51, 24).outputSlot(3, 71, 24).outputSlot(4, 91, 24).outputSlot(5, 111, 24)
|
||||
.energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue