mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Upgrade rework, now with 3463% more caching!
(it was slow and needed a redo)
This commit is contained in:
parent
42e200ac7a
commit
e38ce02ccf
@ -1,50 +0,0 @@
|
|||||||
package com.hbm.inventory;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import com.hbm.interfaces.Untested;
|
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
public class UpgradeManager {
|
|
||||||
|
|
||||||
private static HashMap<UpgradeType, Integer> upgrades = new HashMap();
|
|
||||||
private static UpgradeType mutexType = null;
|
|
||||||
|
|
||||||
@Untested
|
|
||||||
public static void eval(ItemStack[] slots, int start, int end) {
|
|
||||||
|
|
||||||
upgrades.clear();
|
|
||||||
|
|
||||||
for(int i = start; i <= end; i++) {
|
|
||||||
|
|
||||||
if(slots[i] != null && slots[i].getItem() instanceof ItemMachineUpgrade) {
|
|
||||||
ItemMachineUpgrade item = (ItemMachineUpgrade) slots[i].getItem();
|
|
||||||
|
|
||||||
if(item.type.mutex) {
|
|
||||||
|
|
||||||
if(mutexType == null || mutexType.ordinal() < item.type.ordinal()) {
|
|
||||||
mutexType = item.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Integer up = upgrades.get(item.type);
|
|
||||||
int upgrade = (up == null ? 0 : up);
|
|
||||||
upgrade += item.tier;
|
|
||||||
upgrades.put(item.type, upgrade);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getLevel(UpgradeType type) {
|
|
||||||
Integer up = upgrades.get(type);
|
|
||||||
return up == null ? 0 : up;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UpgradeType getMinerMutex() {
|
|
||||||
return mutexType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
80
src/main/java/com/hbm/inventory/UpgradeManagerNT.java
Normal file
80
src/main/java/com/hbm/inventory/UpgradeManagerNT.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.hbm.inventory;
|
||||||
|
|
||||||
|
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||||
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
|
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Steps for use:
|
||||||
|
1. TE implements IUpgradeInfoProvider
|
||||||
|
2. TE creates a new instance of UpgradeManagerNT
|
||||||
|
3. Upgrades and their levels can then be pulled from there.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upgrade system, now with caching!
|
||||||
|
* @author BallOfEnergy1
|
||||||
|
*/
|
||||||
|
public class UpgradeManagerNT {
|
||||||
|
|
||||||
|
public ItemStack[] cachedSlots;
|
||||||
|
|
||||||
|
private UpgradeType mutexType;
|
||||||
|
public HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
|
|
||||||
|
public void checkSlots(TileEntity te, ItemStack[] slots, int start, int end) {
|
||||||
|
|
||||||
|
if(!(te instanceof IUpgradeInfoProvider) || slots == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemStack[] upgradeSlots = Arrays.copyOfRange(slots, start, end + 1);
|
||||||
|
|
||||||
|
if(Arrays.equals(upgradeSlots, cachedSlots))
|
||||||
|
return;
|
||||||
|
|
||||||
|
cachedSlots = upgradeSlots.clone();
|
||||||
|
|
||||||
|
upgrades.clear();
|
||||||
|
|
||||||
|
for (int i = 0; i <= end - start; i++) {
|
||||||
|
|
||||||
|
if(upgradeSlots[i] != null && upgradeSlots[i].getItem() instanceof ItemMachineUpgrade) {
|
||||||
|
|
||||||
|
ItemMachineUpgrade item = (ItemMachineUpgrade) upgradeSlots[i].getItem();
|
||||||
|
IUpgradeInfoProvider upgradable = (IUpgradeInfoProvider) te;
|
||||||
|
|
||||||
|
if(upgradable.getValidUpgrades() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (upgradable.getValidUpgrades().containsKey(item.type)) { // Check if upgrade can even be accepted by the machine.
|
||||||
|
if (item.type.mutex) {
|
||||||
|
if (mutexType == null) {
|
||||||
|
upgrades.put(item.type, 1);
|
||||||
|
mutexType = item.type;
|
||||||
|
} else if(item.type.ordinal() > mutexType.ordinal()) {
|
||||||
|
upgrades.remove(mutexType);
|
||||||
|
upgrades.put(item.type, 1);
|
||||||
|
mutexType = item.type;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Integer levelBefore = upgrades.get(item.type);
|
||||||
|
int upgradeLevel = (levelBefore == null ? 0 : levelBefore);
|
||||||
|
upgradeLevel += item.tier;
|
||||||
|
// Add additional check to make sure it doesn't go over the max.
|
||||||
|
upgrades.put(item.type, Math.min(upgradeLevel, upgradable.getValidUpgrades().get(item.type)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLevel(UpgradeType type) {
|
||||||
|
return upgrades.getOrDefault(type, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -69,7 +69,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
|
|||||||
|
|
||||||
for(UpgradeType type : UpgradeType.values()) {
|
for(UpgradeType type : UpgradeType.values()) {
|
||||||
if(provider.canProvideInfo(type, 0, false)) {
|
if(provider.canProvideInfo(type, 0, false)) {
|
||||||
int maxLevel = provider.getMaxLevel(type);
|
int maxLevel = provider.getValidUpgrades().get(type);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SPEED: lines.add(I18nUtil.resolveKey("upgrade.gui.speed", maxLevel)); break;
|
case SPEED: lines.add(I18nUtil.resolveKey("upgrade.gui.speed", maxLevel)); break;
|
||||||
case POWER: lines.add(I18nUtil.resolveKey("upgrade.gui.power", maxLevel)); break;
|
case POWER: lines.add(I18nUtil.resolveKey("upgrade.gui.power", maxLevel)); break;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity;
|
package com.hbm.tileentity;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
@ -13,7 +14,7 @@ public interface IUpgradeInfoProvider {
|
|||||||
/** If any of the automated display stuff should be applied for this upgrade. A level of 0 is used by the GUI's indicator, as opposed to the item tooltips */
|
/** If any of the automated display stuff should be applied for this upgrade. A level of 0 is used by the GUI's indicator, as opposed to the item tooltips */
|
||||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo);
|
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo);
|
||||||
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo);
|
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo);
|
||||||
public int getMaxLevel(UpgradeType type);
|
public HashMap<UpgradeType, Integer> getValidUpgrades();
|
||||||
|
|
||||||
public static String getStandardLabel(Block block) {
|
public static String getStandardLabel(Block block) {
|
||||||
return EnumChatFormatting.GREEN.YELLOW + ">>> " + I18nUtil.resolveKey(block.getUnlocalizedName() + ".name") + " <<<";
|
return EnumChatFormatting.GREEN.YELLOW + ">>> " + I18nUtil.resolveKey(block.getUnlocalizedName() + ".name") + " <<<";
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerElectrolyserFluid;
|
import com.hbm.inventory.container.ContainerElectrolyserFluid;
|
||||||
import com.hbm.inventory.container.ContainerElectrolyserMetal;
|
import com.hbm.inventory.container.ContainerElectrolyserMetal;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -68,6 +69,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
|
|
||||||
public FluidTank[] tanks;
|
public FluidTank[] tanks;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityElectrolyser() {
|
public TileEntityElectrolyser() {
|
||||||
//0: Battery
|
//0: Battery
|
||||||
//1-2: Upgrades
|
//1-2: Upgrades
|
||||||
@ -129,9 +132,9 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 2);
|
upgradeManager.checkSlots(this, slots, 1, 2);
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
usageOre = usageOreBase - usageOreBase * powerLevel / 4;
|
usageOre = usageOreBase - usageOreBase * powerLevel / 4;
|
||||||
usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4;
|
usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4;
|
||||||
@ -390,19 +393,19 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
public int getDurationMetal() {
|
public int getDurationMetal() {
|
||||||
ElectrolysisMetalRecipe result = ElectrolyserMetalRecipes.getRecipe(slots[14]);
|
ElectrolysisMetalRecipe result = ElectrolyserMetalRecipes.getRecipe(slots[14]);
|
||||||
int base = result != null ? result.duration : 600;
|
int base = result != null ? result.duration : 600;
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED) - upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
||||||
}
|
}
|
||||||
public int getDurationFluid() {
|
public int getDurationFluid() {
|
||||||
ElectrolysisRecipe result = ElectrolyserFluidRecipes.getRecipe(tanks[0].getTankType());
|
ElectrolysisRecipe result = ElectrolyserFluidRecipes.getRecipe(tanks[0].getTankType());
|
||||||
int base = result != null ? result.duration : 100;
|
int base = result != null ? result.duration : 100;
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED) - upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCycleCount() {
|
public int getCycleCount() {
|
||||||
int speed = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int speed = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
return Math.min(1 + speed * 2, 7);
|
return Math.min(1 + speed * 2, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,11 +551,12 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.pollution.PollutionHandler;
|
import com.hbm.handler.pollution.PollutionHandler;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerFurnaceIron;
|
import com.hbm.inventory.container.ContainerFurnaceIron;
|
||||||
import com.hbm.inventory.gui.GUIFurnaceIron;
|
import com.hbm.inventory.gui.GUIFurnaceIron;
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
@ -40,6 +41,8 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
|
|
||||||
public ModuleBurnTime burnModule;
|
public ModuleBurnTime burnModule;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityFurnaceIron() {
|
public TileEntityFurnaceIron() {
|
||||||
super(5);
|
super(5);
|
||||||
|
|
||||||
@ -62,8 +65,8 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 4, 4);
|
upgradeManager.checkSlots(this, slots, 4, 4);
|
||||||
this.processingTime = baseTime - ((baseTime / 2) * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) / 3);
|
this.processingTime = baseTime - ((baseTime / 2) * upgradeManager.getLevel(UpgradeType.SPEED) / 3);
|
||||||
|
|
||||||
wasOn = false;
|
wasOn = false;
|
||||||
|
|
||||||
@ -260,8 +263,9 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
return 0;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.pollution.PollutionHandler;
|
import com.hbm.handler.pollution.PollutionHandler;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineArcFurnaceLarge;
|
import com.hbm.inventory.container.ContainerMachineArcFurnaceLarge;
|
||||||
import com.hbm.inventory.gui.GUIMachineArcFurnaceLarge;
|
import com.hbm.inventory.gui.GUIMachineArcFurnaceLarge;
|
||||||
import com.hbm.inventory.material.MaterialShapes;
|
import com.hbm.inventory.material.MaterialShapes;
|
||||||
@ -65,6 +66,8 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl
|
|||||||
private AudioWrapper audioLid;
|
private AudioWrapper audioLid;
|
||||||
private AudioWrapper audioProgress;
|
private AudioWrapper audioProgress;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public byte[] electrodes = new byte[3];
|
public byte[] electrodes = new byte[3];
|
||||||
public static final byte ELECTRODE_NONE = 0;
|
public static final byte ELECTRODE_NONE = 0;
|
||||||
public static final byte ELECTRODE_FRESH = 1;
|
public static final byte ELECTRODE_FRESH = 1;
|
||||||
@ -99,8 +102,8 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl
|
|||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 4, 4);
|
upgradeManager.checkSlots(this, slots, 4, 4);
|
||||||
this.upgrade = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
this.upgrade = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
@ -580,8 +583,10 @@ public class TileEntityMachineArcFurnaceLarge extends TileEntityMachineBase impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
return 0;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineArcWelder;
|
import com.hbm.inventory.container.ContainerMachineArcWelder;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -49,6 +50,8 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
|
|||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
public ItemStack display;
|
public ItemStack display;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineArcWelder() {
|
public TileEntityMachineArcWelder() {
|
||||||
super(8);
|
super(8);
|
||||||
this.tank = new FluidTank(Fluids.NONE, 24_000);
|
this.tank = new FluidTank(Fluids.NONE, 24_000);
|
||||||
@ -86,9 +89,9 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
|
|||||||
ArcWelderRecipe recipe = ArcWelderRecipes.getRecipe(slots[0], slots[1], slots[2]);
|
ArcWelderRecipe recipe = ArcWelderRecipes.getRecipe(slots[0], slots[1], slots[2]);
|
||||||
long intendedMaxPower;
|
long intendedMaxPower;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 6, 7);
|
upgradeManager.checkSlots(this, slots, 6, 7);
|
||||||
int redLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int redLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int blueLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int blueLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
if(recipe != null) {
|
if(recipe != null) {
|
||||||
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
|
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
|
||||||
@ -383,10 +386,11 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineAssembler;
|
import com.hbm.inventory.container.ContainerMachineAssembler;
|
||||||
import com.hbm.inventory.gui.GUIMachineAssembler;
|
import com.hbm.inventory.gui.GUIMachineAssembler;
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
@ -34,6 +35,8 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i
|
|||||||
|
|
||||||
public int recipe = -1;
|
public int recipe = -1;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
public TileEntityMachineAssembler() {
|
public TileEntityMachineAssembler() {
|
||||||
@ -89,11 +92,11 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i
|
|||||||
this.consumption = 100;
|
this.consumption = 100;
|
||||||
this.speed = 100;
|
this.speed = 100;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 3);
|
upgradeManager.checkSlots(this, slots, 1, 3);
|
||||||
|
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
speed -= speedLevel * 25;
|
speed -= speedLevel * 25;
|
||||||
consumption += speedLevel * 300;
|
consumption += speedLevel * 300;
|
||||||
@ -289,10 +292,11 @@ public class TileEntityMachineAssembler extends TileEntityMachineAssemblerBase i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 9;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerAssemfac;
|
import com.hbm.inventory.container.ContainerAssemfac;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -37,6 +38,8 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
|||||||
public FluidTank water;
|
public FluidTank water;
|
||||||
public FluidTank steam;
|
public FluidTank steam;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineAssemfac() {
|
public TileEntityMachineAssemfac() {
|
||||||
super(14 * 8 + 4 + 1); //8 assembler groups with 14 slots, 4 upgrade slots, 1 battery slot
|
super(14 * 8 + 4 + 1); //8 assembler groups with 14 slots, 4 upgrade slots, 1 battery slot
|
||||||
|
|
||||||
@ -76,11 +79,11 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
|||||||
this.speed = 100;
|
this.speed = 100;
|
||||||
this.consumption = 100;
|
this.consumption = 100;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 4);
|
upgradeManager.checkSlots(this, slots, 1, 4);
|
||||||
|
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.speed -= speedLevel * 15;
|
this.speed -= speedLevel * 15;
|
||||||
this.consumption += speedLevel * 300;
|
this.consumption += speedLevel * 300;
|
||||||
@ -456,11 +459,12 @@ public class TileEntityMachineAssemfac extends TileEntityMachineAssemblerBase im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 6;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 6);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 12;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 12);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerCentrifuge;
|
import com.hbm.inventory.container.ContainerCentrifuge;
|
||||||
import com.hbm.inventory.gui.GUIMachineCentrifuge;
|
import com.hbm.inventory.gui.GUIMachineCentrifuge;
|
||||||
import com.hbm.inventory.recipes.CentrifugeRecipes;
|
import com.hbm.inventory.recipes.CentrifugeRecipes;
|
||||||
@ -51,6 +52,8 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
|||||||
public static int processingSpeed = 200;
|
public static int processingSpeed = 200;
|
||||||
public static int baseConsumption = 200;
|
public static int baseConsumption = 200;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public String getConfigName() {
|
public String getConfigName() {
|
||||||
return "centrifuge";
|
return "centrifuge";
|
||||||
}
|
}
|
||||||
@ -188,14 +191,14 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
|||||||
int consumption = baseConsumption;
|
int consumption = baseConsumption;
|
||||||
int speed = 1;
|
int speed = 1;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 6, 7);
|
upgradeManager.checkSlots(this, slots, 6, 7);
|
||||||
speed += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
speed += upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
consumption += Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) * baseConsumption;
|
consumption += upgradeManager.getLevel(UpgradeType.SPEED) * baseConsumption;
|
||||||
|
|
||||||
speed *= (1 + Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 5);
|
speed *= (1 + upgradeManager.getLevel(UpgradeType.OVERDRIVE) * 5);
|
||||||
consumption += Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * baseConsumption * 50;
|
consumption += upgradeManager.getLevel(UpgradeType.OVERDRIVE) * baseConsumption * 50;
|
||||||
|
|
||||||
consumption /= (1 + Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3));
|
consumption /= (1 + upgradeManager.getLevel(UpgradeType.POWER));
|
||||||
|
|
||||||
if(hasPower() && isProcessing()) {
|
if(hasPower() && isProcessing()) {
|
||||||
this.power -= consumption;
|
this.power -= consumption;
|
||||||
@ -369,11 +372,12 @@ public class TileEntityMachineCentrifuge extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerChemfac;
|
import com.hbm.inventory.container.ContainerChemfac;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -41,6 +42,8 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
|
|||||||
public FluidTank water;
|
public FluidTank water;
|
||||||
public FluidTank steam;
|
public FluidTank steam;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineChemfac() {
|
public TileEntityMachineChemfac() {
|
||||||
super(77);
|
super(77);
|
||||||
|
|
||||||
@ -85,11 +88,11 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
|
|||||||
this.speed = 100;
|
this.speed = 100;
|
||||||
this.consumption = 100;
|
this.consumption = 100;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 4);
|
upgradeManager.checkSlots(this, slots, 1, 4);
|
||||||
|
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 6);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.speed -= speedLevel * 15;
|
this.speed -= speedLevel * 15;
|
||||||
this.consumption += speedLevel * 300;
|
this.consumption += speedLevel * 300;
|
||||||
@ -383,11 +386,12 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 6;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 6);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 12;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 12);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineChemplant;
|
import com.hbm.inventory.container.ContainerMachineChemplant;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -58,6 +59,8 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
|||||||
int consumption = 100;
|
int consumption = 100;
|
||||||
int speed = 100;
|
int speed = 100;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineChemplant() {
|
public TileEntityMachineChemplant() {
|
||||||
super(21);
|
super(21);
|
||||||
/*
|
/*
|
||||||
@ -128,11 +131,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
|||||||
if(tanks[3].getFill() > 0) this.sendFluid(tanks[3], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
if(tanks[3].getFill() > 0) this.sendFluid(tanks[3], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 3);
|
upgradeManager.checkSlots(this, slots, 1, 3);
|
||||||
|
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.speed -= speedLevel * 25;
|
this.speed -= speedLevel * 25;
|
||||||
this.consumption += speedLevel * 300;
|
this.consumption += speedLevel * 300;
|
||||||
@ -601,10 +604,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 9;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 9);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerCompressor;
|
import com.hbm.inventory.container.ContainerCompressor;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -15,10 +16,7 @@ import com.hbm.inventory.recipes.CompressorRecipes.CompressorRecipe;
|
|||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.IFluidCopiable;
|
import com.hbm.tileentity.*;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
|
||||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
import com.hbm.util.Tuple.Pair;
|
import com.hbm.util.Tuple.Pair;
|
||||||
@ -56,6 +54,8 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
|||||||
public float prevPiston;
|
public float prevPiston;
|
||||||
public boolean pistonDir;
|
public boolean pistonDir;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineCompressor() {
|
public TileEntityMachineCompressor() {
|
||||||
super(4);
|
super(4);
|
||||||
this.tanks = new FluidTank[2];
|
this.tanks = new FluidTank[2];
|
||||||
@ -81,11 +81,11 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
|||||||
this.tanks[0].setType(0, slots);
|
this.tanks[0].setType(0, slots);
|
||||||
this.setupTanks();
|
this.setupTanks();
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 3);
|
upgradeManager.checkSlots(this, slots, 1, 3);
|
||||||
|
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
CompressorRecipe rec = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure()));
|
CompressorRecipe rec = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure()));
|
||||||
int timeBase = this.processTimeBase;
|
int timeBase = this.processTimeBase;
|
||||||
@ -365,11 +365,12 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 9;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 9);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.extprop.HbmPlayerProps;
|
import com.hbm.extprop.HbmPlayerProps;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerCrystallizer;
|
import com.hbm.inventory.container.ContainerCrystallizer;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -15,10 +16,7 @@ import com.hbm.items.machine.ItemMachineUpgrade;
|
|||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.IFluidCopiable;
|
import com.hbm.tileentity.*;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
|
||||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
@ -53,6 +51,8 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineCrystallizer() {
|
public TileEntityMachineCrystallizer() {
|
||||||
super(8);
|
super(8);
|
||||||
tank = new FluidTank(Fluids.PEROXIDE, 8000);
|
tank = new FluidTank(Fluids.PEROXIDE, 8000);
|
||||||
@ -76,7 +76,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
tank.setType(7, slots);
|
tank.setType(7, slots);
|
||||||
tank.loadTank(3, 4, slots);
|
tank.loadTank(3, 4, slots);
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 5, 6);
|
upgradeManager.checkSlots(this, slots, 5, 6);
|
||||||
|
|
||||||
for(int i = 0; i < getCycleCount(); i++) {
|
for(int i = 0; i < getCycleCount(); i++) {
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredAcid(int base) {
|
public int getRequiredAcid(int base) {
|
||||||
int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
if(efficiency > 0) {
|
if(efficiency > 0) {
|
||||||
return base * (efficiency + 2);
|
return base * (efficiency + 2);
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getFreeChance() {
|
public float getFreeChance() {
|
||||||
int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
if(efficiency > 0) {
|
if(efficiency > 0) {
|
||||||
return Math.min(efficiency * 0.05F, 0.15F);
|
return Math.min(efficiency * 0.05F, 0.15F);
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
public short getDuration() {
|
public short getDuration() {
|
||||||
CrystallizerRecipe result = CrystallizerRecipes.getOutput(slots[0], tank.getTankType());
|
CrystallizerRecipe result = CrystallizerRecipes.getOutput(slots[0], tank.getTankType());
|
||||||
int base = result != null ? result.duration : 600;
|
int base = result != null ? result.duration : 600;
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
if(speed > 0) {
|
if(speed > 0) {
|
||||||
return (short) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.25F)));
|
return (short) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.25F)));
|
||||||
}
|
}
|
||||||
@ -252,12 +252,12 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPowerRequired() {
|
public int getPowerRequired() {
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
return (int) (demand + Math.min(speed * 1000, 3000));
|
return (int) (demand + Math.min(speed * 1000, 3000));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCycleCount() {
|
public float getCycleCount() {
|
||||||
int speed = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int speed = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
return Math.min(1 + speed * 2, 7);
|
return Math.min(1 + speed * 2, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,11 +388,12 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.EFFECT) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.EFFECT, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||||
import com.hbm.inventory.container.ContainerMachineCyclotron;
|
import com.hbm.inventory.container.ContainerMachineCyclotron;
|
||||||
@ -51,6 +52,8 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
public FluidTank[] tanks;
|
public FluidTank[] tanks;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineCyclotron() {
|
public TileEntityMachineCyclotron() {
|
||||||
super(12);
|
super(12);
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
this.power = Library.chargeTEFromItems(slots, 9, power, maxPower);
|
this.power = Library.chargeTEFromItems(slots, 9, power, maxPower);
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 10, 11);
|
upgradeManager.checkSlots(this, slots, 10, 11);
|
||||||
|
|
||||||
if(canProcess()) {
|
if(canProcess()) {
|
||||||
progress += getSpeed();
|
progress += getSpeed();
|
||||||
@ -226,17 +229,17 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpeed() {
|
public int getSpeed() {
|
||||||
return Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) + 1;
|
return upgradeManager.getLevel(UpgradeType.SPEED) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getConsumption() {
|
public int getConsumption() {
|
||||||
int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int efficiency = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
return consumption - 100_000 * efficiency;
|
return consumption - 100_000 * efficiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCoolantConsumption() {
|
public int getCoolantConsumption() {
|
||||||
int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
//half a small tower's worth
|
//half a small tower's worth
|
||||||
return 500 / (efficiency + 1) * getSpeed();
|
return 500 / (efficiency + 1) * getSpeed();
|
||||||
}
|
}
|
||||||
@ -417,11 +420,12 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.EFFECT) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.EFFECT, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineEPress;
|
import com.hbm.inventory.container.ContainerMachineEPress;
|
||||||
import com.hbm.inventory.gui.GUIMachineEPress;
|
import com.hbm.inventory.gui.GUIMachineEPress;
|
||||||
import com.hbm.inventory.recipes.PressRecipes;
|
import com.hbm.inventory.recipes.PressRecipes;
|
||||||
@ -47,6 +48,8 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
|||||||
|
|
||||||
public ItemStack syncStack;
|
public ItemStack syncStack;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineEPress() {
|
public TileEntityMachineEPress() {
|
||||||
super(5);
|
super(5);
|
||||||
}
|
}
|
||||||
@ -72,8 +75,8 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
|||||||
|
|
||||||
if(delay <= 0) {
|
if(delay <= 0) {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 4, 4);
|
upgradeManager.checkSlots(this, slots, 4, 4);
|
||||||
int speed = 1 + Math.min(3, UpgradeManager.getLevel(UpgradeType.SPEED));
|
int speed = 1 + upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
|
|
||||||
int stampSpeed = this.isRetracting ? 20 : 45;
|
int stampSpeed = this.isRetracting ? 20 : 45;
|
||||||
stampSpeed *= (1D + (double) speed / 4D);
|
stampSpeed *= (1D + (double) speed / 4D);
|
||||||
@ -277,9 +280,10 @@ public class TileEntityMachineEPress extends TileEntityMachineBase implements IE
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
return 0;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.blocks.machine.MachineElectricFurnace;
|
import com.hbm.blocks.machine.MachineElectricFurnace;
|
||||||
import com.hbm.handler.pollution.PollutionHandler;
|
import com.hbm.handler.pollution.PollutionHandler;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerElectricFurnace;
|
import com.hbm.inventory.container.ContainerElectricFurnace;
|
||||||
import com.hbm.inventory.gui.GUIMachineElectricFurnace;
|
import com.hbm.inventory.gui.GUIMachineElectricFurnace;
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
|
||||||
@ -44,6 +45,8 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
|||||||
|
|
||||||
private static final int[] slots_io = new int[] { 0, 1, 2 };
|
private static final int[] slots_io = new int[] { 0, 1, 2 };
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineElectricFurnace() {
|
public TileEntityMachineElectricFurnace() {
|
||||||
super(4);
|
super(4);
|
||||||
}
|
}
|
||||||
@ -179,10 +182,10 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
|||||||
this.consumption = 50;
|
this.consumption = 50;
|
||||||
this.maxProgress = 100;
|
this.maxProgress = 100;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 3, 3);
|
upgradeManager.checkSlots(this, slots, 3, 3);
|
||||||
|
|
||||||
int speedLevel = UpgradeManager.getLevel(UpgradeType.SPEED);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = UpgradeManager.getLevel(UpgradeType.POWER);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
maxProgress -= speedLevel * 25;
|
maxProgress -= speedLevel * 25;
|
||||||
consumption += speedLevel * 50;
|
consumption += speedLevel * 50;
|
||||||
@ -298,9 +301,10 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,7 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
@ -12,7 +9,7 @@ import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
|
|||||||
import com.hbm.blocks.network.CraneInserter;
|
import com.hbm.blocks.network.CraneInserter;
|
||||||
import com.hbm.entity.item.EntityMovingItem;
|
import com.hbm.entity.item.EntityMovingItem;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineExcavator;
|
import com.hbm.inventory.container.ContainerMachineExcavator;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -90,6 +87,8 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineExcavator() {
|
public TileEntityMachineExcavator() {
|
||||||
super(14);
|
super(14);
|
||||||
this.tank = new FluidTank(Fluids.SULFURIC_ACID, 16_000);
|
this.tank = new FluidTank(Fluids.SULFURIC_ACID, 16_000);
|
||||||
@ -104,9 +103,9 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
|||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
//needs to happen on client too for GUI rendering
|
//needs to happen on client too for GUI rendering
|
||||||
UpgradeManager.eval(slots, 2, 3);
|
upgradeManager.checkSlots(this, slots, 2, 3);
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
consumption = baseConsumption * (1 + speedLevel);
|
consumption = baseConsumption * (1 + speedLevel);
|
||||||
consumption /= (1 + powerLevel);
|
consumption /= (1 + powerLevel);
|
||||||
@ -128,7 +127,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
this.power = Library.chargeTEFromItems(slots, 0, this.getPower(), this.getMaxPower());
|
this.power = Library.chargeTEFromItems(slots, 0, this.getPower(), this.getMaxPower());
|
||||||
this.operational = false;
|
this.operational = false;
|
||||||
int radiusLevel = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int radiusLevel = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
|
|
||||||
EnumDrillType type = this.getInstalledDrill();
|
EnumDrillType type = this.getInstalledDrill();
|
||||||
if(this.enableDrill && type != null && this.power >= this.getPowerConsumption()) {
|
if(this.enableDrill && type != null && this.power >= this.getPowerConsumption()) {
|
||||||
@ -874,10 +873,11 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineExposureChamber;
|
import com.hbm.inventory.container.ContainerMachineExposureChamber;
|
||||||
import com.hbm.inventory.gui.GUIMachineExposureChamber;
|
import com.hbm.inventory.gui.GUIMachineExposureChamber;
|
||||||
import com.hbm.inventory.recipes.ExposureChamberRecipes;
|
import com.hbm.inventory.recipes.ExposureChamberRecipes;
|
||||||
@ -46,6 +47,8 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
|
|||||||
public float rotation;
|
public float rotation;
|
||||||
public float prevRotation;
|
public float prevRotation;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
@ -92,10 +95,10 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
|
|||||||
for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
for(DirPos pos : getConPos()) this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 6, 7);
|
upgradeManager.checkSlots(this, slots, 6, 7);
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overdriveLevel = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
|
int overdriveLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.consumption = this.consumptionBase;
|
this.consumption = this.consumptionBase;
|
||||||
|
|
||||||
@ -337,10 +340,11 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMiningLaser;
|
import com.hbm.inventory.container.ContainerMiningLaser;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -69,6 +70,8 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
boolean lock = false;
|
boolean lock = false;
|
||||||
double breakProgress;
|
double breakProgress;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineMiningLaser() {
|
public TileEntityMachineMiningLaser() {
|
||||||
|
|
||||||
//slot 0: battery
|
//slot 0: battery
|
||||||
@ -112,14 +115,14 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
|
|
||||||
if(isOn) {
|
if(isOn) {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 1, 8);
|
upgradeManager.checkSlots(this, slots, 1, 8);
|
||||||
int cycles = 1 + UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int cycles = 1 + upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
int speed = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12);
|
int speed = 1 + upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int range = 1 + Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT) * 2, 24);
|
int range = 1 + upgradeManager.getLevel(UpgradeType.EFFECT) * 2;
|
||||||
int fortune = Math.min(UpgradeManager.getLevel(UpgradeType.FORTUNE), 3);
|
int fortune = upgradeManager.getLevel(UpgradeType.FORTUNE);
|
||||||
int consumption = this.consumption
|
int consumption = this.consumption
|
||||||
- (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 12) / 16)
|
- (this.consumption * upgradeManager.getLevel(UpgradeType.POWER) / 16)
|
||||||
+ (this.consumption * Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 12) / 16);
|
+ (this.consumption * upgradeManager.getLevel(UpgradeType.SPEED) / 16);
|
||||||
|
|
||||||
for(int i = 0; i < cycles; i++) {
|
for(int i = 0; i < cycles; i++) {
|
||||||
|
|
||||||
@ -678,12 +681,13 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 12;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 12;
|
upgrades.put(UpgradeType.SPEED, 12);
|
||||||
if(type == UpgradeType.EFFECT) return 12;
|
upgrades.put(UpgradeType.POWER, 12);
|
||||||
if(type == UpgradeType.FORTUNE) return 3;
|
upgrades.put(UpgradeType.EFFECT, 12);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 9;
|
upgrades.put(UpgradeType.FORTUNE, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 9);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMixer;
|
import com.hbm.inventory.container.ContainerMixer;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -47,6 +48,8 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements ICo
|
|||||||
|
|
||||||
public FluidTank[] tanks;
|
public FluidTank[] tanks;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineMixer() {
|
public TileEntityMachineMixer() {
|
||||||
super(5);
|
super(5);
|
||||||
this.tanks = new FluidTank[3];
|
this.tanks = new FluidTank[3];
|
||||||
@ -68,10 +71,10 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements ICo
|
|||||||
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||||
tanks[2].setType(2, slots);
|
tanks[2].setType(2, slots);
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 3, 4);
|
upgradeManager.checkSlots(this, slots, 3, 4);
|
||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overLevel = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
int overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.consumption = 50;
|
this.consumption = 50;
|
||||||
|
|
||||||
@ -350,11 +353,12 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements ICo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 6;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 6);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerOreSlopper;
|
import com.hbm.inventory.container.ContainerOreSlopper;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -73,6 +74,8 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement
|
|||||||
public FluidTank[] tanks;
|
public FluidTank[] tanks;
|
||||||
public double[] ores = new double[BedrockOreType.values().length];
|
public double[] ores = new double[BedrockOreType.values().length];
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineOreSlopper() {
|
public TileEntityMachineOreSlopper() {
|
||||||
super(11);
|
super(11);
|
||||||
tanks = new FluidTank[2];
|
tanks = new FluidTank[2];
|
||||||
@ -110,9 +113,9 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 9, 10);
|
upgradeManager.checkSlots(this, slots, 9, 10);
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int efficiency = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int efficiency = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
|
|
||||||
this.consumption = this.consumptionBase + (this.consumptionBase * speed) / 2 + (this.consumptionBase * efficiency);
|
this.consumption = this.consumptionBase + (this.consumptionBase * speed) / 2 + (this.consumptionBase * efficiency);
|
||||||
|
|
||||||
@ -399,9 +402,10 @@ public class TileEntityMachineOreSlopper extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.EFFECT) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.EFFECT, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.RecipesCommon.AStack;
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
import com.hbm.inventory.container.ContainerMachineSolderingStation;
|
import com.hbm.inventory.container.ContainerMachineSolderingStation;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -53,6 +54,8 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
public ItemStack display;
|
public ItemStack display;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineSolderingStation() {
|
public TileEntityMachineSolderingStation() {
|
||||||
super(11);
|
super(11);
|
||||||
this.tank = new FluidTank(Fluids.NONE, 8_000);
|
this.tank = new FluidTank(Fluids.NONE, 8_000);
|
||||||
@ -92,9 +95,9 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]});
|
recipe = SolderingRecipes.getRecipe(new ItemStack[] {slots[0], slots[1], slots[2], slots[3], slots[4], slots[5]});
|
||||||
long intendedMaxPower;
|
long intendedMaxPower;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 9, 10);
|
upgradeManager.checkSlots(this, slots, 9, 10);
|
||||||
int redLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int redLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int blueLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int blueLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
if(recipe != null) {
|
if(recipe != null) {
|
||||||
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
|
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
|
||||||
@ -374,10 +377,11 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.MultiblockHandlerXR;
|
import com.hbm.handler.MultiblockHandlerXR;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineTurbofan;
|
import com.hbm.inventory.container.ContainerMachineTurbofan;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -67,6 +68,8 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
|||||||
|
|
||||||
private AudioWrapper audio;
|
private AudioWrapper audio;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineTurbofan() {
|
public TileEntityMachineTurbofan() {
|
||||||
super(5, 150);
|
super(5, 150);
|
||||||
tank = new FluidTank(Fluids.KEROSENE, 24000);
|
tank = new FluidTank(Fluids.KEROSENE, 24000);
|
||||||
@ -151,8 +154,8 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
|||||||
|
|
||||||
this.wasOn = false;
|
this.wasOn = false;
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 2, 2);
|
upgradeManager.checkSlots(this, slots, 2, 2);
|
||||||
this.afterburner = UpgradeManager.getLevel(UpgradeType.AFTERBURN);
|
this.afterburner = upgradeManager.getLevel(UpgradeType.AFTERBURN);
|
||||||
|
|
||||||
if(slots[2] != null && slots[2].getItem() == ModItems.flame_pony)
|
if(slots[2] != null && slots[2].getItem() == ModItems.flame_pony)
|
||||||
this.afterburner = 100;
|
this.afterburner = 100;
|
||||||
@ -493,9 +496,10 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.AFTERBURN) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
return 0;
|
upgrades.put(UpgradeType.AFTERBURN, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine.oil;
|
package com.hbm.tileentity.machine.oil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerMachineGasFlare;
|
import com.hbm.inventory.container.ContainerMachineGasFlare;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -52,6 +53,8 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
protected int fluidUsed = 0;
|
protected int fluidUsed = 0;
|
||||||
protected int output = 0;
|
protected int output = 0;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineGasFlare() {
|
public TileEntityMachineGasFlare() {
|
||||||
super(6);
|
super(6);
|
||||||
tank = new FluidTank(Fluids.GAS, 64000);
|
tank = new FluidTank(Fluids.GAS, 64000);
|
||||||
@ -117,9 +120,9 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
if(isOn && tank.getFill() > 0) {
|
if(isOn && tank.getFill() > 0) {
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 4, 5);
|
upgradeManager.checkSlots(this, slots, 4, 5);
|
||||||
int burn = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int burn = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int yield = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
|
int yield = upgradeManager.getLevel(UpgradeType.EFFECT);
|
||||||
|
|
||||||
maxVent += maxVent * burn;
|
maxVent += maxVent * burn;
|
||||||
maxBurn += maxBurn * burn;
|
maxBurn += maxBurn * burn;
|
||||||
@ -319,10 +322,11 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.EFFECT) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.EFFECT, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.hbm.tileentity.machine.oil;
|
package com.hbm.tileentity.machine.oil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.FluidStack;
|
import com.hbm.inventory.FluidStack;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerLiquefactor;
|
import com.hbm.inventory.container.ContainerLiquefactor;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -47,6 +48,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
|||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineLiquefactor() {
|
public TileEntityMachineLiquefactor() {
|
||||||
super(4);
|
super(4);
|
||||||
tank = new FluidTank(Fluids.NONE, 24_000);
|
tank = new FluidTank(Fluids.NONE, 24_000);
|
||||||
@ -65,9 +68,9 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
|||||||
|
|
||||||
this.updateConnections();
|
this.updateConnections();
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 2, 3);
|
upgradeManager.checkSlots(this, slots, 2, 3);
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int power = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int power = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
this.processTime = processTimeBase - (processTimeBase / 4) * speed;
|
this.processTime = processTimeBase - (processTimeBase / 4) * speed;
|
||||||
this.usage = (usageBase + (usageBase * speed)) / (power + 1);
|
this.usage = (usageBase + (usageBase * speed)) / (power + 1);
|
||||||
@ -260,10 +263,11 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package com.hbm.tileentity.machine.oil;
|
package com.hbm.tileentity.machine.oil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.handler.pollution.PollutionHandler;
|
import com.hbm.handler.pollution.PollutionHandler;
|
||||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerPyroOven;
|
import com.hbm.inventory.container.ContainerPyroOven;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -55,6 +56,8 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem
|
|||||||
|
|
||||||
private AudioWrapper audio;
|
private AudioWrapper audio;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachinePyroOven() {
|
public TileEntityMachinePyroOven() {
|
||||||
super(6, 50);
|
super(6, 50);
|
||||||
tanks = new FluidTank[2];
|
tanks = new FluidTank[2];
|
||||||
@ -94,10 +97,10 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem
|
|||||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||||
if(smoke.getFill() > 0) this.sendFluid(smoke, worldObj, xCoord - rot.offsetX, yCoord + 3, zCoord - rot.offsetZ, Library.POS_Y);
|
if(smoke.getFill() > 0) this.sendFluid(smoke, worldObj, xCoord - rot.offsetX, yCoord + 3, zCoord - rot.offsetZ, Library.POS_Y);
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 4, 5);
|
upgradeManager.checkSlots(this, slots, 4, 5);
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerSaving = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerSaving = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
int overdrive = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
|
int overdrive = upgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
|
||||||
this.isProgressing = false;
|
this.isProgressing = false;
|
||||||
this.isVenting = false;
|
this.isVenting = false;
|
||||||
@ -210,8 +213,8 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canProcess() {
|
public boolean canProcess() {
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int powerSaving = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerSaving = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
if(power < this.getConsumption(speed, powerSaving)) return false; // not enough power
|
if(power < this.getConsumption(speed, powerSaving)) return false; // not enough power
|
||||||
|
|
||||||
PyroOvenRecipe recipe = this.getMatchingRecipe();
|
PyroOvenRecipe recipe = this.getMatchingRecipe();
|
||||||
@ -375,10 +378,11 @@ public class TileEntityMachinePyroOven extends TileEntityMachinePolluting implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.hbm.tileentity.machine.oil;
|
package com.hbm.tileentity.machine.oil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.container.ContainerSolidifier;
|
import com.hbm.inventory.container.ContainerSolidifier;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
@ -46,6 +47,8 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
public FluidTank tank;
|
public FluidTank tank;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityMachineSolidifier() {
|
public TileEntityMachineSolidifier() {
|
||||||
super(5);
|
super(5);
|
||||||
tank = new FluidTank(Fluids.NONE, 24_000);
|
tank = new FluidTank(Fluids.NONE, 24_000);
|
||||||
@ -65,9 +68,9 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
this.updateConnections();
|
this.updateConnections();
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 2, 3);
|
upgradeManager.checkSlots(this, slots, 2, 3);
|
||||||
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speed = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
int power = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int power = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
|
|
||||||
this.processTime = processTimeBase - (processTimeBase / 4) * speed;
|
this.processTime = processTimeBase - (processTimeBase / 4) * speed;
|
||||||
this.usage = (usageBase + (usageBase * speed)) / (power + 1);
|
this.usage = (usageBase + (usageBase * speed)) / (power + 1);
|
||||||
@ -276,10 +279,11 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.hbm.tileentity.machine.oil;
|
package com.hbm.tileentity.machine.oil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.UpgradeManager;
|
import com.hbm.inventory.UpgradeManagerNT;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||||
@ -35,6 +36,8 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
|||||||
|
|
||||||
public FluidTank[] tanks;
|
public FluidTank[] tanks;
|
||||||
|
|
||||||
|
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT();
|
||||||
|
|
||||||
public TileEntityOilDrillBase() {
|
public TileEntityOilDrillBase() {
|
||||||
super(8);
|
super(8);
|
||||||
tanks = new FluidTank[2];
|
tanks = new FluidTank[2];
|
||||||
@ -95,11 +98,11 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
|||||||
this.tanks[0].unloadTank(1, 2, slots);
|
this.tanks[0].unloadTank(1, 2, slots);
|
||||||
this.tanks[1].unloadTank(3, 4, slots);
|
this.tanks[1].unloadTank(3, 4, slots);
|
||||||
|
|
||||||
UpgradeManager.eval(slots, 5, 7);
|
upgradeManager.checkSlots(this, slots, 5, 7);
|
||||||
this.speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
this.speedLevel = upgradeManager.getLevel(UpgradeType.SPEED);
|
||||||
this.energyLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
this.energyLevel = upgradeManager.getLevel(UpgradeType.POWER);
|
||||||
this.overLevel = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) + 1;
|
this.overLevel = upgradeManager.getLevel(UpgradeType.OVERDRIVE) + 1;
|
||||||
int abLevel = Math.min(UpgradeManager.getLevel(UpgradeType.AFTERBURN), 3);
|
int abLevel = upgradeManager.getLevel(UpgradeType.AFTERBURN);
|
||||||
|
|
||||||
int toBurn = Math.min(tanks[1].getFill(), abLevel * 10);
|
int toBurn = Math.min(tanks[1].getFill(), abLevel * 10);
|
||||||
|
|
||||||
@ -323,12 +326,13 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 3;
|
upgrades.put(UpgradeType.SPEED, 3);
|
||||||
if(type == UpgradeType.AFTERBURN) return 3;
|
upgrades.put(UpgradeType.POWER, 3);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 3;
|
upgrades.put(UpgradeType.AFTERBURN, 3);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 3);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.hbm.tileentity.turret;
|
package com.hbm.tileentity.turret;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
@ -97,13 +98,14 @@ public class TileEntityTurretMaxwell extends TileEntityTurretBaseNT implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxLevel(UpgradeType type) {
|
public HashMap<UpgradeType, Integer> getValidUpgrades() {
|
||||||
if(type == UpgradeType.SPEED) return 27;
|
HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
|
||||||
if(type == UpgradeType.POWER) return 27;
|
upgrades.put(UpgradeType.SPEED, 27);
|
||||||
if(type == UpgradeType.EFFECT) return 27;
|
upgrades.put(UpgradeType.POWER, 27);
|
||||||
if(type == UpgradeType.AFTERBURN) return 27;
|
upgrades.put(UpgradeType.EFFECT, 27);
|
||||||
if(type == UpgradeType.OVERDRIVE) return 27;
|
upgrades.put(UpgradeType.AFTERBURN, 27);
|
||||||
return 0;
|
upgrades.put(UpgradeType.OVERDRIVE, 27);
|
||||||
|
return upgrades;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user