Update to latest commit(Master)

This commit is contained in:
Dimmerworld 2017-10-05 02:38:11 +11:00 committed by drcrazy
parent c8b6edd390
commit c651363b73
12 changed files with 174 additions and 135 deletions

View file

@ -59,7 +59,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
ResourceLocation currentRecipe;
public Inventory inventory = new Inventory(11, "TileAutoCraftingTable", 64, this);
public Inventory inventory = new Inventory(10, "TileAutoCraftingTable", 64, this);
public int progress;
public int maxProgress = 120;
public int euTick = 10;
@ -172,16 +172,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
for (int i = 0; i < 9; i++) {
ItemStack stack = inventory.getStackInSlot(i);
int requiredSize = customRecipe ? 1 : 0;
if(stack.getMaxStackSize() == 1){
requiredSize = 0;
}
if (stacksInSlots[i] > requiredSize) {
if (ingredient.apply(stack)) {
if(stack.getItem().getContainerItem() != null){
if(!hasRoomForExtraItem(stack.getItem().getContainerItem(stack))){
continue;
}
}
foundIngredient = true;
stacksInSlots[i]--;
break;
@ -194,7 +186,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
}
}
if (!missingOutput) {
if (hasOutputSpace(recipe.getRecipeOutput(), 9)) {
if (hasOutputSpace(recipe.getRecipeOutput())) {
return true;
}
}
@ -203,17 +195,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
return false;
}
boolean hasRoomForExtraItem(ItemStack stack){
ItemStack extraOutputSlot = getStackInSlot(10);
if(extraOutputSlot.isEmpty()){
return true;
}
return hasOutputSpace(stack, 10);
}
public boolean hasOutputSpace(ItemStack output, int slot) {
ItemStack stack = inventory.getStackInSlot(slot);
public boolean hasOutputSpace(ItemStack output) {
ItemStack stack = inventory.getStackInSlot(9);
if (stack.isEmpty()) {
return true;
}
@ -238,14 +221,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
//Looks for the best slot to take it from
ItemStack bestSlot = inventory.getStackInSlot(i);
if (ingredient.apply(bestSlot)) {
handleContainerItem(bestSlot);
bestSlot.shrink(1);
} else {
for (int j = 0; j < 9; j++) {
ItemStack stack = inventory.getStackInSlot(j);
if (ingredient.apply(stack)) {
handleContainerItem(stack);
stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid
//TOOD check items to be retuned
break;
}
}
@ -265,21 +247,6 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
return false;
}
private void handleContainerItem(ItemStack stack){
if(stack.getItem().hasContainerItem(stack)){
ItemStack containerItem = stack.getItem().getContainerItem(stack);
ItemStack extraOutputSlot = getStackInSlot(10);
if(hasOutputSpace(containerItem, 10)){
if(extraOutputSlot.isEmpty()){
setInventorySlotContents(10, containerItem.copy());
} else if(ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true) && extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
extraOutputSlot.grow(1);
}
}
}
}
public boolean hasIngredient(Ingredient ingredient) {
for (int i = 0; i < 9; i++) {
ItemStack stack = inventory.getStackInSlot(i);
@ -326,7 +293,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
.outputSlot(9, 145, 42).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
.addInventory().create(this);
@ -450,11 +417,11 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
@Override
public int[] getSlotsForFace(EnumFacing side) {
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
return index == 9 || index == 10;
return index == 9;
}
}

View file

@ -31,7 +31,7 @@ import reborncore.api.IToolDrop;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.blocks.generator.BlockSolarPanel;
import techreborn.blocks.generator.solarpanel.BlockSolarPanel;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@ -75,8 +75,6 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
this.powerToAdd = 0;
}
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
}
}

View file

@ -30,8 +30,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.tile.IMachineSlotProvider;
@ -74,9 +74,9 @@ public class TileElectricFurnace extends TilePowerAcceptor
this.progress++;
if (this.progress % 10 == 0) {
this.useEnergy(getEuPerTick(this.cost));
this.useEnergy(this.cost);
}
if (this.progress >= Math.max((int) (fuelScale * (1.0 - getSpeedMultiplier())), 1)) {
if (this.progress >= this.fuelScale) {
this.progress = 0;
this.cookItems();
updateInventory = true;
@ -127,7 +127,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
}
public boolean isBurning() {
return this.getEnergy() > getEuPerTick(this.cost);
return this.getEnergy() > this.cost;
}
public ItemStack getResultFor(final ItemStack stack) {
@ -245,6 +245,6 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override
public boolean canBeUpgraded() {
return true;
return false;
}
}