Merge remote-tracking branch 'origin/1.12' into 1.12

This commit is contained in:
modmuss50 2018-04-02 22:28:39 +01:00
commit aaa0121e7c
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
50 changed files with 345 additions and 1197 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.iron_machines;
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@ -37,7 +37,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileIronAlloyFurnace;
import techreborn.tiles.tier0.TileIronAlloyFurnace;
import java.util.ArrayList;
import java.util.List;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks.iron_machines;
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@ -41,7 +41,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileIronFurnace;
import techreborn.tiles.tier0.TileIronFurnace;
import java.util.ArrayList;
import java.util.List;
@ -55,23 +55,6 @@ public class BlockIronFurnace extends BlockMachineBase {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier0_machines"));
}
@Override
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIronFurnace();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.IRON_FURNACE;
}
@Override
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(final World worldIn, final BlockPos pos, final IBlockState state, final Random rand) {
@ -106,4 +89,22 @@ public class BlockIronFurnace extends BlockMachineBase {
}
}
}
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIronFurnace();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.IRON_FURNACE;
}
@Override
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
}

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileAlloySmelter;
import techreborn.tiles.tier1.TileAlloySmelter;
public class BlockAlloySmelter extends BlockMachineBase {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileCompressor;
import techreborn.tiles.tier1.TileCompressor;
public class BlockCompressor extends BlockMachineBase {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileElectricFurnace;
import techreborn.tiles.tier1.TileElectricFurnace;
public class BlockElectricFurnace extends BlockMachineBase {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileExtractor;
import techreborn.tiles.tier1.TileExtractor;
public class BlockExtractor extends BlockMachineBase {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileGrinder;
import techreborn.tiles.tier1.TileGrinder;
public class BlockGrinder extends BlockMachineBase {

View file

@ -33,7 +33,7 @@ import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.teir1.TileRecycler;
import techreborn.tiles.tier1.TileRecycler;
public class BlockRecycler extends BlockMachineBase {

View file

@ -43,7 +43,8 @@ import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.TileHighVoltageSU;
import techreborn.tiles.storage.TileLowVoltageSU;
import techreborn.tiles.storage.TileMediumVoltageSU;
import techreborn.tiles.teir1.*;
import techreborn.tiles.tier0.*;
import techreborn.tiles.tier1.*;
public class GuiHandler implements IGuiHandler {

View file

@ -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.TileIronAlloyFurnace;
import techreborn.tiles.tier0.TileIronAlloyFurnace;
public class GuiAlloyFurnace extends GuiContainer {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileAlloySmelter;
import techreborn.tiles.tier1.TileAlloySmelter;
public class GuiAlloySmelter extends GuiBase {

View file

@ -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 {

View file

@ -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 {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileCompressor;
import techreborn.tiles.tier1.TileCompressor;
public class GuiCompressor extends GuiBase {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileElectricFurnace;
import techreborn.tiles.tier1.TileElectricFurnace;
public class GuiElectricFurnace extends GuiBase {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileExtractor;
import techreborn.tiles.tier1.TileExtractor;
public class GuiExtractor extends GuiBase {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileGrinder;
import techreborn.tiles.tier1.TileGrinder;
public class GuiGrinder extends GuiBase {

View file

@ -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 {

View file

@ -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.TileIronFurnace;
import techreborn.tiles.tier0.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {

View file

@ -25,7 +25,7 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.tiles.teir1.TileRecycler;
import techreborn.tiles.tier1.TileRecycler;
public class GuiRecycler extends GuiBase {

View file

@ -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 {

View file

@ -41,11 +41,10 @@ import techreborn.blocks.advanced_machine.*;
import techreborn.blocks.cable.BlockCable;
import techreborn.blocks.generator.*;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.blocks.iron_machines.BlockIronAlloyFurnace;
import techreborn.blocks.iron_machines.BlockIronFurnace;
import techreborn.blocks.lighting.BlockLamp;
import techreborn.blocks.machine.*;
import techreborn.blocks.storage.*;
import techreborn.blocks.tier0.*;
import techreborn.blocks.tier1.*;
import techreborn.blocks.transformers.BlockHVTransformer;
import techreborn.blocks.transformers.BlockLVTransformer;
@ -65,7 +64,8 @@ import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.TileHighVoltageSU;
import techreborn.tiles.storage.TileLowVoltageSU;
import techreborn.tiles.storage.TileMediumVoltageSU;
import techreborn.tiles.teir1.*;
import techreborn.tiles.tier0.*;
import techreborn.tiles.tier1.*;
import techreborn.tiles.transformers.TileHVTransformer;
import techreborn.tiles.transformers.TileLVTransformer;
import techreborn.tiles.transformers.TileMVTransformer;

View file

@ -22,8 +22,9 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
package techreborn.tiles;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@ -32,49 +33,54 @@ 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;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileExtractor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
@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;
/**
* @author drcrazy
*
*/
public abstract class TileGenericMachine extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider{
public Inventory inventory = new Inventory(3, "TileExtractor", 64, this);
public String name;
public int maxInput;
public int maxEnergy;
public Block toolDrop;
public int energySlot;
public Inventory inventory;
public RecipeCrafter crafter;
public TileExtractor() {
super();
final int[] inputs = new int[1];
inputs[0] = 0;
final int[] outputs = new int[1];
outputs[0] = 1;
this.crafter = new RecipeCrafter(Reference.EXTRACTOR_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
/**
* @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;
this.maxEnergy = maxEnergy;
this.toolDrop = toolDrop;
this.energySlot = energySlot;
}
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
if (this.crafter != null && 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(2);
this.charge(energySlot);
}
}
@Override
public double getBaseMaxPower() {
return maxEnergy;
@ -102,27 +108,19 @@ public class TileExtractor extends TilePowerAcceptor
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.EXTRACTOR, 1);
public ItemStack getToolDrop(EntityPlayer p0) {
return new ItemStack(toolDrop, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this)
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this);
return inventory;
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
return crafter;
}
}

View file

@ -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,16 +69,10 @@ 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) {
super.addInfo(info, isRealTile);
info.add("Round and round it goes");
}
}
}

View file

@ -27,14 +27,7 @@ package techreborn.tiles.multiblock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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;
@ -45,24 +38,23 @@ 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 TileDistillationTower extends TilePowerAcceptor
implements IToolDrop, IRecipeCrafterProvider, IInventoryProvider, IContainerProvider {
public class TileDistillationTower extends TileGenericMachine implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "distillation_tower", key = "DistillationTowerMaxInput", comment = "Distillation Tower Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "distillation_tower", key = "DistillationTowerMaxEnergy", comment = "Distillation Tower Max Energy (Value in EU)")
public static int maxEnergy = 10000;
public static int maxEnergy = 10_000;
public Inventory inventory = new Inventory(11, "TileDistillationTower", 64, this);
public MultiblockChecker multiblockChecker;
public RecipeCrafter crafter;
public TileDistillationTower() {
super();
super("DistillationTower", maxInput, maxEnergy, ModBlocks.DISTILLATION_TOWER, 6);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 };
this.inventory = new Inventory(7, "TileDistillationTower", 64, this);
this.crafter = new RecipeCrafter(Reference.DISTILLATION_TOWER_RECIPE, this, 2, 4, this.inventory, inputs, outputs);
}
@ -80,14 +72,8 @@ public class TileDistillationTower extends TilePowerAcceptor
final boolean center2 = (centerBlock2 == Blocks.AIR);
return layer0 && layer1 && layer2 && layer3 && center1 && center2;
}
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
// TileGenericMachine
@Override
public void update() {
if (this.multiblockChecker == null) {
@ -95,57 +81,11 @@ public class TileDistillationTower extends TilePowerAcceptor
this.multiblockChecker = new MultiblockChecker(this.world, pos);
}
if (world.isRemote){ return; }
if (this.getMutliBlock()) {
if (!world.isRemote && getMutliBlock()){
super.update();
this.charge(6);
}
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
return false;
}
@Override
public double getBaseMaxPower() {
return maxEnergy;
}
@Override
public double getBaseMaxOutput() {
return 0;
}
@Override
public double getBaseMaxInput() {
return maxInput;
}
// IToolDrop
@Override
public ItemStack getToolDrop(EntityPlayer p0) {
return new ItemStack(ModBlocks.DISTILLATION_TOWER, 1);
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
}
// IInventoryProvider
@Override
public IInventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
@ -154,5 +94,4 @@ public class TileDistillationTower extends TilePowerAcceptor
.outputSlot(4, 119, 37).outputSlot(5, 139, 37).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this);
}
}
}

View file

@ -25,13 +25,7 @@
package techreborn.tiles.multiblock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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;
@ -42,34 +36,26 @@ 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 TileImplosionCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
public class TileImplosionCompressor extends TileGenericMachine implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxInput", comment = "Implosion Compressor Max Input (Value in EU)")
public static int maxInput = 64;
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxEnergy", comment = "Implosion Compressor Max Energy (Value in EU)")
public static int maxEnergy = 64_000;
public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker;
public TileImplosionCompressor() {
super();
super("ImplosionCompressor", maxInput, maxEnergy, ModBlocks.IMPLOSION_COMPRESSOR, 4);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3 };
this.inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
this.crafter = new RecipeCrafter(Reference.IMPLOSION_COMPRESSOR_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;
}
public boolean getMutliBlock() {
final boolean down = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean up = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 2, 0));
@ -77,39 +63,17 @@ public class TileImplosionCompressor extends TilePowerAcceptor
return down && chamber && up;
}
// TilePowerAcceptor
// TileGenericMachine
@Override
public void update() {
if (this.world.isRemote) { return; }
if (this.getMutliBlock()) {
super.update();
this.charge(4);
if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2);
this.multiblockChecker = new MultiblockChecker(this.world, pos);
}
}
@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;
if (!world.isRemote && getMutliBlock()){
super.update();
}
}
// TileEntity
@ -118,18 +82,6 @@ public class TileImplosionCompressor extends TilePowerAcceptor
super.validate();
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down(3));
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
@ -138,10 +90,4 @@ public class TileImplosionCompressor extends TilePowerAcceptor
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
}
}

View file

@ -27,17 +27,12 @@ package techreborn.tiles.multiblock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.api.IToolDrop;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.multiblock.IMultiblockPart;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
@ -52,27 +47,25 @@ import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import techreborn.multiblocks.MultiBlockCasing;
import techreborn.tiles.TileGenericMachine;
import techreborn.tiles.TileMachineCasing;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileIndustrialBlastFurnace extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<BlastFurnaceRecipe> {
public class TileIndustrialBlastFurnace extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<BlastFurnaceRecipe> {
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxInput", comment = "Industrial Blast Furnace Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxEnergy", comment = "Industrial Blast Furnace Max Energy (Value in EU)")
public static int maxEnergy = 10_000;
public Inventory inventory;
public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker;
private int cachedHeat;
public TileIndustrialBlastFurnace() {
super();
this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
super("IndustrialBlastFurnace", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_BLAST_FURNACE, 4);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3 };
this.inventory = new Inventory(5, "TileIndustrialBlastFurnace", 64, this);
this.crafter = new RecipeCrafter(Reference.BLAST_FURNACE_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
}
@ -102,7 +95,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor
final BlockMachineCasing casing1 = (BlockMachineCasing) this.world.getBlockState(part.getPos())
.getBlock();
heat += casing1.getHeatFromState(this.world.getBlockState(part.getPos()));
// TODO meta fix
}
if (this.world.getBlockState(location.offset(EnumFacing.UP, 1)).getBlock().getUnlocalizedName()
@ -130,13 +122,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor
return layer0 && layer1 && layer2 && layer3 && center1 && center2;
}
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
public void setHeat(final int heat) {
this.cachedHeat = heat;
}
@ -145,47 +130,19 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor
return this.cachedHeat;
}
// TilePowerAcceptor
// TileGenericMachine
@Override
public void update() {
if (world.isRemote){ return; }
if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2);
this.multiblockChecker = new MultiblockChecker(this.world, pos);
}
if (this.getMutliBlock()) {
if (!world.isRemote && getMutliBlock()){
super.update();
this.charge(4);
}
}
}
@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;
}
// TileLegacyMachineBase
@Override
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
@ -194,18 +151,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor
this.readFromNBT(packet.getNbtCompound());
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
@ -215,12 +160,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor
.syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
}
// ITileRecipeHandler
@Override
public boolean canCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) {

View file

@ -37,10 +37,6 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
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;
@ -55,32 +51,29 @@ 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 TileIndustrialGrinder extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<IndustrialGrinderRecipe> {
public class TileIndustrialGrinder extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialGrinderRecipe> {
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxInput", comment = "Industrial Grinder Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxEnergy", comment = "Industrial Grinder Max Energy (Value in EU)")
public static int maxEnergy = 10_000;
public static final int TANK_CAPACITY = 16000;
public Inventory inventory;
public static final int TANK_CAPACITY = 16_000;
public Tank tank;
public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker;
int ticksSinceLastChange;
public TileIndustrialGrinder() {
super();
this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
this.inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
this.ticksSinceLastChange = 0;
super("IndustrialGrinder", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_GRINDER, 7);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] {2, 3, 4, 5};
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_GRINDER_RECIPE, this, 1, 4, this.inventory, inputs,
outputs);
this.inventory = new Inventory(8, "TileIndustrialGrinder", 64, this);
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_GRINDER_RECIPE, this, 1, 4, this.inventory, inputs, outputs);
this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
this.ticksSinceLastChange = 0;
}
public boolean getMutliBlock() {
@ -99,17 +92,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
return down && center && blade && up;
}
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();
if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
this.multiblockChecker = new MultiblockChecker(this.world, pos);
@ -125,38 +110,13 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
this.ticksSinceLastChange = 0;
}
if (!world.isRemote && this.getMutliBlock()) {
this.charge(7);
if (!world.isRemote && getMutliBlock()) {
super.update();
}
tank.compareAndUpdate();
}
@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;
}
@Override
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
@ -200,18 +160,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
}
return true;
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.INDUSTRIAL_GRINDER, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
@ -223,12 +171,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
}
// ITileRecipeHandler
@Override
public boolean canCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) {
@ -275,4 +217,4 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
}
return false;
}
}
}

View file

@ -37,10 +37,6 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
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;
@ -55,32 +51,29 @@ 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 TileIndustrialSawmill extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<IndustrialSawmillRecipe> {
public class TileIndustrialSawmill extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialSawmillRecipe> {
@ConfigRegistry(config = "machines", category = "industrial_sawmill", key = "IndustrialSawmillMaxInput", comment = "Industrial Sawmill Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "industrial_sawmill", key = "IndustrialSawmillMaxEnergy", comment = "Industrial Sawmill Max Energy (Value in EU)")
public static int maxEnergy = 10_000;
public static final int TANK_CAPACITY = 16000;
public Inventory inventory;
public static final int TANK_CAPACITY = 16_000;
public Tank tank;
public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker;
int ticksSinceLastChange;
public TileIndustrialSawmill() {
super();
this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this);
this.inventory = new Inventory(7, "TileSawmill", 64, this);
this.ticksSinceLastChange = 0;
super("IndustrialSawmill", maxInput, maxEnergy, ModBlocks.INDUSTRIAL_SAWMILL, 6);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4 };
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_SAWMILL_RECIPE, this, 1, 3, this.inventory, inputs,
outputs);
this.inventory = new Inventory(7, "TileSawmill", 64, this);
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_SAWMILL_RECIPE, this, 1, 3, this.inventory, inputs, outputs);
this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this);
this.ticksSinceLastChange = 0;
}
public boolean getMutliBlock() {
@ -99,17 +92,9 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
return down && center && blade && up;
}
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
// TilePowerAcceptor
// TileGenericMachine
@Override
public void update() {
super.update();
if (this.multiblockChecker == null) {
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
this.multiblockChecker = new MultiblockChecker(this.world, pos);
@ -125,38 +110,13 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
this.ticksSinceLastChange = 0;
}
if (!world.isRemote && this.getMutliBlock()) {
this.charge(6);
if (!world.isRemote && getMutliBlock()) {
super.update();
}
tank.compareAndUpdate();
}
@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;
}
@Override
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
@ -202,18 +162,6 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
return true;
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
@ -223,12 +171,6 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
.addInventory().create(this);
}
// IRecipeCrafterProvider
@Override
public RecipeCrafter getRecipeCrafter() {
return this.crafter;
}
// ITileRecipeHandler
@Override
public boolean canCraft(TileEntity tile, IndustrialSawmillRecipe recipe) {
@ -274,4 +216,4 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
}
return false;
}
}
}

View file

@ -25,12 +25,6 @@
package techreborn.tiles.multiblock;
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,24 +33,22 @@ 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 TileVacuumFreezer extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
public class TileVacuumFreezer extends TileGenericMachine implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerInput", comment = "Vacuum Freezer Max Input (Value in EU)")
public static int maxInput = 64;
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerMaxEnergy", comment = "Vacuum Freezer Max Energy (Value in EU)")
public static int maxEnergy = 64000;
public static int maxEnergy = 64_000;
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
public RecipeCrafter crafter;
public MultiblockChecker multiblockChecker;
public TileVacuumFreezer() {
super();
super("VacuumFreezer", maxInput, maxEnergy, ModBlocks.VACUUM_FREEZER, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
this.inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
this.crafter = new RecipeCrafter(Reference.VACUUM_FREEZER_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
}
@ -64,48 +56,14 @@ public class TileVacuumFreezer extends TilePowerAcceptor
return this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
}
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
// TilePowerAcceptor
// TileGenericMachine
@Override
public void update() {
if (world.isRemote){ return; }
if (this.getMultiBlock()) {
if (!world.isRemote && getMultiBlock()) {
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;
}
// TileEntity
@Override
public void validate() {
@ -113,18 +71,6 @@ public class TileVacuumFreezer extends TilePowerAcceptor
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down());
}
// IToolDrop
@Override
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.VACUUM_FREEZER, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
@ -132,11 +78,4 @@ public class TileVacuumFreezer extends TilePowerAcceptor
.tile(this).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;
}
}
}

View file

@ -45,7 +45,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxOutput", comment = "AESU Max Output (Value in EU)")
public static int maxOutput = 8192;
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)")
public static int maxEnergy = 100000000;
public static int maxEnergy = 100_000_000;
public Inventory inventory = new Inventory(4, "TileAdjustableSU", 64, this);
private int OUTPUT = 64; // The current output
@ -53,16 +53,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
public TileAdjustableSU() {
super("ADJUSTABLE_SU", 4, ModBlocks.ADJUSTABLE_SU, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy);
}
@Override
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
return getDropWithNBT();
}
public boolean isComplete() {
return false;
}
public void handleGuiInputFromClient(int id) {
if (id == 300) {
OUTPUT += 256;
@ -92,7 +83,27 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
return dropStack;
}
public int getCurrentOutput() {
return OUTPUT;
}
public void setCurentOutput(int output) {
this.OUTPUT = output;
}
// TileEnergyStorage
@Override
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
return getDropWithNBT();
}
@Override
public double getBaseMaxOutput() {
return OUTPUT;
}
// TilePowerAcceptor
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
@ -108,20 +119,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
inventory.readFromNBT(nbttagcompound);
}
@Override
public double getBaseMaxOutput() {
return OUTPUT;
}
public int getCurrentOutput() {
return OUTPUT;
}
public void setCurentOutput(int output) {
this.OUTPUT = output;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(EntityPlayer player) {
return new ContainerBuilder("aesu").player(player.inventory).inventory().hotbar().armor()

View file

@ -28,7 +28,6 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import reborncore.api.IToolDrop;
@ -46,7 +45,8 @@ import techreborn.utils.IC2ItemCharger;
/**
* Created by Rushmead
*/
public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, ITickable, IInventoryProvider {
public class TileEnergyStorage extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider {
public Inventory inventory;
public String name;
@ -67,6 +67,7 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
this.maxStorage = maxStorage;
}
// TilePowerAcceptor
@Override
public void update() {
super.update();
@ -106,18 +107,7 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
}
}
}
@Override
public void setFacing(EnumFacing enumFacing) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
}
@Override
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
return new ItemStack(wrenchDrop);
}
@Override
public double getBaseMaxPower() {
return maxStorage;
@ -127,16 +117,7 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
public boolean canAcceptEnergy(EnumFacing direction) {
return getFacing() != direction;
}
@Override
public EnumFacing getFacingEnum() {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockEnergyStorage) {
return ((BlockEnergyStorage) block).getFacing(world.getBlockState(pos));
}
return null;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
return getFacing() == direction;
@ -157,13 +138,35 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IToolDrop, I
return tier;
}
// TileLegacyMachineBase
@Override
public Inventory getInventory() {
return inventory;
public void setFacing(EnumFacing enumFacing) {
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
}
@Override
public EnumFacing getFacingEnum() {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockEnergyStorage) {
return ((BlockEnergyStorage) block).getFacing(world.getBlockState(pos));
}
return null;
}
@Override
public boolean canBeUpgraded() {
return false;
}
// IToolDrop
@Override
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
return new ItemStack(wrenchDrop);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return inventory;
}
}

View file

@ -41,7 +41,7 @@ public class TileHighVoltageSU extends TileEnergyStorage implements IContainerPr
* MFSU should store 40M FE with 2048 FE/t I/O
*/
public TileHighVoltageSU() {
super("HIGH_VOLTAGE_SU", 2, ModBlocks.HIGH_VOLTAGE_SU, EnumPowerTier.HIGH, 512, 512, 10000000);
super("HIGH_VOLTAGE_SU", 2, ModBlocks.HIGH_VOLTAGE_SU, EnumPowerTier.HIGH, 512, 512, 10_000_000);
}
@Override

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.tiles;
package techreborn.tiles.tier0;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.tiles;
package techreborn.tiles.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -22,16 +22,10 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
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;
}
}

View file

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

View file

@ -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,81 +33,22 @@ 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
@ -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;
}
}
}

View file

@ -22,15 +22,9 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
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,78 +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 TileCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
public class TileCompressor extends TileGenericMachine implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "compressor", key = "CompressorInput", comment = "Compressor Max Input (Value in EU)")
public static int maxInput = 32;
@ConfigRegistry(config = "machines", category = "compressor", key = "CompressorMaxEnergy", comment = "Compressor Max Energy (Value in EU)")
public static int maxEnergy = 1000;
public Inventory inventory = new Inventory(3, "TileCompressor", 64, this);
public RecipeCrafter crafter;
public TileCompressor() {
super();
super("Compressor", maxInput, maxEnergy, ModBlocks.COMPRESSOR, 2);
final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 };
this.inventory = new Inventory(3, "TileCompressor", 64, this);
this.crafter = new RecipeCrafter(Reference.COMPRESSOR_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;
}
// 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.COMPRESSOR, 1);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
return this.inventory;
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
@ -118,10 +57,4 @@ public class TileCompressor extends TilePowerAcceptor
.tile(this).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;
}
}
}

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
package techreborn.tiles.tier1;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -0,0 +1,60 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.tier1;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
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 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 = 1_000;
public TileExtractor() {
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);
}
// IContainerProvider
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().tile(this)
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this);
}
}

View file

@ -22,15 +22,9 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
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;
}
}
}

View file

@ -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;
@ -43,86 +37,24 @@ 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
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;
@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 +65,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;
}
}
}

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.tiles.teir1;
package techreborn.tiles.tier1;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -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,84 +35,29 @@ 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
@ -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;
}
}

View file

@ -28,7 +28,6 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop;
@ -46,7 +45,8 @@ import java.util.List;
* Created by Rushmead
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITickable, IListInfoProvider {
public class TileTransformer extends TilePowerAcceptor
implements IToolDrop, IListInfoProvider {
@ConfigRegistry(config = "misc", category = "general", key = "IC2TransformersStyle", comment = "Input from dots side, output from other sides, like in IC2.")
public static boolean IC2TransformersStyle = false;
@ -73,12 +73,8 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
this.maxOutput = tier.getMaxOutput();
this.maxStorage = tier.getMaxInput() * 2;
}
@Override
public ItemStack getToolDrop(EntityPlayer p0) {
return new ItemStack(wrenchDrop);
}
// TilePowerAcceptor
@Override
public double getBaseMaxPower() {
return maxStorage;
@ -91,16 +87,7 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
}
return getFacingEnum() != direction;
}
@Override
public EnumFacing getFacingEnum() {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockTransformer) {
return ((BlockTransformer) block).getFacing(world.getBlockState(pos));
}
return null;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
if (IC2TransformersStyle == true){
@ -118,7 +105,7 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
public double getBaseMaxInput() {
return inputTier.getMaxInput();
}
@Override
public EnumPowerTier getBaseTier() {
return inputTier;
@ -133,7 +120,24 @@ public class TileTransformer extends TilePowerAcceptor implements IToolDrop, ITi
public void checkTeir() {
//Nope
}
// TileLegacyMachineBase
@Override
public EnumFacing getFacingEnum() {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof BlockTransformer) {
return ((BlockTransformer) block).getFacing(world.getBlockState(pos));
}
return null;
}
// IToolDrop
@Override
public ItemStack getToolDrop(EntityPlayer p0) {
return new ItemStack(wrenchDrop);
}
// IListInfoProvider
@Override
public void addInfo(List<String> info, boolean isRealTile) {
info.add(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + getLocaliszedPowerFormatted((int) getBaseMaxInput()));