Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.