Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] B3D model EntityItem transformations
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
Wehavecookies56

[1.8] B3D model EntityItem transformations

By Wehavecookies56, September 25, 2015 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted September 25, 2015

So I have an item which is using a .b3d model which is working great. The model is huge so I have to scale it down as well as adjust the rotations. But when I drop the item on the floor none of the transformations are applied. I was wondering how you would transform the model when it is on the ground.

Here's what it looks like on the ground. As you can see it is huge.

twhptYI.png

  • Quote

Share this post


Link to post
Share on other sites

Ernio    597

Ernio

Ernio    597

  • Reality Controller
  • Ernio
  • Forge Modder
  • 597
  • 2638 posts
Posted September 25, 2015

Proper way of handling such stuff is to extend EntityItem with CustomEntityItem (you can also use it do anything else you want, not just rendering).

 

For vanilla items:

Subscribe to EntityJoinWorldEvent - check if event.entity instanceof EntityItem, if so - cancel normal spawning and spawn your own CustomEntityItem.

Note that while you can cancel joining on both sides (doesn't matter really), the spawning occurs only on server side.

 

For your own:

Item#hasCustomEntity and Item#createEntity to spawn a custom EntityItem

 

Next:

Extend RenderEntityItem / RenderItem and edit it with what you require.

 

In ClientProxy#init() (NOT preInit), call:

RenderingRegistry.registerEntityRenderingHandler(CustomEntityItem.class, new RenderCustomEntityItem());

 

As of now you can use custom rendering implementation to all items in world replaced by your CustomEntityItem. (You can/don't have to even use model system).

  • Quote

Share this post


Link to post
Share on other sites

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted September 25, 2015

Proper way of handling such stuff is to extend EntityItem with CustomEntityItem (you can also use it do anything else you want, not just rendering).

 

For vanilla items:

Subscribe to EntityJoinWorldEvent - check if event.entity instanceof EntityItem, if so - cancel normal spawning and spawn your own CustomEntityItem.

Note that while you can cancel joining on both sides (doesn't matter really), the spawning occurs only on server side.

 

For your own:

Item#hasCustomEntity and Item#createEntity to spawn a custom EntityItem

 

Next:

Extend RenderEntityItem / RenderItem and edit it with what you require.

 

In ClientProxy#init() (NOT preInit), call:

RenderingRegistry.registerEntityRenderingHandler(CustomEntityItem.class, new RenderCustomEntityItem());

 

As of now you can use custom rendering implementation to all items in world replaced by your CustomEntityItem. (You can/don't have to even use model system).

 

Thanks Ernio!

 

I've just tried this but the renderer is not working. The dropped item still has the same appearance. I've probably done something wrong.

 

Here's my Entity class

public class EntityItemMetalChocobo extends EntityItem {

public EntityItemMetalChocobo(World world) {
	super(world);
}

public EntityItemMetalChocobo(World worldIn, double x, double y, double z, ItemStack stack) {
	super(worldIn, x, y, z, stack);
}
}

 

Here's my RenderEntityItem class

public class RenderEntityItemMetalChocobo extends RenderEntityItem {

public RenderEntityItemMetalChocobo() {
	super(Minecraft.getMinecraft().getRenderManager(), Minecraft.getMinecraft().getRenderItem());
	System.out.println("Render Entity Item");
}

@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks) {
	GlStateManager.scale(0.02f, 0.02f, 0.02f);
}

}

 

Here's my item class

public class ItemMetalChocobo extends ItemKeyblade {

public ItemMetalChocobo(ToolMaterial material) {
	super(material);
}

@Override
public boolean hasCustomEntity(ItemStack stack) {
	return true;
}

@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
	return new EntityItemMetalChocobo(world, location.posX, location.posY, location.posZ, itemstack);
}

}

 

And finally here's what I put in the client proxy init

RenderingRegistry.registerEntityRenderingHandler(EntityItemMetalChocobo.class, new RenderEntityItemMetalChocobo());

  • Quote

Share this post


Link to post
Share on other sites

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted September 25, 2015

It seems like the RenderEntityItemMetalChocobo isn't being used as when trying to print something in the constructor it never prints. And changing anything in the class does nothing to it.

  • Quote

Share this post


Link to post
Share on other sites

EverythingGames    19

EverythingGames

EverythingGames    19

  • Diamond Finder
  • EverythingGames
  • Forge Modder
  • 19
  • 388 posts
Posted September 25, 2015

It seems like the RenderEntityItemMetalChocobo isn't being used as when trying to print something in the constructor it never prints. And changing anything in the class does nothing to it.

 

That's probably because your rendering class is never being called. It's called when your custom entity item is spawned, and you haven't done that yet. Your entity class and rendering class looks good, you just need to subscribe to the EntityJoinWorldEvent and spawn your custom entity item there.

 

EDIT: Not sure if the custom entity item is assigned to your item by overriding item methods like you did above. If you don't get that working, I would try the suggestion above.

  • Quote

Share this post


Link to post
Share on other sites

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted September 25, 2015

It seems like the RenderEntityItemMetalChocobo isn't being used as when trying to print something in the constructor it never prints. And changing anything in the class does nothing to it.

 

That's probably because your rendering class is never being called. It's called when your custom entity item is spawned, and you haven't done that yet. Your entity class and rendering class looks good, you just need to subscribe to the EntityJoinWorldEvent and spawn your custom entity item there.

 

EDIT: Not sure if the custom entity item is assigned to your item by overriding item methods like you did above. If you don't get that working, I would try the suggestion above.

 

The entity is spawning fine, I checked that by making it print stuff. Item#createEntity handles the spawning so there is no need to use EntityJoinWorldEvent unless you are changing the entity of a vanilla item like Ernio stated. Although the custom entity spawns fine the render class doesn't seem to work at all.

  • Quote

Share this post


Link to post
Share on other sites

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted September 28, 2015

I still can't get it to render.

  • Quote

Share this post


Link to post
Share on other sites

Wehavecookies56    0

Wehavecookies56

Wehavecookies56    0

  • Tree Puncher
  • Wehavecookies56
  • Members
  • 0
  • 33 posts
Posted October 22, 2015

Bump, it's been almost a month

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • plugsmustard
      on/off button for custom furnace

      By plugsmustard · Posted just now

      buf.writeBlockPos(pos);
    • J0WAY
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY · Posted 4 minutes ago

      protected void setEquipmentBasedOnDifficult(DifficultyInstance difficulty)     {         this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModItems.BARBARIAN_SWORD));     }
    • thedarkcolour
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour · Posted 4 minutes ago

      Am I able to setBlockState with IWorldGenerationReader?
    • Draco18s
      [1.14.4] [UNSOLVED] Server Thread Freezes After Entity Explodes

      By Draco18s · Posted 9 minutes ago

      No, it will outright crash the dedicated server. You can't do this at all. You want to send a message to a player you need to send a message to a player.
    • Draco18s
      [1.14] layout of a modpack

      By Draco18s · Posted 14 minutes ago

      Classic sign of someone who isn't interested in producing content that actually works.
  • Topics

    • plugsmustard
      37
      on/off button for custom furnace

      By plugsmustard
      Started Wednesday at 03:11 PM

    • J0WAY
      5
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started 18 hours ago

    • thedarkcolour
      17
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour
      Started Yesterday at 06:04 AM

    • saxon564
      4
      [1.14.4] [UNSOLVED] Server Thread Freezes After Entity Explodes

      By saxon564
      Started 10 hours ago

    • JetCobblestone
      7
      [1.14] layout of a modpack

      By JetCobblestone
      Started 21 hours ago

  • Who's Online (See full list)

    • plugsmustard
    • Fifou_BE
    • Snailtan
    • EULTI
    • raulllano
    • spider1286
    • bsrgin
    • thedarkcolour
    • Draco18s
    • J0WAY
    • diesieben07
    • tomatoBhutan
    • StefanDeSterke
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] B3D model EntityItem transformations
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community