Cache Part Constructor.
This commit is contained in:
@@ -191,7 +191,12 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
PartType t = getTypeByStack( is );
|
||||
if ( t != null )
|
||||
return t.getPart().getConstructor( ItemStack.class ).newInstance( is );
|
||||
{
|
||||
if ( t.constructor == null )
|
||||
t.constructor = t.getPart().getConstructor( ItemStack.class );
|
||||
|
||||
return t.constructor.newInstance( is );
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -112,6 +113,8 @@ public enum PartType
|
||||
private final GuiText extraName;
|
||||
public final int baseDamage;
|
||||
|
||||
public Constructor<? extends IPart> constructor;
|
||||
|
||||
PartType(int baseMetaValue, AEFeature part, Class<? extends IPart> c) {
|
||||
this( baseMetaValue, part, c, null );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user