Jump to content

Music Disc Creation


xTekBlue

Recommended Posts

I am currently making a random mod with, well, random things and i'm having big problems creating this music disc. I have the model, song/ogg file, and have all the code for the item as a static, well, item. Ill link the code of the item at the bottom of this topic but i came here because i can not figure out for the life of me, how to make this item a "Record". Everywhere i look, i cannot find any help. The most i can do on my own is simply make the song play after i right click a jukebox (Doesn't use the disc, song doesn't stop after jukebox is broken). Please help, thank you!

 

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;

import java.util.Random;
import java.util.List;

@SuppressWarnings("unchecked")
public class mcreator_record1 {

	public mcreator_record1() {
	}

	public static Item block;
	public static Object instance;

	public void load(FMLInitializationEvent event) {
		if (event.getSide() == Side.CLIENT)
			Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
					.register(block, 0, new ModelResourceLocation("%MAINMODNAME%:Record1", "inventory"));

		GameRegistry.addSmelting(mcreator_sapphireBlock.block, new ItemStack(block), 1.0f);
	}

	public void generateNether(World world, Random random, int chunkX, int chunkZ) {
	}

	public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
	}

	public int addFuel(ItemStack fuel) {
		return 0;
	}

	public void serverLoad(FMLServerStartingEvent event) {
	}

	public void preInit(FMLPreInitializationEvent event) {
	}

	public void registerRenderers() {
	}

	static {
		block = (new Itemrecord1());

	}

	static class Itemrecord1 extends Item {

		public Itemrecord1() {
			setMaxDamage(0);
			maxStackSize = 1;
			setUnlocalizedName("record1");
			setRegistryName("record1");
			ForgeRegistries.ITEMS.register(this);
			setCreativeTab(mcreator_mourItems.tab);
		}

		@Override
		public int getItemEnchantability() {
			return 0;
		}

		@Override
		public int getMaxItemUseDuration(ItemStack par1ItemStack) {
			return 0;
		}

		@Override
		public float getDestroySpeed(ItemStack par1ItemStack, IBlockState par2Block) {
			return 1.0F;
		}

		@Override
		public void addInformation(ItemStack itemstack, World world, List<String> list, ITooltipFlag flag) {
			list.add("XXXTentation - Skin");
		}

	}
}

 

Although this is made with MCreator, I use the code portion of the program often. So if someone would like to just link me a updated copy of this item with record functionality, feel free :P 

Edited by xTekBlue
Link to comment
Share on other sites

That's the exact stuff i've found looking on the web for like an hours. I've extended ItemRecord on line 61 but it caused errors. That's just where i'm assuming it goes by the way. I am not only here to help my own code out, id like to let others figure this out as well. I have small experience with java but enough to create my own Spigot plugins. This is the first time i'm messing with actual Minecraft files creating a mod of my own, so sorry if i'm speaking crazy.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.