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

So, i'm working on making a grappling hook. The actual hook itself is a EntityHook, like the fishing rod uses a EntityFishHook. The problem is, i need some way to store the EntityHook after i spawn it. Looking at the fishing rod, it uses the EntityPlayer.fishEntity field, which i can't since i'm using a EntityHook, not a EntityFishHook. Adding a field to the actual item won't work either, since that means it's shared across all instances of that item, and would probably glitch out. I looked into saving it to the player NBT thing, but i don't think you can write entities to it. Another possibility would be using ASM to add a new field to EntityPlayer, similar to fishEntity. What would be the best approach here?

I had this issue with a few items in my mod.

 

The end solution?

 

Use a PlayerTracker, and a HashMap or similar to store the player instances and their corresponding Hook instances.  No need to edit base classes.  You would just query PlayerTracker.instance().getHookForPlayer() or similar, and set through PlayerTracker.instance().setHookForPlayer(EntityHook ent)

 

If persistence across saves is needed, you can save all of the data out to a custom NBT file.

 

Offtimes modding in MC is a game of compromise because of base-classes and inabilty to alter them.

  • Author

I had this issue with a few items in my mod.

 

The end solution?

 

Use a PlayerTracker, and a HashMap or similar to store the player instances and their corresponding Hook instances.  No need to edit base classes.  You would just query PlayerTracker.instance().getHookForPlayer() or similar, and set through PlayerTracker.instance().setHookForPlayer(EntityHook ent)

 

If persistence across saves is needed, you can save all of the data out to a custom NBT file.

 

Offtimes modding in MC is a game of compromise because of base-classes and inabilty to alter them.

 

Very interesting, hadn't thought of that. Will look into it!

Did this ever work? I too am trying to make a strong version of the Fishing rod, however the Hook Entity does not like to function. I believe it due to entityplayer.fishEntity and the hardcoded

if (par1ItemStack.itemID == Item.fishingRod.shiftedIndex && this.fishEntity != null)

        {

            var3 = par1ItemStack.getIconIndex() + 16;

        }

 

=/

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.