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 just started with the Forge development, but I was wondering if there was a way, that specific items (Vanilla, non-Vanila) could be rendered twice as big when dropped.

 

What I mean with that is, if I could render dropped items 2x as big?

 

I've looked around, but haven't found anything about overriding renderers, so I'm guessing it would have to be done via lwjgl.

 

Also, how do I check for specific item type, something like `Material.OAK_LOG` from the Bukkit?

I'm currently checking it like this:

int id = Item.getIdFromItem(e.getEntityItem().getItem().getItem());
if(id == 770){
    // Dropped item is a player head!
}

But I'm unsure if it's the correct way to do it.

 

If this post should be split into two, let me know.

Edited by MGlolenstine

  • Author
1 minute ago, diesieben07 said:

First of all, do not use numerical IDs. They will change! Use the constants in the Items class.

 

You would have to replace the entity for the items you want to change (EntityJoinWorldEvent) with a custom entity and then have a custom renderer for those entities.

I have no idea how I missed the `Items` class... ?‍♂️ Thanks for the tip!

 

And this event it an interesting one... I was looking for one that would be something like `ItemTossedEvent` or something similar, but I guess this is the way to go!

 

As far as the replacing goes, I'd have to "destroy" the entity and then spawn a new custom one on the same position?

Any hints on how I'd go about getting the same renderer?

 

Thanks for your help!

  • Author
3 minutes ago, diesieben07 said:

EntityJoinWorldEvent is cancellable. If you cancel it, the entity will not be spawned. You can then immediately spawn your replacement in it's place.

Forge uses this to implement IForgeItem#createEntity, which allows items to override their own entity, check out ForgeInternalHandler#onEntityJoinWorld. 

 

The default item renderer is ItemRenderer. You can make your own class which extends it and simply adds the magnification.

This all seems nice :D Thanks for the answer!

 

Just one more question... I wanna do this on the client-side only... Will the replacement of the entity mess up with the pickup? Or do I just replace the item on the pickup?

I'm a still bit wary about these things, probably because I'm new :)

 

Edited by MGlolenstine

  • Author
4 minutes ago, diesieben07 said:

There is no safe way to do this completely client-side, you'd have to override the entire item rendering, which might cause problems with other mods.

Hmm... Would there exist a way to override only one texture? Apparently you can change exactly what I want with a normal resource pack. I could add a resource pack that only changed one item to the mod and then just swap it so that only that one texture changes.

 

Do you think that this would be feasible?

Edited by MGlolenstine

  • Author
Just now, diesieben07 said:

Mods are resource packs as well. They have all the features that resource packs also have.

Oh, then that's a lot more feasible than recoding the whole `ItemRenderer` ;)

I'll do that then! Thanks for your help!

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.