mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 14:34:28 +00:00
Farm upgrades. Fix some power display bugs. Fix CME in Crafter.
This commit is contained in:
1 parent
cfd32a7ef8
commit
78109e2b7d
6 files changed
+44
-30
No files matched your search
@@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
@@ -211,7 +212,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
|
||||
public int getEnergyStoredScaled(int scale) {
|
||||
// NB: called on the client so can't use the power provider
|
||||
return VecmathUtil.clamp(Math.round(scale * (storedEnergy / capacitorType.capacitor.getMaxEnergyStored())), 0, scale);
|
||||
return VecmathUtil.clamp(Math.round(scale * (storedEnergy / getCapacitor().getMaxEnergyStored())), 0, scale);
|
||||
}
|
||||
|
||||
public float getEnergyStored() {
|
||||
@@ -242,7 +243,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
}
|
||||
|
||||
public float getPowerUsePerTick() {
|
||||
return capacitorType.capacitor.getMaxEnergyExtracted();
|
||||
return getCapacitor().getMaxEnergyExtracted();
|
||||
}
|
||||
|
||||
// RF Power
|
||||
|
||||
@@ -16,8 +16,8 @@ public class SlotDefinition {
|
||||
this.maxInputSlot = numInputs - 1;
|
||||
this.minOutputSlot = numOutputs > 0 ? numInputs : -10;
|
||||
this.maxOutputSlot = minOutputSlot + (numOutputs - 1);
|
||||
this.minUpgradeSlot = -1;
|
||||
this.maxUpgradeSlot = -1;
|
||||
this.minUpgradeSlot = numUpgradeSlots > 0 ? numInputs + numOutputs : -1;
|
||||
this.maxUpgradeSlot = minUpgradeSlot + (numUpgradeSlots - 1);
|
||||
}
|
||||
|
||||
public SlotDefinition(int numInputs, int numOutputs) {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package crazypants.enderio.machine.crafter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -21,12 +19,12 @@ public class TileCrafter extends AbstractMachineEntity {
|
||||
|
||||
DummyCraftingGrid craftingGrid = new DummyCraftingGrid();
|
||||
|
||||
private Set<ItemStack> containerItems;
|
||||
private List<ItemStack> containerItems;
|
||||
|
||||
public TileCrafter() {
|
||||
super(new SlotDefinition(9, 1));
|
||||
|
||||
containerItems = new HashSet<ItemStack>();
|
||||
containerItems = new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,12 +65,13 @@ public class TileCrafter extends AbstractMachineEntity {
|
||||
|
||||
// process buffered container items
|
||||
if(!containerItems.isEmpty()) {
|
||||
for(ItemStack i : containerItems) {
|
||||
for(int i = 0; i < containerItems.size(); i++) {
|
||||
ItemStack stack = containerItems.get(i);
|
||||
if(inventory[9] == null) {
|
||||
inventory[9] = i;
|
||||
inventory[9] = stack;
|
||||
containerItems.remove(i);
|
||||
} else if(ItemStack.areItemStacksEqual(inventory[9], i) && inventory[9].stackSize + i.stackSize <= inventory[9].getMaxStackSize()) {
|
||||
inventory[9].stackSize += i.stackSize;
|
||||
} else if(ItemStack.areItemStacksEqual(inventory[9], stack) && inventory[9].stackSize + stack.stackSize <= inventory[9].getMaxStackSize()) {
|
||||
inventory[9].stackSize += stack.stackSize;
|
||||
containerItems.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,4 @@ public class GuiFarmStation extends GuiMachineBase {
|
||||
protected boolean showRecipeButton() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected int getPowerHeight() {
|
||||
return 57;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -45,19 +45,21 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*implements IEnt
|
||||
|
||||
private int minSupSlot = maxToolSlot + 1;
|
||||
private int maxSupSlot = minSupSlot + 4;
|
||||
|
||||
private final int upgradeBonusSize = 2;
|
||||
|
||||
private static final DummyTask TASK = new DummyTask();
|
||||
|
||||
private ICapacitor cap = new BasicCapacitor(200,25000);
|
||||
|
||||
public TileFarmStation() {
|
||||
super(new SlotDefinition(6, 4, 0));
|
||||
super(new SlotDefinition(6, 4, 1));
|
||||
currentTask = TASK;
|
||||
powerHandler = PowerHandlerUtil.createHandler(cap, this, Type.MACHINE);
|
||||
}
|
||||
|
||||
public int getFarmSize() {
|
||||
return farmSize;
|
||||
return farmSize + getUpgradeDist();
|
||||
}
|
||||
|
||||
public void setFarmSize(int farmSize) {
|
||||
@@ -65,7 +67,7 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*implements IEnt
|
||||
}
|
||||
|
||||
public void actionPerformed() {
|
||||
usePower(Config.farmActionEnergyUse);
|
||||
usePower(Config.farmActionEnergyUse * (getUpgradeDist() * upgradeBonusSize));
|
||||
}
|
||||
|
||||
public int getMaxLootingValue() {
|
||||
@@ -80,6 +82,15 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*implements IEnt
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getUpgradeDist() {
|
||||
int upg = slotDefinition.getMaxUpgradeSlot();
|
||||
if (inventory[upg] == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return upgradeBonusSize * inventory[upg].getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
public void damageMaxLootingItem(int damage, BlockCoord bc, Block block) {
|
||||
int maxLooting = -1;
|
||||
@@ -363,18 +374,20 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*implements IEnt
|
||||
|
||||
private BlockCoord getNextCoord() {
|
||||
|
||||
int size = getFarmSize();
|
||||
|
||||
BlockCoord loc = getLocation();
|
||||
if(lastScanned == null) {
|
||||
lastScanned = new BlockCoord(loc.x - farmSize, loc.y, loc.z - farmSize);
|
||||
lastScanned = new BlockCoord(loc.x - size, loc.y, loc.z - size);
|
||||
return lastScanned;
|
||||
}
|
||||
|
||||
int nextX = lastScanned.x + 1;
|
||||
int nextZ = lastScanned.z;
|
||||
if(nextX > loc.x + farmSize) {
|
||||
nextX = loc.x - farmSize;
|
||||
if(nextX > loc.x + size) {
|
||||
nextX = loc.x - size;
|
||||
nextZ += 1;
|
||||
if(nextZ > loc.z + farmSize) {
|
||||
if(nextZ > loc.z + size) {
|
||||
lastScanned = null;
|
||||
return getNextCoord();
|
||||
}
|
||||
@@ -404,13 +417,20 @@ public class TileFarmStation extends AbstractPoweredTaskEntity /*implements IEnt
|
||||
|
||||
@Override
|
||||
public void setCapacitor(Capacitors capacitorType) {
|
||||
//no support for capacitor upgrades
|
||||
// powerHandler = PowerHandlerUtil.createHandler(cap, this, Type.MACHINE);
|
||||
// powerHandler.setEnergy(storedEnergy);
|
||||
switch(capacitorType.ordinal()) {
|
||||
case 1:
|
||||
cap = new BasicCapacitor(400,50000);
|
||||
break;
|
||||
case 2:
|
||||
cap = new BasicCapacitor(1000,250000,20);
|
||||
break;
|
||||
default:
|
||||
cap = new BasicCapacitor(200,25000,50);
|
||||
break;
|
||||
}
|
||||
powerHandler.configure(cap.getMinEnergyReceived(), cap.getMaxEnergyReceived(), cap.getMinActivationEnergy(), cap.getMaxEnergyStored());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ICapacitor getCapacitor() {
|
||||
return cap;
|
||||
|
||||
Reference in new issue
Block a user