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
  • Author
1 hour ago, diesieben07 said:

Okay, you just vomited a huge chunk of code into gists without even enabling syntax-highlighting.

Please, at the very least, explain what your issue is, except "troubles with many idk things".

2

Your right and I am sorry.

 

I am trying to use ShoutSetBook code to change the NBT of the ShoutBook  item so that it runs the shout by right-clicking but, I can't seem to get the shout to cast and I don't know what's wrong.

 

I hope that explains that better.

https://gist.github.com/OtisGoodman/96da24295c450bc02f4d58890ef60faf#file-shoutbook-L59

https://gist.github.com/OtisGoodman/96da24295c450bc02f4d58890ef60faf#file-shoutbook-L124

So if the stack has no NBTTag you create a new one and then do nothing with it. You need to assign it to the stack with ItemStack#setTagCompound

 

https://gist.github.com/OtisGoodman/487e771261a107a451c20d97f7712504#file-cmdshout-L45

Any particular reason you are implementing ICommand directly instead of using CommandBase?

  • Author

The NBT problem is fixed but I have another.

I am not sure if my if statement that checks if the player is holding the shout book is working, can someone take a look and correct me if I am wrong.

Shout Book Item Class https://gist.github.com/OtisGoodman/96da24295c450bc02f4d58890ef60faf

Shout Set Book Class: https://gist.github.com/OtisGoodman/57480c48b4dc516cb11bf4dad7a353a5

 

  • Author
2 hours ago, diesieben07 said:
  • You cannot do this. Data like that must be stored in the ItemStack (like you already do). You cannot store it in the Item instance in any way.
  • You cannot compare strings using ==.
  •  Use TextComponentTranslation instead of TextComponentString + I18n. Otherwise you are translating on the server and you will always get English.
  •  You cannot compare ItemStacks using ==.

Thanks that helped what is the best way to compare strings and item stacks?

43 minutes ago, Otis Goodman said:

Thanks that helped what is the best way to compare strings and item stacks?

String are Objects, not primitives - even though they are given special handling in java. They override the equals method so string1.equals(string2). ItemStack has a number of methods starting with areItemStacksEqual to compare 2 stacks

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

12 hours ago, Otis Goodman said:

Ok, nearly working my last problem is when I right click on the book the shout cast's twice.

Maybe check if world is remote? I've had this problem before with duplicate events.

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.