While testing one of my mods alongside some others, I got this crash that I can't figure out:
Important part:
java.lang.ClassCastException: java.lang.reflect.Field cannot be cast to java.lang.Byte
at net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641)
Here's what I figured out myself:
First, here's net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641):
public boolean isHandActive()
{
return (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
}
HAND_STATES is declared as a DataParameter<Byte>, so all through this next part, T is Byte. Next, here's this.dataManager.get:
public <T> T get(DataParameter<T> key)
{
return (T)this.getEntry(key).getValue();
}
And here's getValue:
public T getValue()
{
return this.value;
}
And finally, here's value:
private T value;
I don't get how a Field could have gotten as far as it did. "value" is declared as type T, as are the return values of getValue() and get(). Even get() itself has an explicit cast to T. Where did the Field come from here, and why didn't it crash anywhere prior to isHandActive where it must have been shoehorned into an inappropriate variable?