Posted July 28, 20169 yr Hey, Can you tell me how to get the event when right-clicking on an vanilla item. Not a custom one. I don't want to create a new item, I only want to add a feature to the old one. I tried to create this class. But I don't know how to register/add this feature to the normal/old compass. public class Compass extends ItemCompass { public CompassTeleporter() { super(); } @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { System.out.println("Test"); } }
July 28, 20169 yr That code should be throwing giant red errors at you and shouldn't compile. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
July 28, 20169 yr Author Yeah, you are right. I'am new with forge, can you tell me please it's right? I would like to get the event when some right-click with a normal compass in his hand.
July 28, 20169 yr Well it doesn't compile because your method needs a return value, which you're not doing. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
July 28, 20169 yr Author You mean this: return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); right? Please ignore my code example I only want to show want I had made, I don't think that this is the right way. Or how to register my class for the normal compass?
July 28, 20169 yr Oh, I misunderstood your original question. You want to add this method to the vanilla compass. Ha. Good luck. Forge is supposed to have a thing called "addSubstitutionAlias" (e.g. GameRegistry.addSubstitutionAlias("minecraft:stick", GameRegistry.Type.ITEM, itemStickReplacement); ), but as far as anyone has tried, it doesn't work correctly. See: http://www.minecraftforge.net/forum/index.php/topic,35899.msg191091.html#msg191091 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
July 28, 20169 yr Oh, I misunderstood your original question. You want to add this method to the vanilla compass. Ha. Good luck. Forge is supposed to have a thing called "addSubstitutionAlias" (e.g. GameRegistry.addSubstitutionAlias("minecraft:stick", GameRegistry.Type.ITEM, itemStickReplacement); ), but as far as anyone has tried, it doesn't work correctly. See: http://www.minecraftforge.net/forum/index.php/topic,35899.msg191091.html#msg191091 Substitution aliases should be fixed now (see this issue), though I still haven't managed to get them working myself. I need to verify this and file a proper bug report at some point. Edit: Reported here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 28, 20169 yr Author Froge is to hard for me I get an NullPointer when I try to register a command. What I'am doing wrong? @EventHandler public void serverLoad(FMLServerStartingEvent e){ e.registerServerCommand(new ServerCommand()); } public class ServerCommand implements ICommand { @Override public String getCommandName() { return "compass"; } @Override public String getCommandUsage(ICommandSender sender) { return "/compass"; } @Override public List<String> getCommandAliases() { return null; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { Minecraft.getMinecraft().displayGuiScreen(new GuiServer()); } @Override public boolean checkPermission(MinecraftServer server, ICommandSender sender) { if(sender instanceof EntityPlayer)return true; return false; } @Override public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { return null; } @Override public boolean isUsernameIndex(String[] args, int index) { return false; } @Override public int compareTo(ICommand o) { return 0; } } [21:28:43] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from SERVER_ABOUT_TO_START to SERVER_STARTING. Loading cannot continue [21:28:43] [server thread/ERROR] [FML]: States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) UCHIJAAA Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) UCHIJAAE teleporter{0.1} [teleporter] (frogetele_main) [21:28:43] [server thread/ERROR] [FML]: The following problems were captured during this phase [21:28:43] [server thread/ERROR] [FML]: Caught exception from teleporter java.lang.NullPointerException at net.minecraft.command.CommandHandler.registerCommand(CommandHandler.java:144) ~[forgeSrc-1.10.2-12.18.1.2011.jar:?] at net.minecraftforge.fml.common.event.FMLServerStartingEvent.registerServerCommand(FMLServerStartingEvent.java:59) ~[forgeSrc-1.10.2-12.18.1.2011.jar:?] at de.sambohl.Teleporter.serverLoad(Teleporter.java:28) ~[frogetele_main/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) ~[forgeSrc-1.10.2-12.18.1.2011.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) ~[forgeSrc-1.10.2-12.18.1.2011.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) ~[forgeSrc-1.10.2-12.18.1.2011.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:824) [Loader.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:292) [FMLCommonHandler.class:?] at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:126) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:496) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
July 28, 20169 yr Author Fix #3126 - duplicate stat id error - don't use the "universal iterat… … …ors" in statbuilding, use the one without the duplicate entries. (The duplicate entry one is for rendering setup) Do you know what he means? Is it fixed now?
July 29, 20169 yr Fix #3126 - duplicate stat id error - don't use the "universal iterat… … …ors" in statbuilding, use the one without the duplicate entries. (The duplicate entry one is for rendering setup) Do you know what he means? Is it fixed now? That particular error is fixed, but I've found a new one and reported it here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 29, 20169 yr If he just wants to override the right clicking of a vanilla item, not replacing it couldn't he just use events. More specifically the PlayerInteractEvent. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
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.