Jump to content

JeanLucJ

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by JeanLucJ

  1. Found how to do it.... For the record, I used : http://www.minecraftforge.net/wiki/MrGReapers_tutorials/1.7.2_sound_tutorial As the url lacks working examples, here is one : The mod is "jlmod" - You must create a sound folder \resources\assets\jlmod\sounds - Inside, ogg files. -> In this example, "sonar.ogg" You must create an sounds.json file in \resources\assets\jlmod Content : { "custom_sound": {"category": "ambient","sounds": [{"name": "sonar","stream": false}]} } You can then play the sound with something like : world.playSound(posX, posY, posZ, "jlmod:mineral_detector_sound", 1.0F, 0.6F, false);
  2. Did you put ; at the end at your statement? allowFlying means you still have to double jump to enable fly. You can also use player.capabilities.isFlying = true; which makes you fly directly. Example from one of my mod that works (it's an item that makes you fly when used). Just remove the lines with DebugTools.debugMessage (it's custom debugging) : public class obsidianWings extends Item { public obsidianWings() { super(); this.setCreativeTab(CreativeTabs.tabMisc); } @Override public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { DebugTools.debugMessage(world.isRemote, "obsidianWings used (onItemUse function)"); fly(player); return true; } @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { DebugTools.debugMessage(world.isRemote, "obsidianWings used (onItemRightClick function)"); fly(player); return item; } void fly(EntityPlayer player) { player.capabilities.isFlying = !player.capabilities.isFlying; }
  3. Hello guys, How can you add custom sounds with 1.7.10? I have no problem playing a vanilla sound (for my mod : when an item is used) but adding sound seems a different story. Code like : @SideOnly(Side.CLIENT) @ForgeSubscribe public void onSoundLoad(SoundLoadEvent event) { Minecraft mc = Minecraft.getMinecraft(); event.manager.soundPoolSounds.addSound("lnl/mod/tutorial/metalhit.ogg", new File(mc.mcDataDir, "resources/mod/tutorial/metal_hit.ogg")); is deprecated and even when adapting (@ForgeSubscribe -> @SubscribeEvent, and so on), addSound seems to have dissappeared Going through javadoc and forgeSrc-1.7.10-10.13.0.1180-sources.jar does not help me to understand. BTW, I'm quite new to forge, what is the equivalent of RTFM? I find many answers through forums, but the wiki tutorials are (it seems) quite basic and sometimes out of date. Thanks, JL
  4. Browsing on the internet, I saw more than once it was metadata. Thank you Well, mystery solved!
  5. Hello guys, Using Forge v10.13.0.1180 I found out a weird behavior that I can't explain. So, I made a custom block with metada. I set Metadata with onBlockPlacedBy, it works fine. With this code : @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float a, float b, float c) { int dest = (metadata+1)%idBlock; if(!world.isRemote) { //Debug player.addChatMessage(new ChatComponentText("Local BlockNumber : " + world.getBlockMetadata(x, y, z))); player.addChatMessage(new ChatComponentText("onBlock BlockNumber : " + metadata)); } } world.getBlockMetadata(x, y, z) returns the correct value. metadata (from onBlockActivated) return value that could be correct ("random" metadata from previous onBlockPlacedBy), but they are not the current block metadata value! I am missing something fundamental? 5th paramater of onBlock should be the metadata of the activated block.... Thanks
×
×
  • Create New...

Important Information

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