Change all containers init to IContainerProvider + Add Enum for gui ids handling
This commit is contained in:
parent
b93fe6c5ad
commit
eb220643fc
114 changed files with 2155 additions and 2025 deletions
|
@ -18,299 +18,321 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchable, IInventoryProvider {
|
||||
public class TileAlloyFurnace extends TileLegacyMachineBase
|
||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
|
||||
public int burnTime;
|
||||
public int currentItemBurnTime;
|
||||
public int cookTime;
|
||||
int input1 = 0;
|
||||
int input2 = 1;
|
||||
int output = 2;
|
||||
int fuel = 3;
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
|
||||
public int burnTime;
|
||||
public int currentItemBurnTime;
|
||||
public int cookTime;
|
||||
int input1 = 0;
|
||||
int input2 = 1;
|
||||
int output = 2;
|
||||
int fuel = 3;
|
||||
|
||||
public TileAlloyFurnace() {
|
||||
public TileAlloyFurnace() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of ticks that the supplied fuel item will keep the
|
||||
* furnace burning, or 0 if the item isn't fuel
|
||||
*/
|
||||
public static int getItemBurnTime(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 0;
|
||||
} else {
|
||||
final Item item = stack.getItem();
|
||||
/**
|
||||
* Returns the number of ticks that the supplied fuel item will keep the
|
||||
* furnace burning, or 0 if the item isn't fuel
|
||||
*/
|
||||
public static int getItemBurnTime(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 0;
|
||||
} else {
|
||||
final Item item = stack.getItem();
|
||||
|
||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
|
||||
final Block block = Block.getBlockFromItem(item);
|
||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
|
||||
final Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block == Blocks.WOODEN_SLAB) {
|
||||
return 150;
|
||||
}
|
||||
if (block == Blocks.WOODEN_SLAB) {
|
||||
return 150;
|
||||
}
|
||||
|
||||
if (block.getMaterial(block.getDefaultState()) == Material.WOOD) {
|
||||
return 300;
|
||||
}
|
||||
if (block.getMaterial(block.getDefaultState()) == Material.WOOD) {
|
||||
return 300;
|
||||
}
|
||||
|
||||
if (block == Blocks.COAL_BLOCK) {
|
||||
return 16000;
|
||||
}
|
||||
}
|
||||
if (block == Blocks.COAL_BLOCK) {
|
||||
return 16000;
|
||||
}
|
||||
}
|
||||
|
||||
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
|
||||
return 200;
|
||||
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
|
||||
return 200;
|
||||
// if (item instanceof ItemHoe && ((ItemHoe)
|
||||
// item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item == Items.STICK)
|
||||
return 100;
|
||||
if (item == Items.COAL)
|
||||
return 1600;
|
||||
if (item == Items.LAVA_BUCKET)
|
||||
return 20000;
|
||||
if (item == Item.getItemFromBlock(Blocks.SAPLING))
|
||||
return 100;
|
||||
if (item == Items.BLAZE_ROD)
|
||||
return 2400;
|
||||
return GameRegistry.getFuelValue(stack);
|
||||
}
|
||||
}
|
||||
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
|
||||
return 200;
|
||||
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
|
||||
return 200;
|
||||
// if (item instanceof ItemHoe && ((ItemHoe)
|
||||
// item).getToolMaterialName().equals("WOOD")) return 200;
|
||||
if (item == Items.STICK)
|
||||
return 100;
|
||||
if (item == Items.COAL)
|
||||
return 1600;
|
||||
if (item == Items.LAVA_BUCKET)
|
||||
return 20000;
|
||||
if (item == Item.getItemFromBlock(Blocks.SAPLING))
|
||||
return 100;
|
||||
if (item == Items.BLAZE_ROD)
|
||||
return 2400;
|
||||
return GameRegistry.getFuelValue(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
final boolean flag = this.burnTime > 0;
|
||||
boolean flag1 = false;
|
||||
if (this.burnTime > 0) {
|
||||
--this.burnTime;
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
if (this.burnTime != 0 || this.getStackInSlot(this.input1) != ItemStack.EMPTY && this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
if (this.burnTime == 0 && this.canSmelt()) {
|
||||
this.currentItemBurnTime = this.burnTime = TileAlloyFurnace.getItemBurnTime(this.getStackInSlot(this.fuel));
|
||||
if (this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
if (this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
this.decrStackSize(this.fuel, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.isBurning() && this.canSmelt()) {
|
||||
++this.cookTime;
|
||||
if (this.cookTime == 200) {
|
||||
this.cookTime = 0;
|
||||
this.smeltItem();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
this.cookTime = 0;
|
||||
}
|
||||
}
|
||||
if (flag != this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
// TODO sync on/off
|
||||
}
|
||||
}
|
||||
if (flag1) {
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
final boolean flag = this.burnTime > 0;
|
||||
boolean flag1 = false;
|
||||
if (this.burnTime > 0) {
|
||||
--this.burnTime;
|
||||
}
|
||||
if (!this.world.isRemote) {
|
||||
if (this.burnTime != 0 || this.getStackInSlot(this.input1) != ItemStack.EMPTY && this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
if (this.burnTime == 0 && this.canSmelt()) {
|
||||
this.currentItemBurnTime = this.burnTime = TileAlloyFurnace.getItemBurnTime(this.getStackInSlot(this.fuel));
|
||||
if (this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
if (this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
|
||||
this.decrStackSize(this.fuel, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.isBurning() && this.canSmelt()) {
|
||||
++this.cookTime;
|
||||
if (this.cookTime == 200) {
|
||||
this.cookTime = 0;
|
||||
this.smeltItem();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
this.cookTime = 0;
|
||||
}
|
||||
}
|
||||
if (flag != this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
// TODO sync on/off
|
||||
}
|
||||
}
|
||||
if (flag1) {
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAllInputs(final IBaseRecipeType recipeType) {
|
||||
if (recipeType == null) {
|
||||
return false;
|
||||
}
|
||||
for (final ItemStack input : recipeType.getInputs()) {
|
||||
Boolean hasItem = false;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputslot), true, true,
|
||||
recipeType.useOreDic()) && this.inventory.getStackInSlot(inputslot).getCount() >= input.getCount()) {
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean hasAllInputs(final IBaseRecipeType recipeType) {
|
||||
if (recipeType == null) {
|
||||
return false;
|
||||
}
|
||||
for (final ItemStack input : recipeType.getInputs()) {
|
||||
Boolean hasItem = false;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputslot), true, true,
|
||||
recipeType.useOreDic()) && this.inventory.getStackInSlot(inputslot).getCount() >= input.getCount()) {
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean canSmelt() {
|
||||
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY || this.getStackInSlot(this.input2) == ItemStack.EMPTY) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = null;
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutput(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
private boolean canSmelt() {
|
||||
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY || this.getStackInSlot(this.input2) == ItemStack.EMPTY) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = null;
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutput(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack == null)
|
||||
return false;
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
||||
return true;
|
||||
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
return false;
|
||||
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
||||
return result <= this.getInventoryStackLimit() && result <= this.getStackInSlot(this.output).getMaxStackSize(); // Forge
|
||||
// BugFix:
|
||||
// Make
|
||||
// it
|
||||
// respect
|
||||
// stack
|
||||
// sizes
|
||||
// properly.
|
||||
}
|
||||
}
|
||||
if (itemstack == null)
|
||||
return false;
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
|
||||
return true;
|
||||
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
|
||||
return false;
|
||||
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
|
||||
return result <= this.getInventoryStackLimit() && result <= this.getStackInSlot(this.output).getMaxStackSize(); // Forge
|
||||
// BugFix:
|
||||
// Make
|
||||
// it
|
||||
// respect
|
||||
// stack
|
||||
// sizes
|
||||
// properly.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn one item from the furnace source stack into the appropriate smelted
|
||||
* item in the furnace result stack
|
||||
*/
|
||||
public void smeltItem() {
|
||||
if (this.canSmelt()) {
|
||||
ItemStack itemstack = null;
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutput(0);
|
||||
break;
|
||||
}
|
||||
if (itemstack != ItemStack.EMPTY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Turn one item from the furnace source stack into the appropriate smelted
|
||||
* item in the furnace result stack
|
||||
*/
|
||||
public void smeltItem() {
|
||||
if (this.canSmelt()) {
|
||||
ItemStack itemstack = null;
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
itemstack = recipeType.getOutput(0);
|
||||
break;
|
||||
}
|
||||
if (itemstack != ItemStack.EMPTY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
|
||||
this.setInventorySlotContents(this.output, itemstack.copy());
|
||||
} else if (this.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
|
||||
this.decrStackSize(this.output, -itemstack.getCount());
|
||||
}
|
||||
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
|
||||
this.setInventorySlotContents(this.output, itemstack.copy());
|
||||
} else if (this.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
|
||||
this.decrStackSize(this.output, -itemstack.getCount());
|
||||
}
|
||||
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
boolean hasAllRecipes = true;
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||
boolean hasAllRecipes = true;
|
||||
if (this.hasAllInputs(recipeType)) {
|
||||
|
||||
} else {
|
||||
hasAllRecipes = false;
|
||||
}
|
||||
if (hasAllRecipes) {
|
||||
for (final ItemStack input : recipeType.getInputs()) {
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputSlot), true, true,
|
||||
recipeType.useOreDic())) {
|
||||
this.inventory.decrStackSize(inputSlot, input.getCount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hasAllRecipes = false;
|
||||
}
|
||||
if (hasAllRecipes) {
|
||||
for (final ItemStack input : recipeType.getInputs()) {
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputSlot), true, true,
|
||||
recipeType.useOreDic())) {
|
||||
this.inventory.decrStackSize(inputSlot, input.getCount());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Furnace isBurning
|
||||
*/
|
||||
public boolean isBurning() {
|
||||
return this.burnTime > 0;
|
||||
}
|
||||
/**
|
||||
* Furnace isBurning
|
||||
*/
|
||||
public boolean isBurning() {
|
||||
return this.burnTime > 0;
|
||||
}
|
||||
|
||||
public int getBurnTimeRemainingScaled(final int scale) {
|
||||
if (this.currentItemBurnTime == 0) {
|
||||
this.currentItemBurnTime = 200;
|
||||
}
|
||||
public int getBurnTimeRemainingScaled(final int scale) {
|
||||
if (this.currentItemBurnTime == 0) {
|
||||
this.currentItemBurnTime = 200;
|
||||
}
|
||||
|
||||
return this.burnTime * scale / this.currentItemBurnTime;
|
||||
}
|
||||
return this.burnTime * scale / this.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public int getCookProgressScaled(final int scale) {
|
||||
return this.cookTime * scale / 200;
|
||||
}
|
||||
public int getCookProgressScaled(final int scale) {
|
||||
return this.cookTime * scale / 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
@Override
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
@Override
|
||||
public float getWrenchDropRate() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IRON_ALLOY_FURNACE, 1);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IRON_ALLOY_FURNACE, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 1, 2 };
|
||||
}
|
||||
@Override
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 1, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
@Override
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 2;
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 2;
|
||||
}
|
||||
|
||||
public int getBurnTime()
|
||||
{
|
||||
return this.burnTime;
|
||||
}
|
||||
public int getBurnTime()
|
||||
{
|
||||
return this.burnTime;
|
||||
}
|
||||
|
||||
public void setBurnTime(final int burnTime)
|
||||
{
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
public void setBurnTime(final int burnTime)
|
||||
{
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public int getCurrentItemBurnTime()
|
||||
{
|
||||
return this.currentItemBurnTime;
|
||||
}
|
||||
public int getCurrentItemBurnTime()
|
||||
{
|
||||
return this.currentItemBurnTime;
|
||||
}
|
||||
|
||||
public void setCurrentItemBurnTime(final int currentItemBurnTime)
|
||||
{
|
||||
this.currentItemBurnTime = currentItemBurnTime;
|
||||
}
|
||||
public void setCurrentItemBurnTime(final int currentItemBurnTime)
|
||||
{
|
||||
this.currentItemBurnTime = currentItemBurnTime;
|
||||
}
|
||||
|
||||
public int getCookTime()
|
||||
{
|
||||
return this.cookTime;
|
||||
}
|
||||
public int getCookTime()
|
||||
{
|
||||
return this.cookTime;
|
||||
}
|
||||
|
||||
public void setCookTime(final int cookTime)
|
||||
{
|
||||
this.cookTime = cookTime;
|
||||
}
|
||||
public void setCookTime(final int cookTime)
|
||||
{
|
||||
this.cookTime = cookTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(0, 47, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
|
||||
.filterSlot(1, 65, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
|
||||
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getCookTime, this::setCookTime)
|
||||
.syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,18 +5,27 @@ import net.minecraft.inventory.ISidedInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.utils.upgrade.UpgradeHandler;
|
||||
|
||||
public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
public class TileAlloySmelter extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
|
||||
|
@ -27,35 +36,35 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
|
|||
public TileAlloySmelter() {
|
||||
super(1);
|
||||
// Input slots
|
||||
int[] inputs = new int[2];
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[1];
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
crafter = new RecipeCrafter(Reference.alloySmelteRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||
upgrades = new UpgradeHandler(crafter, inventory, 4, 5, 6, 7);
|
||||
this.crafter = new RecipeCrafter(Reference.alloySmelteRecipe, this, 2, 1, this.inventory, inputs, outputs);
|
||||
this.upgrades = new UpgradeHandler(this.crafter, this.inventory, 4, 5, 6, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
crafter.updateEntity();
|
||||
upgrades.tick();
|
||||
charge(3);
|
||||
this.crafter.updateEntity();
|
||||
this.upgrades.tick();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -65,7 +74,7 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
|
||||
}
|
||||
|
||||
|
@ -74,16 +83,16 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
inventory.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.inventory.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
@ -99,41 +108,41 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
|
|||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
if (slotIndex == 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex == 2;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return capacity;
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -154,11 +163,28 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this)
|
||||
.filterSlot(0, 47, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
|
||||
.filterSlot(1, 65, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
|
||||
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
|
||||
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -11,10 +12,15 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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 TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory, IInventoryProvider, IRecipeCrafterProvider {
|
||||
public class TileAssemblingMachine extends TilePowerAcceptor
|
||||
implements IWrenchable, ISidedInventory, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
|
||||
|
@ -23,32 +29,32 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
|||
public TileAssemblingMachine() {
|
||||
super(2);
|
||||
// Input slots
|
||||
int[] inputs = new int[2];
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[1];
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
crafter = new RecipeCrafter(Reference.assemblingMachineRecipe, this, 2, 2, inventory, inputs, outputs);
|
||||
this.crafter = new RecipeCrafter(Reference.assemblingMachineRecipe, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
charge(3);
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -58,7 +64,7 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ASSEMBLY_MACHINE, 1);
|
||||
}
|
||||
|
||||
|
@ -76,9 +82,9 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
|||
// }
|
||||
// }
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,12 +95,12 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -115,27 +121,34 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 1, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53)
|
||||
.upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
|
@ -14,7 +15,11 @@ import reborncore.common.powerSystem.PoweredItem;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.DynamicCell;
|
||||
|
@ -23,7 +28,7 @@ import techreborn.utils.upgrade.UpgradeHandler;
|
|||
import java.util.List;
|
||||
|
||||
public class TileCentrifuge extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider {
|
||||
implements IWrenchable, IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(11, "TileCentrifuge", 64, this);
|
||||
|
@ -35,30 +40,30 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
public TileCentrifuge() {
|
||||
super(2);
|
||||
// Input slots
|
||||
int[] inputs = new int[] { 0, 1 };
|
||||
int[] outputs = new int[4];
|
||||
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;
|
||||
|
||||
crafter = new RecipeCrafter(Reference.centrifugeRecipe, this, 2, 4, inventory, inputs, outputs);
|
||||
upgradeHandler = new UpgradeHandler(crafter, inventory, 7, 8, 9, 10);
|
||||
this.crafter = new RecipeCrafter(Reference.centrifugeRecipe, this, 2, 4, this.inventory, inputs, outputs);
|
||||
this.upgradeHandler = new UpgradeHandler(this.crafter, this.inventory, 7, 8, 9, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
upgradeHandler.tick();
|
||||
charge(6);
|
||||
if (inventory.getStackInSlot(6) != ItemStack.EMPTY) {
|
||||
ItemStack stack = inventory.getStackInSlot(6);
|
||||
this.crafter.updateEntity();
|
||||
this.upgradeHandler.tick();
|
||||
this.charge(6);
|
||||
if (this.inventory.getStackInSlot(6) != ItemStack.EMPTY) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(6);
|
||||
if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
final IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||
if (item.canProvideEnergy(stack)) {
|
||||
if (getEnergy() != getMaxPower()) {
|
||||
addEnergy(item.getMaxTransfer(stack));
|
||||
if (this.getEnergy() != this.getMaxPower()) {
|
||||
this.addEnergy(item.getMaxTransfer(stack));
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||
}
|
||||
}
|
||||
|
@ -67,17 +72,17 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -87,7 +92,7 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE, 1);
|
||||
}
|
||||
|
||||
|
@ -96,44 +101,44 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return itemStackIn.isItemEqual(DynamicCell.getEmptyCell(1).copy()) ? index == 1 : index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex >= 2 && slotIndex <= 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<String> info, boolean isRealTile) {
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
super.addInfo(info, isRealTile);
|
||||
info.add("Round and round it goes");
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -144,12 +149,12 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -170,12 +175,21 @@ public class TileCentrifuge extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 35).slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35)
|
||||
.outputSlot(4, 80, 65).outputSlot(5, 50, 35).energySlot(6, 8, 51).upgradeSlot(7, 152, 8)
|
||||
.upgradeSlot(8, 152, 26).upgradeSlot(9, 152, 44).upgradeSlot(10, 152, 62).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,15 +4,21 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.power.IEnergyInterfaceItem;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
|
||||
public class TileChargeBench extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileChargeBench", 64, this);
|
||||
public int capacity = 100000;
|
||||
|
@ -26,15 +32,15 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
super.updateEntity();
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (inventory.getStackInSlot(i) != ItemStack.EMPTY) {
|
||||
if (getEnergy() > 0) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (this.inventory.getStackInSlot(i) != ItemStack.EMPTY) {
|
||||
if (this.getEnergy() > 0) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(i);
|
||||
if (stack.getItem() instanceof IEnergyInterfaceItem) {
|
||||
IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
|
||||
double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
|
||||
Math.min(interfaceItem.getMaxTransfer(stack), getEnergy()));
|
||||
final IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
|
||||
final double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
|
||||
Math.min(interfaceItem.getMaxTransfer(stack), this.getEnergy()));
|
||||
interfaceItem.setEnergy(trans + interfaceItem.getEnergy(stack), stack);
|
||||
useEnergy(trans);
|
||||
this.useEnergy(trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,17 +48,17 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -62,7 +68,7 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHARGE_O_MAT, 1);
|
||||
}
|
||||
|
||||
|
@ -72,17 +78,17 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
// if (itemStack.getItem() instanceof IElectricItem) {
|
||||
// double CurrentCharge = ElectricItem.manager.getCharge(itemStack);
|
||||
// double MaxCharge = ((IElectricItem)
|
||||
|
@ -95,16 +101,16 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return capacity;
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -125,6 +131,13 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar(8, 142).addInventory()
|
||||
.tile(this).energySlot(0, 62, 21).energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39)
|
||||
.energySlot(4, 80, 39).energySlot(5, 98, 39).syncEnergyValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.inventory.ISidedInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -12,10 +13,15 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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 TileChemicalReactor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
public class TileChemicalReactor extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileChemicalReactor", 64, this);
|
||||
|
@ -24,33 +30,33 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
public TileChemicalReactor() {
|
||||
super(2);
|
||||
// Input slots
|
||||
int[] inputs = new int[2];
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[1];
|
||||
final int[] outputs = new int[1];
|
||||
outputs[0] = 2;
|
||||
crafter = new RecipeCrafter(Reference.chemicalReactorRecipe, this, 2, 2, inventory, inputs, outputs);
|
||||
this.crafter = new RecipeCrafter(Reference.chemicalReactorRecipe, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
charge(3);
|
||||
this.crafter.updateEntity();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -60,7 +66,7 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHEMICAL_REACTOR, 1);
|
||||
}
|
||||
|
||||
|
@ -69,33 +75,33 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
if (slotIndex == 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex == 2;
|
||||
}
|
||||
|
||||
|
@ -109,9 +115,9 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
// }
|
||||
// }
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,12 +128,12 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -148,11 +154,19 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51).energySlot(3, 8, 51)
|
||||
.upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,19 @@ package techreborn.tiles;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(1, "TileChunkLoader", 64, this);
|
||||
|
||||
|
@ -24,17 +29,17 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -44,7 +49,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHUNK_LOADER, 1);
|
||||
}
|
||||
|
||||
|
@ -58,12 +63,12 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,6 +89,12 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
public class TileDigitalChest extends TileTechStorageBase {
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
|
||||
public class TileDigitalChest extends TileTechStorageBase implements IContainerProvider {
|
||||
|
||||
public TileDigitalChest() {
|
||||
super("TileDigitalChest", 32768);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.inventory.ISidedInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -12,10 +13,15 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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 TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64, this);
|
||||
|
@ -24,36 +30,36 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
public TileIndustrialElectrolyzer() {
|
||||
super(2);
|
||||
// Input slots
|
||||
int[] inputs = new int[2];
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[4];
|
||||
final int[] outputs = new int[4];
|
||||
outputs[0] = 2;
|
||||
outputs[1] = 3;
|
||||
outputs[2] = 4;
|
||||
outputs[3] = 5;
|
||||
crafter = new RecipeCrafter(Reference.industrialElectrolyzerRecipe, this, 2, 4, inventory, inputs, outputs);
|
||||
this.crafter = new RecipeCrafter(Reference.industrialElectrolyzerRecipe, this, 2, 4, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
crafter.updateEntity();
|
||||
charge(6);
|
||||
this.crafter.updateEntity();
|
||||
this.charge(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -63,7 +69,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER, 1);
|
||||
}
|
||||
|
||||
|
@ -72,15 +78,15 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
@ -96,25 +102,25 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
if (slotIndex >= 1)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -125,12 +131,12 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -151,11 +157,19 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19).outputSlot(3, 70, 19)
|
||||
.outputSlot(4, 90, 19).outputSlot(5, 110, 19).energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -14,7 +15,12 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.tile.TileLegacyMachineBase;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
public class TileIronFurnace extends TileLegacyMachineBase implements IInventoryProvider, ISidedInventory {
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
|
||||
public class TileIronFurnace extends TileLegacyMachineBase
|
||||
implements IInventoryProvider, ISidedInventory, IContainerProvider {
|
||||
|
||||
private static final int[] SLOTS_TOP = new int[] { 0 };
|
||||
private static final int[] SLOTS_BOTTOM = new int[] { 2, 1 };
|
||||
|
@ -181,4 +187,12 @@ public class TileIronFurnace extends TileLegacyMachineBase implements IInventory
|
|||
public void setTotalBurnTime(final int totalBurnTime) {
|
||||
this.fuelGague = totalBurnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 56, 17).outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,15 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.items.ItemParts;
|
||||
|
||||
public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
public class TileMatterFabricator extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public static int fabricationRate = 10000;
|
||||
public int tickTime;
|
||||
|
@ -218,4 +222,12 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 33, 17).slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17)
|
||||
.slot(4, 51, 35).slot(5, 51, 53).outputSlot(6, 116, 35).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
public class TileQuantumChest extends TileTechStorageBase {
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
|
||||
public class TileQuantumChest extends TileTechStorageBase implements IContainerProvider {
|
||||
|
||||
public TileQuantumChest() {
|
||||
super("TileQuantumChest", Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -15,63 +16,67 @@ import reborncore.common.tile.TileLegacyMachineBase;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileQuantumTank extends TileLegacyMachineBase
|
||||
implements IInventoryProvider, IWrenchable, IListInfoProvider {
|
||||
implements IInventoryProvider, IWrenchable, IListInfoProvider, IContainerProvider {
|
||||
|
||||
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
|
||||
public Inventory inventory = new Inventory(3, "TileQuantumTank", 64, this);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
readFromNBTWithoutCoords(tagCompound);
|
||||
this.readFromNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
tank.readFromNBT(tagCompound);
|
||||
public void readFromNBTWithoutCoords(final NBTTagCompound tagCompound) {
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
writeToNBTWithoutCoords(tagCompound);
|
||||
this.writeToNBTWithoutCoords(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
tank.writeToNBT(tagCompound);
|
||||
public NBTTagCompound writeToNBTWithoutCoords(final NBTTagCompound tagCompound) {
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||
this.world.markBlockRangeForRenderUpdate(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(),
|
||||
this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||
this.readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote) {
|
||||
if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|
||||
|| FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType()))
|
||||
if (!this.world.isRemote) {
|
||||
if (FluidUtils.drainContainers(this.tank, this.inventory, 0, 1)
|
||||
|| FluidUtils.fillContainers(this.tank, this.inventory, 0, 1, this.tank.getFluidType()))
|
||||
this.syncWithAll();
|
||||
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == ItemStack.EMPTY) {
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != ItemStack.EMPTY) {
|
||||
setInventorySlotContents(2, ItemStack.EMPTY);
|
||||
if (this.tank.getFluidType() != null && this.getStackInSlot(2) == ItemStack.EMPTY) {
|
||||
this.inventory.setInventorySlotContents(2, new ItemStack(this.tank.getFluidType().getBlock()));
|
||||
} else if (this.tank.getFluidType() == null && this.getStackInSlot(2) != ItemStack.EMPTY) {
|
||||
this.setInventorySlotContents(2, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
|
@ -79,25 +84,25 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) tank;
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -107,34 +112,41 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return getDropWithNBT();
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return this.getDropWithNBT();
|
||||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
ItemStack dropStack = new ItemStack(ModBlocks.QUANTUM_TANK, 1);
|
||||
writeToNBTWithoutCoords(tileEntity);
|
||||
final NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
final ItemStack dropStack = new ItemStack(ModBlocks.QUANTUM_TANK, 1);
|
||||
this.writeToNBTWithoutCoords(tileEntity);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<String> info, boolean isRealTile) {
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
if (isRealTile) {
|
||||
if (tank.getFluid() != null) {
|
||||
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
|
||||
if (this.tank.getFluid() != null) {
|
||||
info.add(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName());
|
||||
} else {
|
||||
info.add("Empty");
|
||||
}
|
||||
}
|
||||
info.add("Capacity " + tank.getCapacity() + " mb");
|
||||
info.add("Capacity " + this.tank.getCapacity() + " mb");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("quantumtank").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory()
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,14 @@ import reborncore.common.util.Inventory;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.RollingMachineRecipe;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
//TODO add tick and power bars.
|
||||
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
public class TileRollingMachine extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public final InventoryCrafting craftMatrix = new InventoryCrafting(new RollingTileContainer(), 3, 3);
|
||||
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
|
||||
|
@ -204,4 +208,15 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
|||
}
|
||||
return this.tickTime * scale / this.runTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this.craftMatrix).slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17).slot(3, 30, 35)
|
||||
.slot(4, 48, 35).slot(5, 66, 35).slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
|
||||
.onCraft(inv -> this.inventory.setInventorySlotContents(1,
|
||||
RollingMachineRecipe.instance.findMatchingRecipe(inv, this.world)))
|
||||
.addInventory().tile(this).outputSlot(0, 124, 35).energySlot(2, 8, 51).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,12 +14,16 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.api.ScrapboxList;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
|
||||
public class TileScrapboxinator extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileScrapboxinator", 64, this);
|
||||
public int capacity = 1000;
|
||||
|
@ -199,4 +203,13 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
|
|||
public void setProgress(final int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX)
|
||||
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
|
||||
.upgradeSlot(5, 152, 62).syncEnergyValue().syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.tiles.fusionReactor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -14,9 +15,12 @@ import reborncore.common.util.ItemUtils;
|
|||
|
||||
import techreborn.api.reactor.FusionReactorRecipe;
|
||||
import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider {
|
||||
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileEntityFusionController", 64, this);
|
||||
|
||||
|
@ -324,4 +328,14 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
|||
return Math.max(0, Math.min(24, (this.getCrafingTickTime() > 0 ? 1 : 0)
|
||||
+ this.getCrafingTickTime() * 24 / (this.finalTickTime < 1 ? 1 : this.finalTickTime)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 88, 17).slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
|
||||
.syncIntegerValue(this::getCoilStatus, this::setCoilStatus)
|
||||
.syncIntegerValue(this::getCrafingTickTime, this::setCrafingTickTime)
|
||||
.syncIntegerValue(this::getFinalTickTime, this::setFinalTickTime)
|
||||
.syncIntegerValue(this::getNeededPower, this::setNeededPower).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,17 @@ package techreborn.tiles.generator;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileDieselGenerator extends TileBaseFluidGenerator {
|
||||
public class TileDieselGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
public TileDieselGenerator() {
|
||||
super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000 * 10,
|
||||
|
@ -15,7 +20,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.DIESEL_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
@ -33,4 +38,11 @@ public class TileDieselGenerator extends TileBaseFluidGenerator {
|
|||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,24 @@ package techreborn.tiles.generator;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileGasTurbine extends TileBaseFluidGenerator {
|
||||
public class TileGasTurbine extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
public TileGasTurbine() {
|
||||
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000 * 10, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.GAS_TURBINE, 1);
|
||||
}
|
||||
|
||||
|
@ -27,4 +32,11 @@ public class TileGasTurbine extends TileBaseFluidGenerator {
|
|||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("gasturbine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,12 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
public static int outputAmount = 10;
|
||||
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
|
||||
public int fuelSlot = 0;
|
||||
|
@ -163,4 +166,12 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
|
|||
public int getScaledBurnTime(final int i) {
|
||||
return (int) ((float) this.burnTime / (float) this.totalBurnTime * i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).fuelSlot(0, 80, 53).energySlot(1, 80, 17).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
|
||||
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,24 @@ package techreborn.tiles.generator;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileSemifluidGenerator extends TileBaseFluidGenerator {
|
||||
public class TileSemifluidGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
public TileSemifluidGenerator() {
|
||||
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000 * 10, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer arg0) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer arg0) {
|
||||
return new ItemStack(ModBlocks.SEMIFLUID_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
@ -27,4 +32,11 @@ public class TileSemifluidGenerator extends TileBaseFluidGenerator {
|
|||
public double getMaxPower() {
|
||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,18 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileThermalGenerator extends TileBaseFluidGenerator {
|
||||
public class TileThermalGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
public TileThermalGenerator() {
|
||||
super(EFluidGenerator.THERMAL, ConfigTechReborn.ThermalGeneratorTier, "TileThermalGenerator", 1000 * 10,
|
||||
|
@ -19,7 +24,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.THERMAL_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
@ -28,7 +33,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator {
|
|||
super.updateEntity();
|
||||
|
||||
if (!this.world.isRemote) {
|
||||
if (acceptFluid() && FluidUtils.drainContainers(this.tank, this.inventory, 0, 1))
|
||||
if (this.acceptFluid() && FluidUtils.drainContainers(this.tank, this.inventory, 0, 1))
|
||||
this.syncWithAll();
|
||||
for (final EnumFacing direction : EnumFacing.values()) {
|
||||
if (this.world
|
||||
|
@ -57,4 +62,11 @@ public class TileThermalGenerator extends TileBaseFluidGenerator {
|
|||
public EnumPowerTier getTier() {
|
||||
return EnumPowerTier.LOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("thermalgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package techreborn.tiles.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
|
@ -24,12 +23,16 @@ import techreborn.api.Reference;
|
|||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.multiblocks.MultiBlockCasing;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider {
|
||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventoryProvider,
|
||||
ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public static int euTick = 5;
|
||||
public int tickTime;
|
||||
|
@ -230,4 +233,12 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
public int getCachedHeat() {
|
||||
return this.cachedHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 40, 25).slot(1, 40, 43).outputSlot(2, 100, 35).outputSlot(3, 118, 35)
|
||||
.syncEnergyValue().syncCrafterValue().syncIntegerValue(this::getHeat, this::setHeat).addInventory()
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package techreborn.tiles.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -13,13 +13,15 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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 static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||
public class TileImplosionCompressor extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
@ -27,29 +29,29 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
|||
|
||||
public TileImplosionCompressor() {
|
||||
super(2);
|
||||
int[] inputs = new int[] { 0, 1 };
|
||||
int[] outputs = new int[] { 2, 3 };
|
||||
crafter = new RecipeCrafter(Reference.implosionCompressorRecipe, this, 2, 2, inventory, inputs, outputs);
|
||||
final int[] inputs = new int[] { 0, 1 };
|
||||
final int[] outputs = new int[] { 2, 3 };
|
||||
this.crafter = new RecipeCrafter(Reference.implosionCompressorRecipe, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(world, getPos().down(3));
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -59,56 +61,56 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR, 1);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, new BlockPos(0, 2, 0));
|
||||
boolean chamber = multiblockChecker.checkRingYHollow(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
final boolean down = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_REINFORCED, MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_REINFORCED, new BlockPos(0, 2, 0));
|
||||
final boolean chamber = this.multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
return down && chamber && up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
if (this.getMutliBlock()) {
|
||||
this.crafter.updateEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 1, 2, 3 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0 || index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 2 || index == 3;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -119,12 +121,12 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -145,12 +147,19 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 37, 26).slot(1, 37, 44).outputSlot(2, 93, 35).outputSlot(3, 111, 35)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package techreborn.tiles.multiblock;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -12,6 +11,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -21,22 +21,22 @@ import reborncore.common.recipes.RecipeCrafter;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.ITileRecipeHandler;
|
||||
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_NORMAL;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrenchable, IInventoryProvider,
|
||||
ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
public Tank tank = new Tank("TileGrinder", TANK_CAPACITY, this);
|
||||
public Tank tank = new Tank("TileGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
|
||||
public RecipeCrafter crafter;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
|
@ -44,29 +44,30 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
super(ConfigTechReborn.CentrifugeTier);
|
||||
// TODO configs
|
||||
|
||||
int[] inputs = new int[2];
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
int[] outputs = new int[4];
|
||||
final int[] outputs = new int[4];
|
||||
outputs[0] = 2;
|
||||
outputs[1] = 3;
|
||||
outputs[2] = 4;
|
||||
outputs[3] = 5;
|
||||
crafter = new RecipeCrafter(Reference.industrialGrinderRecipe, this, 1, 4, inventory, inputs, outputs);
|
||||
this.crafter = new RecipeCrafter(Reference.industrialGrinderRecipe, this, 1, 4, this.inventory, inputs,
|
||||
outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -76,16 +77,19 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_GRINDER, 1);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
final boolean down = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
new BlockPos(0, 2, 0));
|
||||
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_REINFORCED,
|
||||
new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = this.multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
|
@ -93,29 +97,29 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (multiblockChecker == null) {
|
||||
BlockPos pos = getPos().offset(getFacing().getOpposite(), 2).down();
|
||||
multiblockChecker = new MultiblockChecker(world, pos);
|
||||
if (this.multiblockChecker == null) {
|
||||
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2).down();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, pos);
|
||||
}
|
||||
|
||||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
if (this.getMutliBlock()) {
|
||||
this.crafter.updateEntity();
|
||||
}
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 5);
|
||||
FluidUtils.drainContainers(this.tank, this.inventory, 1, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
@ -130,7 +134,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
|
@ -138,34 +142,34 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) tank;
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
if (slotIndex >= 2)
|
||||
return false;
|
||||
return isItemValidForSlot(slotIndex, itemStack);
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -176,12 +180,12 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -201,9 +205,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
public boolean canCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) {
|
||||
final FluidStack recipeFluid = recipe.fluidStack;
|
||||
final FluidStack tankFluid = this.tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -219,9 +223,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile, IndustrialGrinderRecipe recipe) {
|
||||
FluidStack recipeFluid = recipe.fluidStack;
|
||||
FluidStack tankFluid = tank.getFluid();
|
||||
public boolean onCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) {
|
||||
final FluidStack recipeFluid = recipe.fluidStack;
|
||||
final FluidStack tankFluid = this.tank.getFluid();
|
||||
if (recipe.fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -231,7 +235,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
if (tankFluid.amount == recipeFluid.amount)
|
||||
tank.setFluid(null);
|
||||
this.tank.setFluid(null);
|
||||
else
|
||||
tankFluid.amount -= recipeFluid.amount;
|
||||
return true;
|
||||
|
@ -242,12 +246,20 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 32, 26).slot(1, 32, 44).outputSlot(2, 77, 35).outputSlot(3, 95, 35)
|
||||
.outputSlot(4, 113, 35).outputSlot(5, 131, 35).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -12,7 +11,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -20,16 +19,17 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
|
|||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.ItemDusts;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_NORMAL;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IListInfoProvider {
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(5, "Sawmill", 64, this);
|
||||
public Tank tank = new Tank("Sawmill", 16000, this);
|
||||
|
@ -44,83 +44,84 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMutliBlock()) {
|
||||
ItemStack wood = inventory.getStackInSlot(0);
|
||||
if (tickTime == 0) {
|
||||
if (wood != null) {
|
||||
for (int id : OreDictionary.getOreIDs(wood)) {
|
||||
String name = OreDictionary.getOreName(id);
|
||||
if (name.equals("logWood") &&
|
||||
canAddOutput(2, 10) &&
|
||||
canAddOutput(3, 5) &&
|
||||
canAddOutput(4, 3) &&
|
||||
canUseEnergy(128.0F) &&
|
||||
!tank.isEmpty() &&
|
||||
tank.getFluid().amount >= 1000) {
|
||||
|
||||
if (this.getMutliBlock()) {
|
||||
final ItemStack wood = this.inventory.getStackInSlot(0);
|
||||
if (this.tickTime == 0) {
|
||||
if (!wood.isEmpty()) {
|
||||
for (final int id : OreDictionary.getOreIDs(wood)) {
|
||||
final String name = OreDictionary.getOreName(id);
|
||||
if (name.equals("logWood") && this.canAddOutput(2, 10) && this.canAddOutput(3, 5)
|
||||
&& this.canAddOutput(4, 3) && this.canUseEnergy(128.0F) && !this.tank.isEmpty()
|
||||
&& this.tank.getFluid().amount >= 1000) {
|
||||
wood.shrink(1);
|
||||
if (wood.getCount() == 0)
|
||||
setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
tank.drain(1000, true);
|
||||
useEnergy(128.0F);
|
||||
tickTime = 1;
|
||||
this.setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
this.tank.drain(1000, true);
|
||||
this.useEnergy(128.0F);
|
||||
this.syncWithAll();
|
||||
this.tickTime = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (++tickTime > 100) {
|
||||
Random rnd = world.rand;
|
||||
addOutput(2, new ItemStack(Blocks.PLANKS, 6 + rnd.nextInt(4)));
|
||||
} else if (++this.tickTime > 100) {
|
||||
final Random rnd = this.world.rand;
|
||||
this.addOutput(2, new ItemStack(Blocks.PLANKS, 6 + rnd.nextInt(4)));
|
||||
if (rnd.nextInt(4) != 0) {
|
||||
ItemStack pulp = ItemDusts.getDustByName("sawDust", 2 + rnd.nextInt(3));
|
||||
addOutput(3, pulp);
|
||||
final ItemStack pulp = ItemDusts.getDustByName("sawDust", 2 + rnd.nextInt(3));
|
||||
this.addOutput(3, pulp);
|
||||
}
|
||||
if (rnd.nextInt(3) == 0) {
|
||||
ItemStack paper = new ItemStack(Items.PAPER, 1 + rnd.nextInt(2));
|
||||
addOutput(4, paper);
|
||||
final ItemStack paper = new ItemStack(Items.PAPER, 1 + rnd.nextInt(2));
|
||||
this.addOutput(4, paper);
|
||||
}
|
||||
tickTime = 0;
|
||||
this.tickTime = 0;
|
||||
}
|
||||
}
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 4);
|
||||
FluidUtils.drainContainers(this.tank, this.inventory, 1, 4);
|
||||
}
|
||||
|
||||
public void addOutput(int slot, ItemStack stack) {
|
||||
if (getStackInSlot(slot) == ItemStack.EMPTY)
|
||||
setInventorySlotContents(slot, stack);
|
||||
getStackInSlot(slot).grow(stack.getCount());
|
||||
public void addOutput(final int slot, final ItemStack stack) {
|
||||
if (this.getStackInSlot(slot) == ItemStack.EMPTY)
|
||||
this.setInventorySlotContents(slot, stack);
|
||||
this.getStackInSlot(slot).grow(stack.getCount());
|
||||
}
|
||||
|
||||
public boolean canAddOutput(int slot, int amount) {
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
return stack == ItemStack.EMPTY || getInventoryStackLimit() - stack.getCount() >= amount;
|
||||
public boolean canAddOutput(final int slot, final int amount) {
|
||||
final ItemStack stack = this.getStackInSlot(slot);
|
||||
return stack == ItemStack.EMPTY || this.getInventoryStackLimit() - stack.getCount() >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(world, getPos().down(3));
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down(3));
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
boolean down = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, ZERO_OFFSET);
|
||||
boolean up = multiblockChecker.checkRectY(1, 1, CASING_NORMAL, new BlockPos(0, 2, 0));
|
||||
boolean blade = multiblockChecker.checkRingY(1, 1, CASING_REINFORCED, new BlockPos(0, 1, 0));
|
||||
IBlockState centerBlock = multiblockChecker.getBlock(0, 1, 0);
|
||||
boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
final boolean down = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean up = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_NORMAL,
|
||||
new BlockPos(0, 2, 0));
|
||||
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_REINFORCED,
|
||||
new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = this.multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = centerBlock.getBlock() == Blocks.WATER;
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -130,27 +131,27 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
tickTime = tagCompound.getInteger("tickTime");
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
this.tickTime = tagCompound.getInteger("tickTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
tagCompound.setInteger("tickTime", tickTime);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
tagCompound.setInteger("tickTime", this.tickTime);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
|
@ -158,31 +159,31 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) tank;
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 2, 3, 4, 5 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index >= 2;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (tickTime != 0) {
|
||||
return tickTime * scale / 100;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.tickTime != 0) {
|
||||
return this.tickTime * scale / 100;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -193,12 +194,12 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -219,7 +220,13 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 32, 26).slot(1, 32, 44).outputSlot(2, 84, 35).outputSlot(3, 102, 35)
|
||||
.outputSlot(4, 120, 35).syncEnergyValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package techreborn.tiles.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -12,13 +12,15 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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 static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
@ -26,26 +28,26 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
|
||||
public TileVacuumFreezer() {
|
||||
super(2);
|
||||
int[] inputs = new int[] { 0 };
|
||||
int[] outputs = new int[] { 1 };
|
||||
crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
final int[] outputs = new int[] { 1 };
|
||||
this.crafter = new RecipeCrafter(Reference.vacuumFreezerRecipe, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
multiblockChecker = new MultiblockChecker(world, getPos().down());
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getMultiBlock())
|
||||
crafter.updateEntity();
|
||||
if (this.getMultiBlock())
|
||||
this.crafter.updateEntity();
|
||||
}
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
return multiblockChecker.checkRectY(1, 1, CASING_REINFORCED, ZERO_OFFSET);
|
||||
return this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_REINFORCED, MultiblockChecker.ZERO_OFFSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,12 +56,12 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -79,17 +81,17 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -99,53 +101,60 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
crafter.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
crafter.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return new int[] { 0, 1 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
|
||||
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 56, 34).outputSlot(1, 116, 35).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -9,14 +14,20 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileBatBox extends TileEnergyStorage implements IListInfoProvider {
|
||||
public class TileBatBox extends TileEnergyStorage implements IContainerProvider {
|
||||
|
||||
public TileBatBox() {
|
||||
super("BatBox", 2, ModBlocks.BATTERY_BOX, EnumPowerTier.LOW, 32, 32, 40000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(List<String> info, boolean isRealTile) {
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
info.add("Batbox");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("batbox").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).energySlot(0, 80, 17).energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileMFE extends TileEnergyStorage {
|
||||
public class TileMFE extends TileEnergyStorage implements IContainerProvider {
|
||||
|
||||
public TileMFE() {
|
||||
super("MFE", 2, ModBlocks.MVSU, EnumPowerTier.MEDIUM, 512, 512, 600000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("mfe").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
|
||||
.complete(44, 6).addArmor().addInventory().tile(this).energySlot(0, 80, 17).energySlot(1, 80, 53)
|
||||
.syncEnergyValue().addInventory().create();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +1,27 @@
|
|||
package techreborn.tiles.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class TileMFSU extends TileEnergyStorage {
|
||||
public class TileMFSU extends TileEnergyStorage implements IContainerProvider {
|
||||
|
||||
public TileMFSU() {
|
||||
super("MFSU", 2, ModBlocks.HVSU, EnumPowerTier.HIGH, 2048, 2048, 1000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("mfsu").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
|
||||
.complete(44, 6).addArmor().addInventory().tile(this).energySlot(0, 80, 17).energySlot(1, 80, 53)
|
||||
.syncEnergyValue().addInventory().create();
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package techreborn.tiles.teir1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -11,11 +11,16 @@ import reborncore.common.IWrenchable;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
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.utils.upgrade.UpgradeHandler;
|
||||
|
||||
public class TileCompressor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||
public class TileCompressor extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
||||
|
||||
|
@ -26,32 +31,32 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II
|
|||
|
||||
public TileCompressor() {
|
||||
super(1);
|
||||
int[] inputs = new int[] { 0 };
|
||||
int[] outputs = new int[] { 1 };
|
||||
crafter = new RecipeCrafter(Reference.compressorRecipe, this, 2, 1, inventory, inputs, outputs);
|
||||
upgradeHandler = new UpgradeHandler(crafter, inventory, 2, 3, 4, 5);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
final int[] outputs = new int[] { 1 };
|
||||
this.crafter = new RecipeCrafter(Reference.compressorRecipe, this, 2, 1, this.inventory, inputs, outputs);
|
||||
this.upgradeHandler = new UpgradeHandler(this.crafter, this.inventory, 2, 3, 4, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
crafter.updateEntity();
|
||||
upgradeHandler.tick();
|
||||
charge(3);
|
||||
this.crafter.updateEntity();
|
||||
this.upgradeHandler.tick();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getFacing() {
|
||||
return getFacingEnum();
|
||||
return this.getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
|
||||
return entityPlayer.isSneaking();
|
||||
}
|
||||
|
||||
|
@ -61,7 +66,7 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.COMPRESSOR, 1);
|
||||
}
|
||||
|
||||
|
@ -71,39 +76,39 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II
|
|||
|
||||
// ISidedInventory
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
public int[] getSlotsForFace(final EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int Index, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canInsertItem(final int Index, final ItemStack itemStack, final EnumFacing side) {
|
||||
return Index == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int Index, ItemStack itemStack, EnumFacing side) {
|
||||
public boolean canExtractItem(final int Index, final ItemStack itemStack, final EnumFacing side) {
|
||||
return Index == 1;
|
||||
}
|
||||
|
||||
public int getProgressScaled(int scale) {
|
||||
if (crafter.currentTickTime != 0) {
|
||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower() {
|
||||
return capacity;
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -124,11 +129,19 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II
|
|||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return crafter;
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("compressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
|
||||
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package techreborn.tiles.teir1;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -14,9 +13,13 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
|
||||
public class TileElectricFurnace extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileElectricFurnace", 64, this);
|
||||
public int capacity = 1000;
|
||||
|
@ -209,4 +212,12 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
|||
public void setBurnTime(final int burnTime) {
|
||||
this.progress = burnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
|
||||
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
|
||||
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,14 @@ import reborncore.common.recipes.RecipeCrafter;
|
|||
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.utils.upgrade.UpgradeHandler;
|
||||
|
||||
public class TileExtractor extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider {
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
||||
|
||||
|
@ -149,4 +152,12 @@ public class TileExtractor extends TilePowerAcceptor
|
|||
return index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("extractor").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
|
||||
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package techreborn.tiles.teir1;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -16,13 +14,16 @@ import reborncore.common.recipes.RecipeCrafter;
|
|||
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.utils.upgrade.UpgradeHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInventoryProvider,
|
||||
IListInfoProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||
public class TileGrinder extends TilePowerAcceptor
|
||||
implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
|
||||
|
@ -158,4 +159,12 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IInve
|
|||
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("grinder").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
|
||||
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package techreborn.tiles.teir1;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
@ -13,10 +12,13 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.ItemParts;
|
||||
|
||||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
|
||||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||
public int capacity = 1000;
|
||||
|
@ -210,4 +212,12 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInv
|
|||
public void setProgress(final int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||
.tile(this).slot(0, 56, 34).slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
|
||||
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue