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

Hi,

 

how can I override, or extend EntityFishHook.class and use the new Class instead of the old? If im extending the EntityFishHook.class how can I register it? Should it looks like this:

 

EntityRegistry.registerModEntity(NewEntityFishHook.class, ... I dont know ...);

 

Thank you :)

You shouldn't need to replace it. FishingHooks.java provides many helper functions to add and remove fish, junk, and treasure.

Maker of the Craft++ mod.

  • Author

I am trying to "extend" the vanilla entity, which means that all methods and so on are the same, and do the same. But some methods are able to do additional things e.g. showing information on gui, if a fish "is coming".

 

I dont want add/remove fish, junk and treasure.

  • Author

I want this: So you are trying to replace the vanilla entity?  And thats the answer of your question. -Yes

I tried this: Or make your own that is similar?

 

But whats the difference between replacing the vanilla entity and make an own that is similar?

 

 

  • Author

Tricky or imposible?

 

Can I create my own NewEntityFishHook.class and override the vanilla with this?

 

EntityRegistry.registerModEntity(NewEntityFishHook.class, ... ,I dont know, ...);

Registering the entity doesn't magically make the ItemFishingRod class spawn it when used.

 

And that bit you don't know?  It's either strings or ints, which are largely irrelevant.  Meaning you can put fuckanything in and it'll work.  But it still doesn't magically make the Fishing rod use the new lure.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Why not use the EntityJoinWorldEvent? Just cancel it and spawn your own fishing hook.

- Make sure to check if the entity is the vanilla fishing hook by checking if the class of the entity (

entity#getClass()

) is equal to the EntityFishingHook class (

EntityFishingHook#class

)

- cancel the event to prevent spawning the original

- apply every value from the vanilla entity to yours (motion, position, etc.)

- spawn your custom entity

 

But why do you need to replace the hook entirely? Does the FishingHooks.java not suffice? What do you want to do with it?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

But why do you need to replace the hook entirely? Does the FishingHooks.java not suffice? What do you want to do with it?

 

He answered that already:

 

But some methods are able to do additional things e.g. showing information on gui, if a fish "is coming".

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

But why do you need to replace the hook entirely? Does the FishingHooks.java not suffice? What do you want to do with it?

 

He answered that already:

 

But some methods are able to do additional things e.g. showing information on gui, if a fish "is coming".

 

Oh, didn't see that one. So yeah, the EntityJoinWorldEvent should be used to replace it then.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

The problem with this is that you won't be able to reel the fish hook back in.

Maker of the Craft++ mod.

  • Author
Why not use the EntityJoinWorldEvent? Just cancel it and spawn your own fishing hook.

- Make sure to check if the entity is the vanilla fishing hook by checking if the class of the entity (entity#getClass()) is equal to the EntityFishingHook class (EntityFishingHook#class)

- cancel the event to prevent spawning the original

- apply every value from the vanilla entity to yours (motion, position, etc.)

- spawn your custom entity

 

According to your post, I added this method to the Eventhandler class:

 

@SubscribeEvent
public void fishJoinEvent(EntityJoinWorldEvent event){
if(event.getClass().equals(EntityFishHook.class)){
	System.out.println("here it is!");
}
}

 

Unfortunately nothing happend...

 

What are the next steps? How can I spawn my own entity?

 

I also tried to use this:

 

RenderingRegistry.registerEntityRenderingHandler(EntityFishHook.class, new RenderFish(Need a Rendermanager));

 

In this case I should able to create a custom RenderFish. Can I get the information which I need in RenderFish?

 

 

  • Author

In the main class of my mod:

 

(head of the class)

MyEventHandler handler = new MyEventHandler();

 

and then in:

 

@EventHandler
public void preinit(FMLPreInitializationEvent preevent){

MinecraftForge.EVENT_BUS.register(handler);
//some code here
}

 

The Eventhandler is working, because my other SubscribeEvents like RenderGameOverlayEvent or ClientChatReceivedEvent are working.

  • Author

Ups... -->  event.entity.getClass()  :)

 

[23:44:13] [server thread/INFO] [sTDOUT]: [MyEventHandler:fishJoinEvent:22]: its a fishing hook

[23:44:13] [Client thread/INFO] [sTDOUT]: [MyEventHandler:fishJoinEvent:22]: its a fishing hook

 

My Code must only work on clientside, how can i reach this?

 

What are the next steps to:

- cancel the event to prevent spawning the original

- apply every value from the vanilla entity to yours (motion, position, etc.)

- spawn your custom entity

 

Since this is client-only I assume you want to display something (as you told few posts before). What exacly do you want to do with what data that should be in your customHook?

 

EntityFishHook is an Entity, that means you can use IExtendedEntityProperties to store additional info. To render ANY kind of stuff that would be inside either EntityFishHook or IEEP you can use RenderWorldLastEvent to find hook in world and even render labels with info above it. You can also use RenderGameOverlayEvent to add custom info on your game screen when fishEntity field in player is not null.

 

Possibilities = endless.

Also - yes, this can be done for client-only, as long as you won't be keeping any data that should be shared with server.

 

Now what exacly is that you want?

1.7.10 is no longer supported by forge, you are on your own.

But the fishing properties are on the server side. Use packets.

Sorry if I screwed up again.

Maker of the Craft++ mod.

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.