Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

OreDictionary auto-promotion #1089

Closed
wants to merge 3 commits into from
Closed

OreDictionary auto-promotion #1089

wants to merge 3 commits into from

Conversation

pterolatypus
Copy link

Direct-mapped items which are registered to exactly one OreDictionary key will automatically be added as OreDictionary mappings unless there already exists a cheaper one.

This way, additional items registered to that ore will automatically inherit the other's value.

@pahimar
Copy link
Owner

pahimar commented Jun 30, 2016

This is unnecessary because this exists

if (wrappedObject instanceof ItemStack) {
ItemStack unValuedItemStack = ItemStack.copyItemStack((ItemStack) wrappedObject);
EnergyValue minEnergyValue = null;
int[] oreIds = OreDictionary.getOreIDs(unValuedItemStack);
if (oreIds.length > 0) {
EnergyValue energyValue = null;
boolean allHaveSameValue = true;
for (int oreId : oreIds) {
String oreName = OreDictionary.getOreName(oreId);
if (!"Unknown".equalsIgnoreCase(oreName)) {
WrappedStack oreStack = WrappedStack.build(new OreStack(oreName));
if (oreStack != null && valueMap.containsKey(oreStack)) {
if (energyValue == null) {
energyValue = valueMap.get(oreStack);
}
else if (!energyValue.equals(valueMap.get(oreStack))) {
allHaveSameValue = false;
}
}
else {
allHaveSameValue = false;
}
}
else {
allHaveSameValue = false;
}
}
if (allHaveSameValue) {
return energyValue;
}
}

@pahimar pahimar closed this Jun 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants