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) {
for (EnumPanelType panelType : EnumPanelType.values()) {
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;
public Inventory inventory = new Inventory(10, "TileAutoCraftingTable", 64, this);
public Inventory inventory = new Inventory(11, "TileAutoCraftingTable", 64, this);
public int progress;
public int maxProgress = 120;
public int euTick = 10;
@ -172,8 +172,16 @@ 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;
@ -186,7 +194,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
}
}
if (!missingOutput) {
if (hasOutputSpace(recipe.getRecipeOutput())) {
if (hasOutputSpace(recipe.getRecipeOutput(), 9)) {
return true;
}
}
@ -195,8 +203,17 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
return false;
}
public boolean hasOutputSpace(ItemStack output) {
ItemStack stack = inventory.getStackInSlot(9);
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);
if (stack.isEmpty()) {
return true;
}
@ -221,13 +238,14 @@ 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;
}
}
@ -247,6 +265,21 @@ 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);
@ -293,7 +326,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).syncEnergyValue()
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
.addInventory().create(this);
@ -417,11 +450,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 };
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
}
@Override
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.crafting.FurnaceRecipes;
import net.minecraft.util.EnumFacing;
import reborncore.api.tile.IInventoryProvider;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.tile.IMachineSlotProvider;
@ -63,7 +63,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override
public void update() {
if (world.isRemote){ return; }
super.update();
this.charge(2);
@ -74,9 +74,9 @@ public class TileElectricFurnace extends TilePowerAcceptor
this.progress++;
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.cookItems();
updateInventory = true;
@ -91,7 +91,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
if (updateInventory) {
this.markDirty();
}
}
public void cookItems() {
@ -127,7 +127,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
}
public boolean isBurning() {
return this.getEnergy() > this.cost;
return this.getEnergy() > getEuPerTick(this.cost);
}
public ItemStack getResultFor(final ItemStack stack) {
@ -224,8 +224,8 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
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()
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create(this);
}
@Override
@ -245,6 +245,6 @@ public class TileElectricFurnace extends TilePowerAcceptor
@Override
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