Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

20ChenM

Members
  • Joined

  • Last visited

Everything posted by 20ChenM

  1. I dont understand the forge documents, I just started to learn java a couple weeks ago. Im not an expert like you guys.
  2. my other posts about sound is blocked so I cant see it why cant these forums be helpful, im just trying to learn how to mod.
  3. player.PlaySound? im not sure i understand your question. Ive set up the Sound Event I think in this code: Class SoundInit.java: package com.Michael.TutorialMod2.init; import com.Michael.TutorialMod2.Tutorial; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.ForgeRegistries; import com.Michael.TutorialMod2.util.RegistryHandler; import net.minecraftforge.registries.DeferredRegister; public class SoundInit { public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS,Tutorial.MOD_ID); public static final RegistryObject<SoundEvent> AMBEINT = SOUNDS.register( "russia.ambient_sound",()-> new SoundEvent(new ResourceLocation(Tutorial.MOD_ID,"russia.ambient_sound"))); ResourceLocation location = new ResourceLocation("examplemod", "item.russia_sound"); SoundEvent events1 = new SoundEvent(location); } and i also made the sound.json file: "item.russia_sound": { "category": "item", "subtitle": "russia.ambient.sub", "sounds": [{ "name":"examplemod:item/russia_sound", "stream": true} ] } } so im just confused on how to call the method to play the sound. heres the code i have to play the sound: if(player.getHeldItemMainhand().getItem() == RegistryHandler.Vodka.get()) { Tutorial.LOGGER.info("testing"); player.playSound( I DONT KNOW WHAT TO PUT HERE, 1.0f, 1.0f); } } } Im not sure what to put in the player.playSound section. All the tutorials ive seen are for 1.15 but my mod is 1.16 Its asking for(Sound Event, soudln. volume, pitch) I dont know what corresponds to which variable int he Sound Event
  4. I dont know what the pathln is or how to change it, can someone give me an in depth explanation on how this works? The forge guide isnt very clear on it.
  5. Ive created a class called ModClientEvents which manages my events. in it, I have the following code: ackage com.Michael.TutorialMod2.events; import com.Michael.TutorialMod2.Tutorial; import com.Michael.TutorialMod2.items.Vodka; import com.Michael.TutorialMod2.util.RegistryHandler; import net.minecraft.entity.LivingEntity; import net.minecraft.item.Items; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.event.entity.EntityEvent; @Mod.EventBusSubscriber(modid = Tutorial.MOD_ID, bus=Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class ModClientEvents { public static void onPlayerEat(LivingEntityUseItemEvent event) { LivingEntity player = event.getEntityLiving(); if(player.getHeldItemMainhand().getItem() == RegistryHandler.Vodka.get()) { Tutorial.LOGGER.info("test"); //code to play a 3rd party sound file } } } How can I play a 3rd party sound after I finish using the item vodka?
  6. can someone give a very in depth explanation, i am very enw to modding.
  7. I want to create something with one or 2 inputs and one output, sorta like a brewing stand. However, I have not been able to find any tutorials at all that give an in depth explanation that a noob like me could understand. Can sombody help explain to me how to make a custom crafting block?
  8. What subforum should i post this in
  9. I am following this tutorial:
  10. I want to use the following code( public int getExpDrop(Blockstate state, IWorldReader reader, BlockPos pos, int Fortune, int silktouch){ return 1;} ) to allow my oreblock to give exp when broken. However, even after importing import net.minecraft.block.BlockState; the text above is gray which means it is unused and the word Block state in the first code is red and gives the error: Cannot resolve symbol 'Blockstate' Can anyone help?
  11. I figured it out. My mappings were out of date. i was in 20200543.1.16 but I should have been in 20200723.1.16.1 For anyone that has the same problem as me and comes across this forum, you can change the mapping version by going to the build.gradle file in your forge mdk and it will be around line 29.
  12. is there an import to get the .set commands? does anyone know what they are?
  13. what is an srg name? I have done lots of research but none of the posts that talk about my problem are clear enough for me to understand. Im still a modding newbie
  14. I just moved my 1.15.2 mod to 1.16.1 by replacing the build.gradle with a 1.16.1 build.gradle from the 1.16.1 mdk. I then recreated the workspace. For some reason though, the .set commands dont work and I get an error saying:Cannot resolve method 'setLightLevel' in 'Properties' My Code: package com.Michael.TutorialMod2.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class RubyBlock extends Block { public RubyBlock() { super(Block.Properties.create(Material.IRON) .hardnessAndResistance(5.0f,6.0f) .sound(SoundType.METAL) .harvestLevel(3) .harvestTool(ToolType.PICKAXE) .setLightLevel(value ->1) ); } }
  15. how can i link a specific audio file thats not in vanilla minecraft?
  16. I want to make a food item where if you eat it, a song plays. How can you do that?
  17. How do you make armor models that are not bulky and stick out? Some mods that ive played with like the tech guns mod have armor sets that dont look flat and bulky. There is a tutorial I found for 1.12.2 that uses 3d moddels but forge has changed alot since 1.12.2 so im not sure how to do it
  18. so like this? { "type": "minecraft:smelting", "ingredient": { "item": "examplemod:ruby_ore" }, "result": { "item": "examplemod:ruby", "count": 2 }, "experience": 0.2, "cookingtime": 50 }
  19. I have a friend who wants to make a mod that places blocks beneath your feet but his code has errors. I do not know how to help him since i am new to 1.15.2 modding so I am coming to the forums asking for help. His Code: Locate class: import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.entity.LivingEntity; import net.minecraft.fluid.IFluidState; import net.minecraft.util.math.BlockPos; import net.minecraft.entity.Entity; import net.minecraft.entity.player.*; import net.minecraft.item.Item; import net.minecraft.world.World; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class Locate { public void isAirBelow(BlockPos pos) { EntityPlayer player = event.player; BlockPos posBelow = player.getPosition().down(); BlockState blockStateBelow = player.world.getBlockState(posBelow); Block below = blockStateBelow.getBlock(); if(below.equals(Material.AIR)) { world.setBlock(blockStateBelow, Blocks.COBBLESTONE); } } } main class: import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod("Scaffold") public class Scaffold { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public Scaffold() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } }
  20. so, how do i fix it? I am new to modding so I need you to do a step by step guide
  21. I am new to modding and im trying to make a furnace recipe where if u input one ruby ore into a furnace, you yield 2 rubies. I tried doing a count function but it did not work. Any help? My code: { "type": "minecraft:blasting", "ingredient": { "item": "examplemod:ruby_ore" }, "result": "examplemod:ruby", "count": 2, "experience": 0.5, "cookingtime": 50 }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.