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, I just created a custom projectile which works fine on singleplayer and functions in multiplayer, however in multiplayer other nearby players cannot see this projectile (they can still get hit and hurt by it).

 

Do I need to implement custom packets for each entity I implement, or should this be done automatically.

 

creating the hook: (EntityHook extends throwable)

EntityHook hook = new EntityHook(par2World, par3EntityPlayer);
par2World.spawnEntityInWorld(hook);

 

I have registered the renderer int he client proxy:

 

RenderingRegistry.registerEntityRenderingHandler(EntityHook.class, new RenderHook());

 

And also I registered the entity:

 

EntityRegistry.registerGlobalEntityID(EntityHook.class, "Hook", EntityRegistry.findGlobalUniqueEntityId());

 

So is there something I've missed? Would really appreciate some help.

Are you sure you are spawning the new projectile on the server? Check this by implementing the follow check:

 

if(!par2World.isRemote){
    EntityHook hook = new EntityHook(par2World, par3EntityPlayer);
    par2World.spawnEntityInWorld(hook);
}

  • Author

Thanks, just made the change.

 

Implemented the check and now even the player shooting the projectile cannot see it. This seems to suggest that no clients are getting notified about the projectile by the server. Any ideas for how to correct this?

 

Projectiles function mostly, although the pull mechanic is now not working. (Is minecraft movement handled clientside???)

I believe that movement is done through the server, then rendered through the client. Not sure if that was the question. I think you may need to use a packet to handle the spawning, anyways check if the entity is spawned correctly by adding this code to the update method:

 

if(!this.worldObj.isRemote){
    System.out.println("[server] Ticked on server.");
}

If you see this message in the console, then you for sure will know that the entity is spawned on the server side.

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.