Posted September 15, 20178 yr I am trying to make an item. And when the item is right clicked, it would make the time 1000 (Sunrise). It would also use 1 durability. I am a beginner so I don't know how to change the time. Can someone help me?
September 15, 20178 yr What I would do is when the item is right clicked have it execute the command /time set day So I believe what you are looking for is this MinecraftServer.getServer().getCommandManager().executeCommand(player, command) When run it should execute the command of your choice.
September 15, 20178 yr You do not want to run a command. That would be bad practice. Those are for use through the ingame chat. You want to override onItemRightClick() in your item. From the parameters you get in that method you have to obtain an instance of the World which has a method to set the time of that world directly. That same method could be used to subtract 1 durability. For that you would want to set setMaxDamage on your item and call damageItem on the given ItemStack in onItemRightClick(). Also version 1.8 is unsupported in this forum. Do not expect 1.8 posts to get answers. Even if someone answers do not expect answers to be correct. Your posts might even get removed or closed. You might want to upgrade to the latest version of Minecraft and Forge. Edited September 15, 20178 yr by Busti PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
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.