Last piece of refactoring due to TileGenericMachine intro.
This commit is contained in:
parent
adc4879ec5
commit
45361a6b46
5 changed files with 15 additions and 161 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.TileScrapboxinator;
|
||||
import techreborn.tiles.tier1.TileScrapboxinator;
|
||||
|
||||
public class BlockScrapboxinator extends BlockMachineBase {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.tiles.TileScrapboxinator;
|
||||
import techreborn.tiles.tier1.TileScrapboxinator;
|
||||
|
||||
public class GuiScrapboxinator extends GuiBase {
|
||||
|
||||
|
|
|
@ -25,13 +25,7 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
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;
|
||||
|
@ -48,83 +42,21 @@ import techreborn.lib.ModInfo;
|
|||
import java.util.List;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, IListInfoProvider {
|
||||
public class TileIndustrialCentrifuge extends TileGenericMachine implements IContainerProvider, IListInfoProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "centrifuge", key = "CentrifugeMaxInput", comment = "Centrifuge Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "centrifuge", key = "CentrifugeMaxEnergy", comment = "Centrifuge Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
|
||||
public Inventory inventory = new Inventory(11, "TileIndustrialCentrifuge", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public TileIndustrialCentrifuge() {
|
||||
super();
|
||||
|
||||
super("IndustrialCentrifuge", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_CENTRIFUGE, 6);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[4];
|
||||
outputs[0] = 2;
|
||||
outputs[1] = 3;
|
||||
outputs[2] = 4;
|
||||
outputs[3] = 5;
|
||||
|
||||
final int[] outputs = new int[] { 2, 3, 4, 5 };
|
||||
this.inventory = new Inventory(7, "TileIndustrialCentrifuge", 64, this);
|
||||
this.crafter = new RecipeCrafter(Reference.CENTRIFUGE_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) {
|
||||
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_CENTRIFUGE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -137,12 +69,6 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
.syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
package techreborn.tiles.tier1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -43,8 +40,7 @@ import techreborn.lib.ModInfo;
|
|||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialElectrolyzer extends TileGenericMachine
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileIndustrialElectrolyzer extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxInput", comment = "Industrial Electrolyzer Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
|
|
|
@ -22,16 +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;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -42,85 +35,30 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileScrapboxinator extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
public class TileScrapboxinator extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "scrapboxinator", key = "ScrapboxinatorMaxInput", comment = "Scrapboxinator Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "scrapboxinator", key = "ScrapboxinatorMaxEnergy", comment = "Scrapboxinator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileScrapboxinator", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public static int maxEnergy = 1_000;
|
||||
|
||||
public TileScrapboxinator() {
|
||||
super();
|
||||
super("Scrapboxinator", maxInput, maxEnergy, ModBlocks.SCRAPBOXINATOR, 2);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
final int[] outputs = new int[] { 1 };
|
||||
this.inventory = new Inventory(3, "TileScrapboxinator", 64, this);
|
||||
this.crafter = new ScrapboxRecipeCrafter(this, 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 double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.SCRAPBOXINATOR, 1);
|
||||
}
|
||||
|
||||
//IInvetoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
|
@ -128,10 +66,4 @@ public class TileScrapboxinator extends TilePowerAcceptor
|
|||
.tile(this).filterSlot(0, 55, 45, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 101, 45)
|
||||
.energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue