mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-17 19:15:16 +00:00
Big cleanup
This commit is contained in:
1 parent
08f5f74c9f
commit
b3896b40a4
12 files changed
+78
-336
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package com.colen.postea.Utility;
|
||||
|
||||
import com.colen.postea.API.ItemStackReplacementManager;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class ItemFixerUtility {
|
||||
|
||||
public static void fixItemStack(NBTTagCompound tag) {
|
||||
|
||||
if (tag.hasNoTags()) return;
|
||||
|
||||
if (tag.hasKey("id")) {
|
||||
short id = tag.getShort("id");
|
||||
Item item = Item.getItemById(id);
|
||||
String itemNameInternal = GameRegistry.findUniqueIdentifierFor(item).modId + ":" + GameRegistry.findUniqueIdentifierFor(item).name;
|
||||
|
||||
Function<NBTTagCompound, NBTTagCompound> transformer = ItemStackReplacementManager.getItemReplacement(itemNameInternal);
|
||||
|
||||
if (transformer != null) {
|
||||
transformer.apply(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user