Some work on the DynEMC system
This commit is contained in:
parent
51bd858f8b
commit
fa94dc6d5e
4 changed files with 162 additions and 0 deletions
48
ee3_common/ee3/common/core/helper/QualityHelper.java
Normal file
48
ee3_common/ee3/common/core/helper/QualityHelper.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package ee3.common.core.helper;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class QualityHelper {
|
||||
|
||||
/*
|
||||
* Legend for the dust table quality lookup, comparison is based off of quality tiers
|
||||
*
|
||||
* Item Quality
|
||||
* |_0_|_1_|_2_|_3_|_4_|_5_|
|
||||
* Fuel 0 | 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
* Quality 1 | 0 | 1 | 1 | 1 | 2 | 2 |
|
||||
* 2 | 0 | 1 | 2 | 2 | 2 | 2 |
|
||||
* 3 | 1 | 1 | 2 | 3 | 3 | 3 |
|
||||
* 4 | 1 | 2 | 2 | 3 | 4 | 4 |
|
||||
* 5 | 1 | 2 | 2 | 3 | 4 | 5 |
|
||||
*/
|
||||
private static int[][] dustTable = {
|
||||
{0, 0, 0, 1, 1, 1},
|
||||
{0, 1, 1, 1, 2, 2},
|
||||
{0, 1, 2, 2, 2, 2},
|
||||
{1, 1, 2, 3, 3, 3},
|
||||
{1, 2, 2, 3, 4, 4},
|
||||
{1, 2, 2, 3, 4, 5},
|
||||
};
|
||||
|
||||
public static int getItemTierQuality(ItemStack item) {
|
||||
// TODO Return the 'Tier' level of the given ItemStack
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getFuelTierQuality(ItemStack fuel) {
|
||||
// TODO Return the 'Tier' level of the given ItemStack
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getDustTierQuality(ItemStack item, ItemStack fuel) {
|
||||
if ((getItemTierQuality(item) >= 0) && (getItemTierQuality(item) <= 5)) {
|
||||
if ((getFuelTierQuality(fuel) >= 0) && (getFuelTierQuality(fuel) <= 5)) {
|
||||
return dustTable[getItemTierQuality(item)][getFuelTierQuality(fuel)];
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
87
ee3_common/ee3/common/emc/EMCEntry.java
Normal file
87
ee3_common/ee3/common/emc/EMCEntry.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
package ee3.common.emc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EMCEntry {
|
||||
|
||||
private float cost, recoveryPercentage;
|
||||
private boolean learnable, recoverable;
|
||||
private Map<EMCType, Float> breakdown;
|
||||
|
||||
public EMCEntry(float cost) {
|
||||
this.cost = cost;
|
||||
recoveryPercentage = 1F;
|
||||
learnable = true;
|
||||
recoverable = true;
|
||||
breakdown = Collections.synchronizedMap(new HashMap<EMCType, Float>());
|
||||
}
|
||||
|
||||
public EMCEntry(float cost, float recoveryPercentage, boolean learnable, boolean recoverable) {
|
||||
this.cost = cost;
|
||||
this.recoveryPercentage = recoveryPercentage;
|
||||
this.learnable = learnable;
|
||||
this.recoverable = recoverable;
|
||||
breakdown = Collections.synchronizedMap(new HashMap<EMCType, Float>());
|
||||
}
|
||||
|
||||
public float getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public float getRecoveryPercentage() {
|
||||
return recoveryPercentage;
|
||||
}
|
||||
|
||||
public boolean isLearnable() {
|
||||
return learnable;
|
||||
}
|
||||
|
||||
public boolean isRecoverable() {
|
||||
return recoverable;
|
||||
}
|
||||
|
||||
public Map<EMCType, Float> getEMCBreakDown() {
|
||||
return breakdown;
|
||||
}
|
||||
|
||||
public float getEMCBreakdownByType(EMCType emcType) {
|
||||
if (breakdown.containsKey(emcType)) {
|
||||
if (breakdown.get(emcType) != null) {
|
||||
return breakdown.get(emcType).floatValue();
|
||||
}
|
||||
}
|
||||
|
||||
return -1F;
|
||||
}
|
||||
|
||||
public void setCost(float cost) {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public void setRecoveryPercentage(float recoveryPercentage) {
|
||||
this.recoveryPercentage = recoveryPercentage;
|
||||
}
|
||||
|
||||
public void setLearnable(boolean learnable) {
|
||||
this.learnable = learnable;
|
||||
}
|
||||
|
||||
public void setRecoverable(boolean recoverable) {
|
||||
this.recoverable = recoverable;
|
||||
}
|
||||
|
||||
public void addEMCBreakDown(EMCType emcType, Float breakdownPercentage) {
|
||||
if (!(breakdown.containsKey(emcType))) {
|
||||
breakdown.put(emcType, breakdownPercentage);
|
||||
}
|
||||
}
|
||||
|
||||
public void setEMCBreakDown(EMCType emcType, Float breakdownPercentage) {
|
||||
if (breakdown.containsKey(emcType)) {
|
||||
breakdown.put(emcType, breakdownPercentage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
16
ee3_common/ee3/common/emc/EMCRegistry.java
Normal file
16
ee3_common/ee3/common/emc/EMCRegistry.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
package ee3.common.emc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class EMCRegistry {
|
||||
|
||||
private static final EMCRegistry emcRegistry = new EMCRegistry();
|
||||
|
||||
private HashMap<Integer, HashMap<Integer, EMCEntry>> emcMap = new HashMap<Integer, HashMap<Integer, EMCEntry>>();
|
||||
|
||||
public EMCRegistry instance() {
|
||||
return emcRegistry;
|
||||
}
|
||||
|
||||
}
|
11
ee3_common/ee3/common/emc/EMCType.java
Normal file
11
ee3_common/ee3/common/emc/EMCType.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package ee3.common.emc;
|
||||
|
||||
public enum EMCType {
|
||||
WATER,
|
||||
EARTH,
|
||||
FIRE,
|
||||
AIR,
|
||||
VOID,
|
||||
BLOOD,
|
||||
PURE
|
||||
}
|
Loading…
Reference in a new issue