Your Item needs extend ItemRecord. It will want a string argument in a constructor. That's the record name. Also you will need variable of type Map , and override some methods:
@#1 Hi, Nuparu. Thank yoy for helping users, but can you be more specific with helping. Most users are of the younger generation and understand very little about code. Video specific tutorials are the greatest, but you sound code savy enough to translate and help them more.
After some experimenting I think I can answer this for you:
1. Make a new procedure and use the "Play at..." event and select your music disc sound that you should have already uploaded as a .ogg file.
2. Make a new "item" Mod Element, upload your disc texture and do what you need to. When you get to procedure there is a "When right clicked on block and choose the procedure u just made. This will mean that when the disc is right clicked against a block your new music disc sound will be played. I am sorry though, as this will mean the disc can be played clicked on whatever block and not just a Jukebox. If you're still fine with this, then it will work fine for you!
Also, you can try make a procedure that block checks but my MCreator keeps crashing when trying to select a block when making a procedure but you can always try that although i have no idea if it will work! :D
First, although this is the best method, it still doesn't act like a vanilla music disc. It doesn't consume the disk when played (this is possible)and it doesn't give it back when the jukebox is right clicked.
Second, For me mcreator works fine with blocks in procedures, so I think you should open a ticket on the tracker for this bug if there isn't one yet.
Third, Nuparu00 should specify where exactly to insert that code.(the line of code)
Your Item needs extend ItemRecord. It will want a string argument in a constructor. That's the record name. Also you will need variable of type Map , and override some methods:
[spoiler]
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
{
if (worldIn.isRemote)
{
return true;
}
else
{
((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack);
worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this));
--stack.stackSize;
return true;
}
}
else
{
return false;
}
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add(this.getRecordNameLocal());
}
@Override
//TODO: getRecordTitle()
public String getRecordNameLocal()
{
return StatCollector.translateToLocal(this.getUnlocalizedName() + ".desc");
}
@Override
public EnumRarity getRarity(ItemStack itemStack)
{
return EnumRarity.RARE;
}
public static MusicDisc getRecord(String par0Str)
{
return (MusicDisc)records.get(par0Str);
}
@Override
public ResourceLocation getRecordResource(String name)
{
return new ResourceLocation("testenvironmentmod:" + name);
}
[/spoiler]
@#1 Hi, Nuparu. Thank yoy for helping users, but can you be more specific with helping. Most users are of the younger generation and understand very little about code. Video specific tutorials are the greatest, but you sound code savy enough to translate and help them more.
Nuparu00 I do not understand how you do it.
I think I remember there being a way to doing it without code, but Its not there for me.
After some experimenting I think I can answer this for you:
1. Make a new procedure and use the "Play at..." event and select your music disc sound that you should have already uploaded as a .ogg file.
2. Make a new "item" Mod Element, upload your disc texture and do what you need to. When you get to procedure there is a "When right clicked on block and choose the procedure u just made. This will mean that when the disc is right clicked against a block your new music disc sound will be played. I am sorry though, as this will mean the disc can be played clicked on whatever block and not just a Jukebox. If you're still fine with this, then it will work fine for you!
Also, you can try make a procedure that block checks but my MCreator keeps crashing when trying to select a block when making a procedure but you can always try that although i have no idea if it will work! :D
First, although this is the best method, it still doesn't act like a vanilla music disc. It doesn't consume the disk when played (this is possible)and it doesn't give it back when the jukebox is right clicked.
Second, For me mcreator works fine with blocks in procedures, so I think you should open a ticket on the tracker for this bug if there isn't one yet.
Third, Nuparu00 should specify where exactly to insert that code.(the line of code)