Skip to content

Commit

Permalink
revert actualDamage
Browse files Browse the repository at this point in the history
  • Loading branch information
slprime committed Jan 16, 2025
1 parent 139f474 commit 3363362
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/codechicken/nei/ItemStackMap.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package codechicken.nei;

import static codechicken.lib.inventory.InventoryUtils.actualDamage;
import static codechicken.lib.inventory.InventoryUtils.newItemStack;
import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE;

Expand Down Expand Up @@ -36,7 +37,7 @@ public StackMetaKey(int damage, NBTTagCompound tag) {
}

public StackMetaKey(ItemStack key) {
this(key.getItemDamage(), key.stackTagCompound);
this(actualDamage(key), key.stackTagCompound);
}

public int hashCode() {
Expand Down Expand Up @@ -74,7 +75,7 @@ public T get(ItemStack key) {
if (wildcard != null) return wildcard;

if (damageMap != null) {
final T ret = damageMap.get(key.getItemDamage());
final T ret = damageMap.get(actualDamage(key));
if (ret != null) return ret;
}
if (tagMap != null) {
Expand All @@ -88,7 +89,7 @@ public T get(ItemStack key) {

public T put(ItemStack key, T value) {
try {
switch (getKeyType(key.getItemDamage(), key.stackTagCompound)) {
switch (getKeyType(actualDamage(key), key.stackTagCompound)) {
case 0:
if (metaMap == null) metaMap = new HashMap<>();
return metaMap.put(new StackMetaKey(key), value);
Expand All @@ -97,7 +98,7 @@ public T put(ItemStack key, T value) {
return tagMap.put(key.stackTagCompound, value);
case 2:
if (damageMap == null) damageMap = new HashMap<>();
return damageMap.put(key.getItemDamage(), value);
return damageMap.put(actualDamage(key), value);
case 3:
T ret = wildcard;
wildcard = value;
Expand All @@ -112,13 +113,13 @@ public T put(ItemStack key, T value) {

public T remove(ItemStack key) {
try {
switch (getKeyType(key.getItemDamage(), key.stackTagCompound)) {
switch (getKeyType(actualDamage(key), key.stackTagCompound)) {
case 0:
return metaMap != null ? metaMap.remove(new StackMetaKey(key)) : null;
case 1:
return tagMap != null ? tagMap.remove(key.stackTagCompound) : null;
case 2:
return damageMap != null ? damageMap.remove(key.getItemDamage()) : null;
return damageMap != null ? damageMap.remove(actualDamage(key)) : null;
case 3:
T ret = wildcard;
wildcard = null;
Expand Down

0 comments on commit 3363362

Please sign in to comment.