Jump to content

Recommended Posts

Posted

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.

Posted (edited)

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 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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