mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
Add Mekanism Shaped and Mekanism Shapeless recipe handlers, use ItemDataUtils to consolidate non-subtype-based NBT data into a single compound
This commit is contained in:
1 parent
2f61ea103f
commit
be863a4289
53 files changed
+679
-789
No files matched your search
@@ -9,6 +9,7 @@ import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -140,35 +141,25 @@ public class ItemConfigurationCard extends ItemMekanism
|
||||
|
||||
public void setData(ItemStack itemstack, NBTTagCompound data)
|
||||
{
|
||||
if(itemstack.hasTagCompound())
|
||||
{
|
||||
itemstack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(data != null)
|
||||
{
|
||||
itemstack.getTagCompound().setTag("data", data);
|
||||
ItemDataUtils.setCompound(itemstack, "data", data);
|
||||
}
|
||||
else {
|
||||
itemstack.getTagCompound().removeTag("data");
|
||||
ItemDataUtils.removeData(itemstack, "data");
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getData(ItemStack itemstack)
|
||||
{
|
||||
if(!itemstack.hasTagCompound())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound data = itemstack.getTagCompound().getCompoundTag("data");
|
||||
NBTTagCompound data = ItemDataUtils.getCompound(itemstack, "data");
|
||||
|
||||
if(data.hasNoTags())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return itemstack.getTagCompound().getCompoundTag("data");
|
||||
return ItemDataUtils.getCompound(itemstack, "data");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user