Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] B3D model EntityItem transformations


Recommended Posts

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

Link to post
Share on other sites

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).

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

Link to post
Share on other sites

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());

Link to post
Share on other sites

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.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to post
Share on other sites

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.

Link to post
Share on other sites
  • 4 weeks later...

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.   Restore formatting

  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.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I'm reworking vanilla enchanting mechanics for my mod, and need to completely replace the functionality of vanilla enchanting tables and anvils. I have 2 new tile entity blocks set up, and I'm working on their functionality at the moment. When they're done, how would I replace the vanilla blocks with them? Alternatively, how would I replace the tile entity of the vanilla blocks with my own tile entities?
    • This is the crash report  Description: Initializing game java.lang.NoClassDefFoundError: slimeknights/tconstruct/library/client/MaterialRenderInfo     at lucraft.mods.lucraftcore.LCConfig$Materials.<init>(LCConfig.java:108)     at lucraft.mods.lucraftcore.LCConfig.<clinit>(LCConfig.java:36)     at lucraft.mods.lucraftcore.addonpacks.AddonPackHandler.getAddonPacksDir(AddonPackHandler.java:61)     at lucraft.mods.lucraftcore.core.LCClientHooks.insertAddonPackResourcePacks(LCClientHooks.java:37)     at net.minecraft.client.Minecraft.func_110436_a(Minecraft.java:789)     at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:247)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)     at net.minecraft.client.main.Main.main(SourceFile:123)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.ClassNotFoundException: slimeknights.tconstruct.library.client.MaterialRenderInfo     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 15 more Caused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace:     at lucraft.mods.lucraftcore.LCConfig$Materials.<init>(LCConfig.java:108)     at lucraft.mods.lucraftcore.LCConfig.<clinit>(LCConfig.java:36)     at lucraft.mods.lucraftcore.addonpacks.AddonPackHandler.getAddonPacksDir(AddonPackHandler.java:61)     at lucraft.mods.lucraftcore.core.LCClientHooks.insertAddonPackResourcePacks(LCClientHooks.java:37)     at net.minecraft.client.Minecraft.func_110436_a(Minecraft.java:789)     at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:247)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467) -- Initialization -- Details: Stacktrace:     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)     at net.minecraft.client.main.Main.main(SourceFile:123)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    • So I started my mods and this error popped up  The game crashed whilst initializing game Error: java.lang.NoClassDefFoundError: slimeknights/tconstruct/library/client/MaterialRenderInfo Exit Code: -1 which is weird since I don't have tinkers construct installed or is that something else and how do I fix this.
    • I want to use an old mod for some reason, but the forge-1.12.2-14.23.4.2764 installer does not work with the following error. java.net.preferIPv4Stack=true Exception in thread "main" java.lang.reflect.InvocationTargetException     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at java.lang.reflect.Method.invoke(Unknown Source)     at net.minecraftforge.installer.Java6Gate.main(Java6Gate.java:48) Caused by: java.lang.ExceptionInInitializerError     at net.minecraftforge.installer.ClientInstall.getSponsorMessage(ClientInstall.java:401)     at net.minecraftforge.installer.InstallerAction.getSponsorMessage(InstallerAction.java:60)     at net.minecraftforge.installer.InstallerPanel.updateFilePath(InstallerPanel.java:334)     at net.minecraftforge.installer.InstallerPanel.<init>(InstallerPanel.java:315)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:167)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:54)     ... 5 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 1     at net.minecraftforge.installer.MirrorData.buildMirrorList(MirrorData.java:84)     at net.minecraftforge.installer.MirrorData.<init>(MirrorData.java:63)     at net.minecraftforge.installer.MirrorData.<clinit>(MirrorData.java:17)     ... 11 more Is there a way to install this version other than the installer? The method of copying and overwriting the version of the .minecraft folder according to the explanation site on the net did not work. I don't want such an answer [1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.]
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.