ItemPhysic compatibility issue
CreativeMD opened this issue ยท 5 comments
Hey there,
I'm the author of ItemPhysic and recently somebody reported me an issue with your mod. It looks like my mod makes the items in your "table" spin:
ItemPhysic modifies the itemstack renderer, but only if the age of the given entity item is greater than 0. This actually fixed all compatibility issues so far. I don't know if that is possible in your case. If not we have to figure out a different way to solve the issue. Do you have any idea how ItemPhysic could detect whether the item is in the table or not?
In Regards
CreativeMD
I'm not really a fan of a blacklist in this case, as I have to iterate through it each frame for each item. Furthermore most mods allow all items to be placed in their tables so it would only fix the issue partially.
Do you need the age of the entity item for rendering? If so, I can also add a boolean field to the entity which would allow you to mark it as an special item using reflections (itemphysic could skip it then).
You can't really see it here, but placing a glass lens on the table makes it spin frantically below the face of the relay. I wasn't able to get a good screenshot as it spun too fast. Everything still works normally though and it still channels power to the crafting table. Thank you both for wonderful mods.
Yes i do need to set the age as i'm using the default item entity rendering for this and this requires the age for the bobbing effect.
Ok, the newest version (which will be available in a few days) adds an extra field:
public boolean EntityItem.skipPhysicRenderer = false;
Just set this to true via reflections once and it will always skip the itemphysic renderer. An example implantation would be:
private static boolean triedToGetField = false;
private static Field skipPhysicRendererField;
public static void skipSpecialRenderer(EntityItem item)
{
if(skipPhysicRenderer != null)
{
if(triedToGetField)
return ;
try{
skipPhysicRendererField = ReflectionHelper.findField(EntityItem.class, "skipPhysicRenderer");
}catch(Exception e) {
triedToGetField = true;
}
}
skipPhysicRendererField.setBoolean(item, true);
}
Hope this is solves the issue, if you are not happy with it just let me know.