Jump to content

Hazza8974

Members
  • Posts

    4
  • Joined

  • Last visited

Hazza8974's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. but how do i add that to my code because what it says is quite short
  2. 'SoundEvent(net.minecraft.resources.ResourceLocation, float, boolean)' has private access in 'net.minecraft.sounds.SoundEvent' that was the error by the way caused by the soundevent
  3. public class ModSounds { public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, TutorialMod.MOD_ID); private static RegistryObject<SoundEvent> registerSoundEvent(String name) { ResourceLocation location = new ResourceLocation(TutorialMod.MOD_ID, name); return SOUND_EVENTS.register(name, () -> new SoundEvent(location, SoundSource.MASTER)); } public static void register(IEventBus eventBus) { SOUND_EVENTS.register(eventBus); } } anyone have any ideas i did you chat gpt to attempt to fix it without having to bother someone else about this but it said if the error kept occurring it said to post here so now im here
  4. Error= Caused by: java.lang.IllegalStateException: Cannot register new entries to DeferredRegister after RegisterEvent has been fired. Cause= package net.hazza.hazzasmod.block; import net.hazza.hazzasmod.HazzasMod; import net.hazza.hazzasmod.item.ModItems; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.Material; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import java.util.function.Supplier; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, HazzasMod.MOD_ID); public static final RegistryObject<Block> YELLOW_WALLPAPER_BLOCK = registerBlock("yellow_wallpaper_block", () -> new Block(BlockBehaviour.Properties.of(Material.WOOD) .strength(3f).requiresCorrectToolForDrops())); private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) { RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn); return toReturn; } private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block) { return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } }
×
×
  • Create New...

Important Information

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