2017-06-20 19:54:45 +02:00
|
|
|
package techreborn.tiles;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2017-06-20 22:38:51 +02:00
|
|
|
import net.minecraft.inventory.IInventory;
|
2017-06-20 22:31:21 +02:00
|
|
|
import net.minecraft.item.crafting.IRecipe;
|
2017-06-20 19:54:45 +02:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2017-06-20 22:31:21 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
2017-06-20 22:38:51 +02:00
|
|
|
import reborncore.api.tile.IInventoryProvider;
|
2017-06-20 19:54:45 +02:00
|
|
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
2017-06-20 22:38:51 +02:00
|
|
|
import reborncore.common.util.Inventory;
|
2017-06-20 19:54:45 +02:00
|
|
|
import techreborn.client.container.IContainerProvider;
|
|
|
|
import techreborn.client.container.builder.BuiltContainer;
|
|
|
|
import techreborn.client.container.builder.ContainerBuilder;
|
|
|
|
|
2017-06-20 22:31:21 +02:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2017-06-20 19:54:45 +02:00
|
|
|
/**
|
|
|
|
* Created by modmuss50 on 20/06/2017.
|
|
|
|
*/
|
2017-06-20 22:38:51 +02:00
|
|
|
public class TileAutoCraftingTable extends TilePowerAcceptor implements IContainerProvider, IInventoryProvider {
|
2017-06-20 22:31:21 +02:00
|
|
|
|
|
|
|
ResourceLocation currentRecipe;
|
|
|
|
|
2017-06-20 22:38:51 +02:00
|
|
|
public Inventory inventory = new Inventory(10, "TileAutoCraftingTable", 64, this);
|
|
|
|
|
2017-06-20 22:31:21 +02:00
|
|
|
public void setCurrentRecipe(ResourceLocation recipe){
|
|
|
|
currentRecipe = recipe;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public IRecipe getIRecipe(){
|
|
|
|
if(currentRecipe == null){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return ForgeRegistries.RECIPES.getValue(currentRecipe);
|
|
|
|
}
|
|
|
|
|
2017-06-20 19:54:45 +02:00
|
|
|
public TileAutoCraftingTable() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getBaseMaxPower() {
|
2017-06-21 11:00:53 +02:00
|
|
|
return 10000;
|
2017-06-20 19:54:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getBaseMaxOutput() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getBaseMaxInput() {
|
2017-06-21 11:00:53 +02:00
|
|
|
return 32;
|
2017-06-20 19:54:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canAcceptEnergy(EnumFacing enumFacing) {
|
2017-06-21 11:00:53 +02:00
|
|
|
return true;
|
2017-06-20 19:54:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canProvideEnergy(EnumFacing enumFacing) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public BuiltContainer createContainer(EntityPlayer player) {
|
2017-06-20 22:38:51 +02:00
|
|
|
return new ContainerBuilder("autocraftingTable").player(player.inventory).inventory().hotbar()
|
2017-06-21 11:00:53 +02:00
|
|
|
.addInventory().tile(this)
|
|
|
|
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
|
|
|
|
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
|
|
|
|
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
|
|
|
|
.outputSlot(9, 145, 42).addInventory()
|
2017-06-20 22:38:51 +02:00
|
|
|
.create();
|
2017-06-20 19:54:45 +02:00
|
|
|
}
|
2017-06-20 22:31:21 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canBeUpgraded() {
|
|
|
|
return false;
|
|
|
|
}
|
2017-06-20 22:38:51 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public IInventory getInventory() {
|
|
|
|
return inventory;
|
|
|
|
}
|
2017-06-20 19:54:45 +02:00
|
|
|
}
|