
monkeysHK
Members-
Content Count
10 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout monkeysHK
-
Rank
Tree Puncher
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
That's exactly what I wanted to look at. (It's so obvious and I was dumb) Thanks
-
monkeysHK started following Problem., Minecraft's BlockItem Declarations, Problem with Replacing Vanilla Blocks and and 1 other
-
Hello. As we can look at the declaration of blocks in Blocks.java, I want to know if forge has a place to store vanilla BlockItem declarations (for each of their vanilla blocks), or where they initialize.
-
Oh yes that was exactly the problem. Spent a little more time on documentation and figured it out. Thank you so much! Code that works. @Mod.EventBusSubscriber(modid = nbaddons.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class Registration { public static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); public static RegistryObject<Block> NOTEBLOCK = VANILLA_BLOCKS.register( "note_block", () -> new NBTNoteBlock(AbstractBlock.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(0.8F))); public static final DeferredRegister<TileEntityType<?>> TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, nbaddons.MOD_ID); public static RegistryObject<TileEntityType<NoteBlockTileEntity>> NOTEBLOCK_TE = TILE_ENTITIES.register( "note_block", () -> TileEntityType.Builder.create(NoteBlockTileEntity::new, Blocks.NOTE_BLOCK).build(null)); public static void register() { VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); TILE_ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } }
-
Oops... I omitted the class because I thought I would not need it for the discussion. Here is the full Registration.java. public static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); public static RegistryObject<Block> NOTEBLOCK = VANILLA_BLOCKS.register( "note_block", () -> new NBTNoteBlock(AbstractBlock.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(0.8F))); public static final DeferredRegister<TileEntityType<?>> TILE_ENTITIES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, nbaddons.MOD_ID); public static RegistryObject<TileEntityType<?>> NOTEBLOCK_TE = Registration.TILE_ENTITIES.register( "note_block", () -> NoteBlockTileEntity.register("note_block", TileEntityType.Builder.create(NoteBlockTileEntity::new, Blocks.NOTE_BLOCK))); public static void register() { VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); TILE_ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } NoteBlockTileEntity.java:53 (I copied some lines from TileEntityType::register) public static <T extends TileEntity> TileEntityType<T> register(String key, TileEntityType.Builder<T> builder) { Type<?> type = Util.attemptDataFix(TypeReferences.BLOCK_ENTITY, key); return Registry.register(Registry.BLOCK_ENTITY_TYPE, key, builder.build(type)); }
-
Still getting the same error. New Registration.java public static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); public static final RegistryObject<Block> NOTEBLOCK = Registration.VANILLA_BLOCKS.register( "note_block", () -> new NBTNoteBlock(AbstractBlock.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(0.8F))); public static void register() { VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } Full Stacktrace: [20:48:27] [Render thread/ERROR] [minecraft/Util]: No data fixer registered for note_block [20:48:27] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Can not register to a locked registry. Modder should use Forge Register methods. Index: 2 Listeners: 0: NORMAL 1: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@260f306 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V 2: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@70ea9d57 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods. at net.minecraftforge.registries.NamespacedWrapper.register(NamespacedWrapper.java:56) at net.minecraftforge.registries.NamespacedWrapper.register(NamespacedWrapper.java:72) at net.minecraftforge.registries.NamespacedWrapper.register(NamespacedWrapper.java:40) at net.minecraft.util.registry.Registry.register(Registry.java:474) at net.minecraft.util.registry.Registry.register(Registry.java:470) at com.mhk.nbaddons.blocks.NoteBlockTileEntity.register(NoteBlockTileEntity.java:53) at com.mhk.nbaddons.setup.Registration.lambda$static$1(Registration.java:30) at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:124) at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:200) at net.minecraftforge.registries.DeferredRegister.access$000(DeferredRegister.java:61) at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:172) at net.minecraftforge.eventbus.ASMEventHandler_1_EventDispatcher_handleEvent_Register.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1640) at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:243) at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230) at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:196) at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$1(ClientModLoader.java:103) at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:103) at net.minecraft.client.Minecraft.<init>(Minecraft.java:442) at net.minecraft.client.main.Main.main(Main.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105)
-
Hello. I have been trying to register my own class NBTNoteBlock to the block registry with key note_block in "minecraft" but I got an error. I don't know what was wrong. It would be appreciated if someone could provide a fix. Code is provided below. Error I got was: [16:41:11] [Render thread/ERROR] [minecraft/Util]: No data fixer registered for note_block [16:41:11] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Can not register to a locked registry. Modder should use Forge Register methods. First few lines in the main mod file: // The value here should match an entry in the META-INF/mods.toml file @Mod("nbaddons") public class nbaddons { // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "nbaddons"; public nbaddons() { Registration.register(); // <-- Registers stuff, see Registration.java // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } ... First few lines in Registration.java @Mod.EventBusSubscriber(modid = nbaddons.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class Registration { public static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); public static void register() { VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); NBTNoteBlock.register(); // <-- The block class itself. See NBTNoteBlock.java ... First few lines in NBTNoteBlock.java public class NBTNoteBlock extends NoteBlock { //public static Block NOTEBLOCK; public static final RegistryObject<Block> NOTEBLOCK = Registration.VANILLA_BLOCKS.register( "note_block", () -> new NBTNoteBlock(AbstractBlock.Properties.create(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(0.8F))); public NBTNoteBlock(Properties properties) { super(properties); } public static void register() {}; // <-- register() is called just to initialize the constant NOTEBLOCK, as mentioned in the tutorial I watched.
-
My goal is to add NBT tags on picking up note block (ctrl+middle click in creative mode like for chest containing items, where it will show "+NBT" and will have the items in it) Should I coremod to add a custom tile entity (with nbt values) to the vanilla note block?
-
Hello. I have been trying to change the behaviour of the note block using mixin. Currently it is expected to send a message in logger when I click the noteblock. Does not work and I am not sure what the problem is. This is some of my code and it'd be appreciated if anyone could point out what's wrong. (I suspect I have to add nbaddons.refmap.json somewhere?) Note: Code is removed because I decided to resort to other methods. Note that this thread provides no answer to the problem mentioned.
-
I looked at getScrollDelta() for pick up scroll directions and getButton() for keyboard input. It was very helpful. Thank you. I wonder what are the better ways of detecting inputs not using raw inputs?
-
Hello. I am trying to write a mod with LWJGL3 (for mc 1.16.4), where glfw is used for input events (and my purpose is to detect scroll direction and key inputs). The functions usually require the argument 'window' (those in https://www.glfw.org/docs/latest/input_guide.html). In the glfw tutorials they use glfwCreateWindow(...) to create a window object, but I want it to detect input from minecraft instead. How can I get the window for Minecraft for this to work, or is there a better method?