Texture readd, classes unaltered and debug message removed

This commit is contained in:
Dimmerworld 2017-10-06 23:51:00 +11:00 committed by drcrazy
parent 4307cb8258
commit 8a5df0fc4b
6 changed files with 52 additions and 20 deletions

View file

@ -108,7 +108,6 @@ public class BlockSolarPanel extends BaseTileBlock {
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) { public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
for (EnumPanelType panelType : EnumPanelType.values()) { for (EnumPanelType panelType : EnumPanelType.values()) {
list.add(new ItemStack(this, 1, panelType.ordinal())); list.add(new ItemStack(this, 1, panelType.ordinal()));
System.out.println((new ItemStack(this, 1, panelType.ordinal())) + "daad");
} }

View file

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

View file

@ -30,8 +30,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.tile.IMachineSlotProvider; import reborncore.common.tile.IMachineSlotProvider;
@ -74,9 +74,9 @@ public class TileElectricFurnace extends TilePowerAcceptor
this.progress++; this.progress++;
if (this.progress % 10 == 0) { if (this.progress % 10 == 0) {
this.useEnergy(this.cost); this.useEnergy(getEuPerTick(this.cost));
} }
if (this.progress >= this.fuelScale) { if (this.progress >= Math.max((int) (fuelScale * (1.0 - getSpeedMultiplier())), 1)) {
this.progress = 0; this.progress = 0;
this.cookItems(); this.cookItems();
updateInventory = true; updateInventory = true;
@ -127,7 +127,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
} }
public boolean isBurning() { public boolean isBurning() {
return this.getEnergy() > this.cost; return this.getEnergy() > getEuPerTick(this.cost);
} }
public ItemStack getResultFor(final ItemStack stack) { public ItemStack getResultFor(final ItemStack stack) {
@ -224,8 +224,8 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override @Override
public BuiltContainer createContainer(final EntityPlayer player) { public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory() return new ContainerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue() .tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this); .syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
} }
@Override @Override
@ -245,6 +245,6 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override @Override
public boolean canBeUpgraded() { public boolean canBeUpgraded() {
return false; return true;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B