Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/1.4.5-forge' into 1…
Browse files Browse the repository at this point in the history
….4.6-forge
  • Loading branch information
thecatcore committed May 10, 2024
2 parents 5b2a216 + f30d7d0 commit 9e798a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/cpw/mods/fml/common/registry/ItemData.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.LoaderException;
import cpw.mods.fml.common.ModContainer;
import fr.catcore.fabricatedforge.Constants;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
Expand All @@ -40,9 +41,9 @@ public class ItemData {
public ItemData(Item item, ModContainer mc) {
this.itemId = item.id;
if (item.getClass().equals(BlockItem.class)) {
this.itemType = Block.BLOCKS[this.getItemId()].getClass().getName();
this.itemType = Constants.unmapClass(Block.BLOCKS[this.getItemId()].getClass().getName());
} else {
this.itemType = item.getClass().getName();
this.itemType = Constants.unmapClass(item.getClass().getName());
}

this.modId = mc.getModId();
Expand All @@ -55,7 +56,7 @@ public ItemData(Item item, ModContainer mc) {

public ItemData(NbtCompound tag) {
this.modId = tag.getString("ModId");
this.itemType = tag.getString("ItemType");
this.itemType = Constants.unmapClass(tag.getString("ItemType"));
this.itemId = tag.getInt("ItemId");
this.ordinal = tag.getInt("ordinal");
this.forcedModId = tag.contains("ForcedModId") ? tag.getString("ForcedModId") : null;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/fr/catcore/fabricatedforge/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ public static MappingUtils.ClassMember mapFieldFromRemappedClass(String owner, S
public static String mapDescriptor(String desc) {
return MappingUtils.mapDescriptor(desc);
}

public static String unmapClass(String className) {
return MappingUtils.unmapClass(className.replace(".", "/"));
}
}

0 comments on commit 9e798a0

Please sign in to comment.