Created
February 22, 2016 18:21
-
-
Save anonymous/84e5698e47dfa2216bf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by toblexson on 11/01/2016. | |
*/ | |
public class ItemDiscSleeve extends SCBaseItem | |
{ | |
public ItemDiscSleeve() | |
{ | |
super(SCNames.Items.DISC_SLEEVE); | |
setMaxStackSize(1); | |
} | |
@Override | |
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) | |
{ | |
stack.setTagCompound(new NBTTagCompound()); | |
} | |
@Override | |
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) | |
{ | |
if(playerIn.isSneaking()) | |
{ | |
playerIn.openGui(SoundControl.instance, SCGuiHandler.DISC_SLEEVE_GUI, worldIn, (int)playerIn.posX, (int)playerIn.posY, (int)playerIn.posZ); | |
} | |
return itemStackIn; | |
} | |
@Override | |
public int getMaxItemUseDuration(ItemStack stack) | |
{ | |
return 1; | |
} | |
@Override | |
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) | |
{ | |
if(stack.hasTagCompound()) | |
{ | |
NBTTagCompound compound = stack.getTagCompound(); | |
NBTTagList list = compound.getTagList("Items", 10); | |
for(int i = 0; i < list.tagCount(); i++) | |
{ | |
NBTTagCompound tag = list.getCompoundTagAt(i); | |
String itemName = ItemStack.loadItemStackFromNBT(tag).getTooltip(playerIn, advanced).toString(); | |
itemName = itemName.replace("Music Disc", ""); | |
itemName = itemName.replace("[", ""); | |
itemName = itemName.replace(",", ""); | |
itemName = itemName.replace("]", ""); | |
tooltip.add(itemName); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment