net.minecraft.item.ItemRecord Java Examples
The following examples show how to use
net.minecraft.item.ItemRecord.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentMusicPlayer.java From Artifacts with MIT License | 6 votes |
@Override public ItemStack attached(ItemStack i, Random rand, int[] eff) { ArrayList<ItemRecord> recordList = new ArrayList<ItemRecord>(); //Fill record list with everything considered a record (vanilla or modded). Iterator<Item> it = Item.itemRegistry.iterator(); while(it.hasNext()) { Item item = it.next(); if(item instanceof ItemRecord) { recordList.add((ItemRecord)item); } } //If records were found (and there should always be some!), choose one randomly. if(recordList.size() > 0) { String record = recordList.get(rand.nextInt(recordList.size())).recordName; i.getTagCompound().setString("record", record); } else { System.out.println("No records?!?"); } return i; }
Example #2
Source File: ComponentMusicPlayer.java From Artifacts with MIT License | 5 votes |
@Override public void addInformation(ItemStack itemStack, EntityPlayer player, List list, String trigger, boolean advTooltip) { String play = StatCollector.translateToLocal("effect.Play"); if(play.equals("{Play}")) play = "" + EnumChatFormatting.GREEN + ((char) 0x266A) + EnumChatFormatting.LIGHT_PURPLE + ((char) 0x266B) + EnumChatFormatting.GOLD + ((char) 0x266A); //Get the localized record description String recordDescription = "Unknown"; ItemRecord record = ItemRecord.getRecord("records."+itemStack.getTagCompound().getString("record")); if(record != null) { //If the record was from a mod that is no longer loaded, the description will stay "Unknown" recordDescription = record.getRecordNameLocal(); } list.add(StatCollector.translateToLocal("effect.Plays the record") + " " + recordDescription + " " + StatCollector.translateToLocal("tool." + trigger) + " " + (itemStack.getTagCompound().getBoolean("playing") ? play : "")); }