Some more cleanup.

This commit is contained in:
Matthew Messinger 2015-09-01 22:18:45 -04:00
parent 3f1e6a84f4
commit 667ab41d24
21 changed files with 316 additions and 537 deletions

View file

@ -100,7 +100,7 @@ public class Pony {
}
}
} catch (Exception var5) {
;
}
}
@ -324,9 +324,8 @@ public class Pony {
this.previousFallDistance = fallDistance;
if (fallDistance < 2.0F) {
return false;
} else {
return pegasusFlying = true;
}
return pegasusFlying = true;
}
}
}
@ -388,10 +387,6 @@ public class Pony {
this.villagerProfession = profession;
}
public void setIsPonySkin(boolean b) {
this.isPonySkin = false;
}
public static enum PonyRace {
EARTH,
PEGASUS,

View file

@ -48,23 +48,19 @@ public class PonyConfig extends ModConfig {
} catch (Exception var8) {
int defaultValue1 = this.getDefaultIntProperty(key);
this.setProperty(key, defaultValue1);
MineLPLogger.error("Invalid value for config key \"%s\", using default value %d",
new Object[] { key, Integer.valueOf(defaultValue1) });
MineLPLogger.error("Invalid value for config key \"%s\", using default value %d", key, defaultValue1);
return defaultValue1;
}
}
if (value >= minValue && value <= maxValue) {
return value;
} else {
int defaultValue = value = this.getDefaultIntProperty(key);
this.setProperty(key, defaultValue);
MineLPLogger.error(
"Invalid value for config key \"%s\", using default value %d. Found %d, expected value between %d and %d.",
new Object[] { key, Integer.valueOf(defaultValue), Integer.valueOf(value),
Integer.valueOf(minValue), Integer.valueOf(maxValue) });
return defaultValue;
}
int defaultValue = value = this.getDefaultIntProperty(key);
this.setProperty(key, defaultValue);
MineLPLogger.error("Invalid value for config key \"%s\", using default value %d. Found %d, expected value between %d and %d.",
key, defaultValue, value, minValue, maxValue);
return defaultValue;
}
public boolean isSet(String key) {

View file

@ -119,9 +119,8 @@ public class PonyManager {
}
return backgroundPonyResourceLocations.get(backgroundIndex);
} else {
return defaultPonyResourceLocation;
}
return defaultPonyResourceLocation;
}
public Pony getPonyFromBackgroundResourceRegistry(AbstractClientPlayer player) {

View file

@ -31,7 +31,7 @@ public class FakeVoxelPropertyCheckBox extends VoxelProperty<IVoxelPropertyProvi
}
}
} catch (Exception var7) {
;
}
host.drawTessellatedModalBorderRect(LiteModVoxelCommon.GUIPARTS, 256, this.xPosition, this.yPosition,
@ -55,7 +55,7 @@ public class FakeVoxelPropertyCheckBox extends VoxelProperty<IVoxelPropertyProvi
}
}
} catch (Exception var5) {
;
}
if (checked) {

View file

@ -25,25 +25,6 @@ public class VoxelPropertyIntSlider extends VoxelProperty<IVoxelPropertyProvider
String maxText;
String labelText;
public VoxelPropertyIntSlider(IVoxelPropertyProviderInteger parent, String binding, String text, String minText,
String maxText, int xPos, int yPos, int min, int max) {
this(parent, binding, text, minText, maxText, xPos, yPos);
this.minValue = min;
this.maxValue = max;
}
public VoxelPropertyIntSlider(IVoxelPropertyProviderInteger parent, String binding, String text, int xPos, int yPos,
float min, float max) {
this(parent, binding, text, xPos, yPos);
}
public VoxelPropertyIntSlider(IVoxelPropertyProviderInteger parent, String binding, String text, String minText,
String maxText, int xPos, int yPos) {
this(parent, binding, text, xPos, yPos);
this.minText = minText;
this.maxText = maxText;
}
public VoxelPropertyIntSlider(IVoxelPropertyProviderInteger parent, String binding, String text, int xPos,
int yPos) {
super(parent, binding, text, xPos, yPos);

View file

@ -12,7 +12,7 @@ public abstract class ModelArmor {
public float layer() {
return 1;
};
}
public int subimage(int slot) {
return slot == 2 ? 2 : 1;

View file

@ -42,10 +42,20 @@ public abstract class ModelPony extends ModelPlayer {
this.strech = strech;
}
/**
* @param var1
* @param var2
*/
public void init(float var1, float var2) {}
/**
* @param var1
*/
public void animate(AniParams var1) {}
/**
* @param var1
*/
public void render(AniParams var1) {}
@Override

View file

@ -321,6 +321,9 @@ public class pm_newPonyAdv extends ModelPony {
this.adjustLegs();
}
/**
* @param tick
*/
protected void rotateLegs(float move, float swing, float tick) {
float rightArmRotateAngleX;
float leftArmRotateAngleX;
@ -690,6 +693,9 @@ public class pm_newPonyAdv extends ModelPony {
this.Bodypiece[13].rotateAngleX += 0.5F;
}
/**
* @param move
*/
protected void fixSpecialRotationPoints(float move) {}
public void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) {

View file

@ -37,6 +37,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
throw new InstantiationError("Overlay classes must not be instantiated");
}
@SuppressWarnings("unused")
@AppendInsns("<init>")
private void init(RenderManager renderManager, boolean useSmallArms) {
this.playerModel = PMAPI.newPonyAdv;
@ -117,6 +118,7 @@ public abstract class RenderPony extends RendererLivingEntity implements IRender
this.playerModel.armor.modelArmorChestplate.heldItemRight = this.playerModel.armor.modelArmor.heldItemRight = this.playerModel.model.heldItemRight = 0;
}
@SuppressWarnings("unused")
@AppendInsns("renderLivingAt")
@Obfuscated({ "a", "func_77039_a" })
public void setupPlayerScale(AbstractClientPlayer player, double xPosition, double yPosition, double zPosition) {

View file

@ -111,7 +111,8 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
return this.getEntityTexture((T) var1);
}
protected void preRenderCallback(T t, float partick) {}
@SuppressWarnings("unused")
protected void preRenderCallback(T entity, float partick) {}
@SuppressWarnings("unchecked")
@Override
@ -119,6 +120,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
preRenderCallback((T) entitylivingbaseIn, partialTickTime);
}
@SuppressWarnings("unused")
protected void rotateCorpse(T entity, float xPosition, float yPosition, float zPosition) {}
@SuppressWarnings("unchecked")

View file

@ -116,6 +116,7 @@ public class LayerHeldPonyItem implements LayerRenderer {
}
}
@SuppressWarnings("unused")
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, int glowColor) {
// TODO reimplement
}

View file

@ -197,10 +197,8 @@ public class LayerPonyArmor implements LayerRenderer {
Object[] armorResourceAndState = this.getPonyResourceLocation(path);
renderer.bindTexture((ResourceLocation) armorResourceAndState[0]);
return ((Boolean) armorResourceAndState[1]).booleanValue();
} else {
// this.a(RenderBiped.func_110858_a(armorPiece., slot, overlay));
return false;
}
return false;
}
protected boolean bindForgeArmorTexture(Entity playerEntity, ItemStack armorStack, ItemArmor armorPiece, int slot,
@ -251,12 +249,10 @@ public class LayerPonyArmor implements LayerRenderer {
try {
TextureUtil.readImageData(Minecraft.getMinecraft().getResourceManager(), ponyArmorResource);
if (ponyArmorResource != null) {
ponyResourceLocation = ponyArmorResource;
ponyArmorMap.put(path, ponyArmorResource);
onlyPonyArmorMap.put(path, ponyArmorResource);
ponyArmor = true;
}
ponyResourceLocation = ponyArmorResource;
ponyArmorMap.put(path, ponyArmorResource);
onlyPonyArmorMap.put(path, ponyArmorResource);
ponyArmor = true;
} catch (IOException var7) {
ponyResourceLocation = field_110859_k.get(path);
if (ponyResourceLocation == null) {

View file

@ -59,7 +59,7 @@ public class LayerPonySkull implements LayerRenderer {
}
color(1, 1, 1, 1);
if (item instanceof ItemBlock) {
renderBlock(entity, itemstack, isVillager);
renderBlock(entity, itemstack);
} else if (item == Items.skull) {
if (model instanceof pm_newPonyAdv) {
translate(0, 0, -.15);
@ -71,7 +71,7 @@ public class LayerPonySkull implements LayerRenderer {
}
private void renderBlock(EntityLivingBase entity, ItemStack itemstack, boolean isVillager) {
private void renderBlock(EntityLivingBase entity, ItemStack itemstack) {
// translate(0, -0.25, 0);
rotate(180, 0, 1, 0);
scale(0.625, -0.625, -0.625);

View file

@ -26,13 +26,13 @@ public class MineLPRData {
return e.newInstance(params);
}
return e.newInstance(new Object[0]);
return e.newInstance();
}
MineLPLogger.error("Unknown requested constructor \"%s\"", new Object[] { constructorName });
MineLPLogger.error("Unknown requested constructor \"%s\"", constructorName);
} catch (Exception var4) {
var4.printStackTrace();
MineLPLogger.error("Error when trying to get constructor \"%s\"", new Object[] { constructorName });
MineLPLogger.error("Error when trying to get constructor \"%s\"", constructorName);
}
return null;
@ -49,10 +49,10 @@ public class MineLPRData {
return e.get(object);
}
MineLPLogger.error("Unknown requested field \"%s\"", new Object[] { fieldName });
MineLPLogger.error("Unknown requested field \"%s\"", fieldName);
} catch (Exception var4) {
var4.printStackTrace();
MineLPLogger.error("Error when trying to get field \"%s\"", new Object[] { fieldName });
MineLPLogger.error("Error when trying to get field \"%s\"", fieldName);
}
return null;
@ -64,13 +64,12 @@ public class MineLPRData {
Field e = this.fields.get(fieldName);
e.set(object, value);
return true;
} else {
MineLPLogger.error("Unknown requested field \"%s\"", new Object[] { fieldName });
return false;
}
MineLPLogger.error("Unknown requested field \"%s\"", fieldName);
return false;
} catch (Exception var5) {
var5.printStackTrace();
MineLPLogger.error("Error when trying to set field \"%s\"", new Object[] { fieldName });
MineLPLogger.error("Error when trying to set field \"%s\"", fieldName);
return false;
}
}
@ -79,36 +78,33 @@ public class MineLPRData {
try {
if (this.methods.containsKey(methodName)) {
Method e = this.methods.get(methodName);
return params != null ? e.invoke(object, params) : e.invoke(object, new Object[0]);
} else {
MineLPLogger.error("Unknown requested method \"%s\"", new Object[] { methodName });
return null;
return params != null ? e.invoke(object, params) : e.invoke(object);
}
MineLPLogger.error("Unknown requested method \"%s\"", methodName);
return null;
} catch (Exception var5) {
var5.printStackTrace();
MineLPLogger.error("Method \"%s\" failed to be invoked", new Object[] { methodName });
MineLPLogger.error(
"Types: " + MineLPReflection.getStringFromTypes(MineLPReflection.getTypesFromObjects(params)));
MineLPLogger.error("Values: " + params.toString());
MineLPLogger.error("Method \"%s\" failed to be invoked", methodName);
MineLPLogger.error("Types: " + MineLPReflection.getStringFromTypes(MineLPReflection.getTypesFromObjects(params)));
MineLPLogger.error("Values: " + params);
return null;
}
}
public Class<?> getClass(String className) {
return this.classes.containsKey(className) ? (Class<?>) this.classes.get(className) : null;
return this.classes.containsKey(className) ? this.classes.get(className) : null;
}
public Constructor<?> getConstructor(String constructorName) {
return this.constructors.containsKey(constructorName) ? (Constructor<?>) this.constructors.get(constructorName)
: null;
return this.constructors.containsKey(constructorName) ? this.constructors.get(constructorName) : null;
}
public Method getMethod(String methodName) {
return this.methods.containsKey(methodName) ? (Method) this.methods.get(methodName) : null;
return this.methods.containsKey(methodName) ? this.methods.get(methodName) : null;
}
public Field getField(String fieldName) {
return this.fields.containsKey(fieldName) ? (Field) this.fields.get(fieldName) : null;
return this.fields.containsKey(fieldName) ? this.fields.get(fieldName) : null;
}
public Object getObject(String objectName) {
@ -118,7 +114,7 @@ public class MineLPRData {
}
if (object == null) {
MineLPLogger.error("Object \"%s\" is NULL", new Object[] { objectName });
MineLPLogger.error("Object \"%s\" is NULL", objectName);
}
return object;

View file

@ -18,6 +18,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
// TODO Don't use reflection during rendering
public class MineLPReflection {
public static MineLPRData forgeAPI;
@ -25,20 +26,20 @@ public class MineLPReflection {
private static boolean reflectForgeAPI(MineLPRData data) {
MineLPLogger.info("Checking ForgeAPI...");
Class<?> forgeAPIIItemRendererItemRenderType;
Class<?> forgeAPIIItemRendererItemRendererHelper;
Class<?> forgeAPIIItemRenderer;
Class<?> forgeAPIMinecraftForgeClient;
Class<?> forgeAPIForgeHooksClient;
final String frgPkg = "net.minecraftforge.client.";
Class<?> ItemRenderType = getClass(frgPkg + "IItemRenderer$ItemRenderType");
Class<?> ItemRendererHelper = getClass(frgPkg + "IItemRenderer$ItemRendererHelper");
Class<?> IItemRenderer = getClass(frgPkg + "IItemRenderer");
Class<?> MinecraftForgeClient = getClass(frgPkg + "MinecraftForgeClient");
Class<?> ForgeHooksClient = getClass(frgPkg + "ForgeHooksClient");
Class<?>[] reflectedForgeAPIClasses = new Class[] {
forgeAPIIItemRendererItemRenderType = getClass(
"net.minecraftforge.client.IItemRenderer$ItemRenderType"),
forgeAPIIItemRendererItemRendererHelper = getClass(
"net.minecraftforge.client.IItemRenderer$ItemRendererHelper"),
forgeAPIIItemRenderer = getClass("net.minecraftforge.client.IItemRenderer"),
forgeAPIMinecraftForgeClient = getClass("net.minecraftforge.client.MinecraftForgeClient"),
forgeAPIForgeHooksClient = getClass("net.minecraftforge.client.ForgeHooksClient"),
getClass("net.minecraft.src.RenderBiped") };
ItemRenderType,
ItemRendererHelper,
IItemRenderer,
MinecraftForgeClient,
ForgeHooksClient,
RenderBiped.class
};
data.installed = false;
int var9 = reflectedForgeAPIClasses.length;
byte o = 0;
@ -47,214 +48,137 @@ public class MineLPReflection {
if (enumConstants == null) {
return false;
}
data.installed = true;
}
data.putClass("ForgeHooksClient", forgeAPIForgeHooksClient);
data.putClass("IItemRenderer", forgeAPIIItemRenderer);
data.putClass("MinecraftForgeClient", forgeAPIMinecraftForgeClient);
data.putClass("IItemRenderer$ItemRenderType", forgeAPIIItemRendererItemRenderType);
data.putClass("IItemRenderer$ItemRendererHelper", forgeAPIIItemRendererItemRendererHelper);
data.putClass("ForgeHooksClient", ForgeHooksClient);
data.putClass("IItemRenderer", IItemRenderer);
data.putClass("MinecraftForgeClient", MinecraftForgeClient);
data.putClass("IItemRenderer$ItemRenderType", ItemRenderType);
data.putClass("IItemRenderer$ItemRendererHelper", ItemRendererHelper);
Method m;
data.putMethod("ForgeHooksClient.getArmorModel", m = getMethod(forgeAPIForgeHooksClient, "getArmorModel",
new Class[] { EntityLivingBase.class, ItemStack.class, Integer.TYPE, ModelBiped.class }));
data.putMethod("ForgeHooksClient.getArmorModel", m = getMethod(ForgeHooksClient, "getArmorModel", EntityLivingBase.class, ItemStack.class, Integer.TYPE, ModelBiped.class));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.getArmorTexture",
m = getMethod(forgeAPIForgeHooksClient, "getArmorTexture",
new Class[] { Entity.class, ItemStack.class, String.class, Integer.TYPE, String.class }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.orientBedCamera", m = getMethod(forgeAPIForgeHooksClient,
"orientBedCamera", new Class[] { Minecraft.class, EntityLivingBase.class }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.setRenderPass",
m = getMethod(forgeAPIForgeHooksClient, "setRenderPass", new Class[] { Integer.TYPE }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.onDrawBlockHighlight",
m = getMethod(forgeAPIForgeHooksClient, "onDrawBlockHighlight",
new Class[] { RenderGlobal.class, EntityPlayer.class,
MovingObjectPosition.class, Integer.TYPE, ItemStack.class,
Float.TYPE }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.dispatchRenderLast",
m = getMethod(forgeAPIForgeHooksClient, "dispatchRenderLast",
new Class[] { RenderGlobal.class, Float.TYPE }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("MinecraftForgeClient.getItemRenderer",
m = getMethod(forgeAPIMinecraftForgeClient, "getItemRenderer",
new Class[] { ItemStack.class, forgeAPIIItemRendererItemRenderType }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("IItemRenderer.shouldUseRenderHelper",
m = getMethod(forgeAPIIItemRenderer, "shouldUseRenderHelper",
new Class[] { forgeAPIIItemRendererItemRenderType, ItemStack.class,
forgeAPIIItemRendererItemRendererHelper }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("Item.getRenderPasses", m = getMethod(Item.class,
"getRenderPasses", new Class[] { Integer.TYPE }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("RenderBiped.getArmorResource",
m = getMethod(RenderBiped.class, "getArmorResource",
new Class[] { Entity.class, ItemStack.class, Integer.TYPE,
String.class }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("Entity.canRiderInteract",
m = getMethod(Entity.class, "canRiderInteract", new Class[0]));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("RenderGlobal.drawBlockDamageTexture",
m = getMethod(RenderGlobal.class, "drawBlockDamageTexture",
new Class[] { Tessellator.class,
EntityLivingBase.class, Float.TYPE }));
if (m == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
Object[] enumConstants1 = forgeAPIIItemRendererItemRenderType
.getEnumConstants();
Object o1;
data.putObject("IItemRenderer$ItemRenderType.ENTITY",
o1 = enumConstants1[0]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRenderType.EQUIPPED",
o1 = enumConstants1[1]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject(
"IItemRenderer$ItemRenderType.EQUIPPED_FIRST_PERSON",
o1 = enumConstants1[2]);
if (o1 == null) {
return false;
} else {
MineLPLogger
.debug("ForgeAPI Object " + o1.toString());
data.putObject(
"IItemRenderer$ItemRenderType.INVENTORY",
o1 = enumConstants1[3]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug(
"ForgeAPI Object " + o1.toString());
data.putObject(
"IItemRenderer$ItemRenderType.FIRST_PERSON_MAP",
o1 = enumConstants1[4]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug(
"ForgeAPI Object " + o1.toString());
enumConstants1 = forgeAPIIItemRendererItemRendererHelper
.getEnumConstants();
data.putObject(
"IItemRenderer$ItemRendererHelper.ENTITY_ROTATION",
o1 = enumConstants1[0]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug("ForgeAPI Object "
+ o1.toString());
data.putObject(
"IItemRenderer$ItemRendererHelper.ENTITY_BOBBING",
o1 = enumConstants1[1]);
if (o1 == null) {
return false;
} else {
MineLPLogger
.debug("ForgeAPI Object "
+ o1.toString());
data.putObject(
"IItemRenderer$ItemRendererHelper.EQUIPPED_BLOCK",
o1 = enumConstants1[2]);
if (o1 == null) {
return false;
} else {
MineLPLogger.debug(
"ForgeAPI Object " + o1
.toString());
data.putObject(
"IItemRenderer$ItemRendererHelper.BLOCK_3D",
o1 = enumConstants1[3]);
if (o1 == null) {
return false;
} else {
MineLPLogger
.debug("ForgeAPI Object "
+ o1.toString());
data.putObject(
"IItemRenderer$ItemRendererHelper.INVENTORY_BLOCK",
o1 = enumConstants1[4]);
if (o1 == null) {
return false;
} else {
MineLPLogger
.debug("ForgeAPI Object "
+ o1.toString());
if (forgeAPI
.removeNullData()) {
MineLPLogger.warn(
"ForgeAPI reflection returned some nulls");
}
return true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.getArmorTexture",
m = getMethod(ForgeHooksClient, "getArmorTexture", Entity.class, ItemStack.class, String.class, Integer.TYPE, String.class));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.orientBedCamera", m = getMethod(ForgeHooksClient, "orientBedCamera", Minecraft.class, EntityLivingBase.class));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.setRenderPass", m = getMethod(ForgeHooksClient, "setRenderPass", Integer.TYPE));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.onDrawBlockHighlight", m = getMethod(ForgeHooksClient, "onDrawBlockHighlight",
RenderGlobal.class, EntityPlayer.class, MovingObjectPosition.class, Integer.TYPE, ItemStack.class, Float.TYPE));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("ForgeHooksClient.dispatchRenderLast", m = getMethod(ForgeHooksClient, "dispatchRenderLast", RenderGlobal.class, Float.TYPE));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("MinecraftForgeClient.getItemRenderer",
m = getMethod(MinecraftForgeClient, "getItemRenderer", ItemStack.class, ItemRenderType));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("IItemRenderer.shouldUseRenderHelper",
m = getMethod(IItemRenderer, "shouldUseRenderHelper", ItemRenderType, ItemStack.class, ItemRendererHelper));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("Item.getRenderPasses", m = getMethod(Item.class, "getRenderPasses", Integer.TYPE));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("RenderBiped.getArmorResource",
m = getMethod(RenderBiped.class, "getArmorResource", Entity.class, ItemStack.class, Integer.TYPE, String.class));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("Entity.canRiderInteract", m = getMethod(Entity.class, "canRiderInteract", new Class[0]));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
data.putMethod("RenderGlobal.drawBlockDamageTexture",
m = getMethod(RenderGlobal.class, "drawBlockDamageTexture", Tessellator.class, EntityLivingBase.class, Float.TYPE));
if (m == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Method " + stringMethod(m));
Object[] enumConstants1 = ItemRenderType.getEnumConstants();
Object o1;
data.putObject("IItemRenderer$ItemRenderType.ENTITY", o1 = enumConstants1[0]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRenderType.EQUIPPED", o1 = enumConstants1[1]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRenderType.EQUIPPED_FIRST_PERSON", o1 = enumConstants1[2]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRenderType.INVENTORY", o1 = enumConstants1[3]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRenderType.FIRST_PERSON_MAP", o1 = enumConstants1[4]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
enumConstants1 = ItemRendererHelper.getEnumConstants();
data.putObject("IItemRenderer$ItemRendererHelper.ENTITY_ROTATION", o1 = enumConstants1[0]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRendererHelper.ENTITY_BOBBING", o1 = enumConstants1[1]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRendererHelper.EQUIPPED_BLOCK", o1 = enumConstants1[2]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRendererHelper.BLOCK_3D", o1 = enumConstants1[3]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
data.putObject("IItemRenderer$ItemRendererHelper.INVENTORY_BLOCK", o1 = enumConstants1[4]);
if (o1 == null) {
return false;
}
MineLPLogger.debug("ForgeAPI Object " + o1.toString());
if (forgeAPI.removeNullData()) {
MineLPLogger.warn("ForgeAPI reflection returned some nulls");
}
return true;
}
public static Class<?> getClass(String className) {
@ -276,7 +200,7 @@ public class MineLPReflection {
e = clazz.getConstructor(new Class[0]);
}
} catch (Exception var4) {
;
}
return e;
@ -288,34 +212,25 @@ public class MineLPReflection {
}
public static Field getField(Class<?> clazz, String fieldName) {
Object ex = null;
try {
Field e = null;
Field f = null;
try {
e = clazz.getField(fieldName);
f = clazz.getField(fieldName);
} catch (Exception var5) {
e = null;
f = null;
}
if (e == null) {
e = clazz.getDeclaredField(fieldName);
if (f == null) {
f = clazz.getDeclaredField(fieldName);
}
e.setAccessible(true);
return e;
} catch (SecurityException var6) {
ex = var6;
} catch (NoSuchFieldException var7) {
ex = var7;
} catch (Exception var8) {
ex = var8;
}
if (ex != null) {
f.setAccessible(true);
return f;
} catch (Exception e) {
MineLPLogger.error("Failed to match Field \"%s\" in %s", new Object[] { fieldName, clazz.getName() });
((Exception) ex).printStackTrace();
e.printStackTrace();
}
return null;
@ -328,7 +243,7 @@ public class MineLPReflection {
try {
e = clazz.getMethod(methodName, types);
} catch (Exception var5) {
;
}
if (e == null) {
@ -381,108 +296,6 @@ public class MineLPReflection {
return types;
}
public static void printClass(Class<?> c) {
printClass(c, true);
}
public static void printClass(Class<?> c, boolean declared) {
printClass(c, declared, 0);
}
public static void printClass(Class<?> c, boolean declared, int indent) {
String indentation = "";
int i;
if (indent > 0) {
char[] lineFormat = new char[indent];
for (i = 0; i < indent; ++i) {
lineFormat[i] = 32;
}
indentation = String.valueOf(lineFormat);
}
String var10 = indentation + "%03d";
System.out.println(indentation + c.getName());
System.out.println(indentation + "Nested Classes:");
Class<?>[] var6 = c.getClasses();
int var7 = var6.length;
int var8;
for (var8 = 0; var8 < var7; ++var8) {
Class<?> f = var6[var8];
printClass(f, declared, indent + 1);
}
System.out.println(indentation + "Constructors:");
i = 0;
Constructor<?>[] var11 = c.getConstructors();
var7 = var11.length;
for (var8 = 0; var8 < var7; ++var8) {
Constructor<?> var14 = var11[var8];
System.out.println(
String.format(var10, new Object[] { Integer.valueOf(i) }) + " " + stringConstructor(var14));
++i;
}
System.out.println(indentation + "Methods:");
i = 0;
Method[] var12 = c.getMethods();
var7 = var12.length;
Method var15;
for (var8 = 0; var8 < var7; ++var8) {
var15 = var12[var8];
System.out.println(String.format(var10, new Object[] { Integer.valueOf(i) }) + " " + stringMethod(var15));
++i;
}
System.out.println(indentation + "Fields:");
i = 0;
Field[] var13 = c.getFields();
var7 = var13.length;
Field var16;
for (var8 = 0; var8 < var7; ++var8) {
var16 = var13[var8];
System.out.println(String.format(var10, new Object[] { Integer.valueOf(i) }) + " " + stringField(var16));
++i;
}
if (declared) {
System.out.println(indentation + "Declared Methods:");
i = 0;
var12 = c.getDeclaredMethods();
var7 = var12.length;
for (var8 = 0; var8 < var7; ++var8) {
var15 = var12[var8];
System.out
.println(String.format(var10, new Object[] { Integer.valueOf(i) }) + " " + stringMethod(var15));
++i;
}
System.out.println(indentation + "Declared Fields:");
i = 0;
var13 = c.getDeclaredFields();
var7 = var13.length;
for (var8 = 0; var8 < var7; ++var8) {
var16 = var13[var8];
System.out
.println(String.format(var10, new Object[] { Integer.valueOf(i) }) + " " + stringField(var16));
++i;
}
}
}
public static String stringConstructor(Constructor<?> c) {
return Modifier.toString(c.getModifiers()) + " " + c.getName() + getStringFromTypes(c.getParameterTypes())
+ (c.getExceptionTypes().length > 0 ? " throws " + c.getExceptionTypes() : "");
}
public static String stringMethod(Method m) {
return Modifier.toString(m.getModifiers()) + " "
+ (m.getReturnType() != null ? m.getReturnType().getName() : "void") + " " + m.getName()
@ -490,18 +303,13 @@ public class MineLPReflection {
+ (m.getExceptionTypes().length > 0 ? " throws " + getStringFromTypes(m.getExceptionTypes()) : "");
}
public static String stringField(Field f) {
return Modifier.toString(f.getModifiers()) + " " + f.getType().getName() + " " + f.getName();
}
static {
MineLPLogger.info("Checking compatibilities...");
forgeAPI = new MineLPRData();
forgeAPI.compatible = reflectForgeAPI(forgeAPI);
MineLPLogger.info("Compatibility Check Done!");
if (forgeAPI.installed) {
MineLPLogger.info(
"ForgeAPI " + (forgeAPI.compatible ? "Installed and Compatible" : "Installed but Incompatible"));
MineLPLogger.info("ForgeAPI " + (forgeAPI.compatible ? "Installed and Compatible" : "Installed but Incompatible"));
}
}

View file

@ -54,11 +54,9 @@ public abstract class VoxelCommonLiteMod implements LiteMod, Configurable {
} catch (Throwable var3) {
var3.printStackTrace();
}
}
public void registerConfigurable()
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
public void registerConfigurable() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
Field configManagerField = LiteLoader.class.getDeclaredField("configManager");
configManagerField.setAccessible(true);
ConfigManager mgr = (ConfigManager) configManagerField.get(LiteLoader.getInstance());
@ -67,8 +65,7 @@ public abstract class VoxelCommonLiteMod implements LiteMod, Configurable {
@Override
public Class<? extends ConfigPanel> getConfigPanelClass() {
return this.mod != null && this.mod instanceof Configurable ? ((Configurable) this.mod).getConfigPanelClass()
: null;
return this.mod != null && this.mod instanceof Configurable ? ((Configurable) this.mod).getConfigPanelClass() : null;
}
@Override
@ -76,7 +73,6 @@ public abstract class VoxelCommonLiteMod implements LiteMod, Configurable {
if (this.mod != null) {
this.mod.upgradeSettings(version, configPath, oldConfigPath);
}
}
@SuppressWarnings("unchecked")
@ -84,38 +80,33 @@ public abstract class VoxelCommonLiteMod implements LiteMod, Configurable {
if ("true".equals(System.getProperty("VoxelCommon.Injected"))) {
LiteLoaderLogger.warning("%s jar was already injected, skipping injection.", libraryName);
return true;
} else {
File jarFile = new File(libPath, resourceName);
if (!jarFile.exists()) {
LiteLoaderLogger.info("%s jar does not exist, attempting to extract to %s",
libraryName, libPath.getAbsolutePath());
if (!extractFile("/" + resourceName, jarFile)) {
LiteLoaderLogger.warning("%s jar could not be extracted, %s may not function correctly (or at all)",
libraryName, this.getName());
return false;
}
}
if (jarFile.exists()) {
LiteLoaderLogger.info("%s jar exists, attempting to inject into classpath", libraryName);
try {
ClassPathUtilities.injectIntoClassPath(Launch.classLoader, jarFile.toURI().toURL());
LiteLoaderFriend.loadMod(libraryName, (Class<? extends LiteMod>) Class.forName(className), jarFile);
} catch (Exception var7) {
var7.printStackTrace();
return false;
}
System.setProperty("VoxelCommon.Injected", "true");
LiteLoaderLogger.info("%s jar was successfully extracted", libraryName);
return true;
} else {
LiteLoaderLogger.warning("%s jar was not detected, %s may not function correctly (or at all)",
libraryName, this.getName());
}
File jarFile = new File(libPath, resourceName);
if (!jarFile.exists()) {
LiteLoaderLogger.info("%s jar does not exist, attempting to extract to %s", libraryName, libPath.getAbsolutePath());
if (!extractFile("/" + resourceName, jarFile)) {
LiteLoaderLogger.warning("%s jar could not be extracted, %s may not function correctly (or at all)", libraryName, this.getName());
return false;
}
}
if (jarFile.exists()) {
LiteLoaderLogger.info("%s jar exists, attempting to inject into classpath", libraryName);
try {
ClassPathUtilities.injectIntoClassPath(Launch.classLoader, jarFile.toURI().toURL());
LiteLoaderFriend.loadMod(libraryName, (Class<? extends LiteMod>) Class.forName(className), jarFile);
} catch (Exception var7) {
var7.printStackTrace();
return false;
}
System.setProperty("VoxelCommon.Injected", "true");
LiteLoaderLogger.info("%s jar was successfully extracted", libraryName);
return true;
}
LiteLoaderLogger.warning("%s jar was not detected, %s may not function correctly (or at all)", libraryName, this.getName());
return false;
}
private static boolean extractFile(String resourceName, File outputFile) {

View file

@ -138,25 +138,23 @@ public final class HDSkinManager {
Map<Type, MinecraftProfileTexture> cached = getCachedTexturesForId(trimUUID(profile.getId()));
if (cached != null) {
return cached;
} else {
MinecraftSessionService sessionService = minecraft.getSessionService();
Map<Type, MinecraftProfileTexture> textures = null;
try {
textures = sessionService.getTextures(profile, true);
} catch (InsecureTextureException var6) {
textures = sessionService.getTextures(profile, false);
}
if ((textures == null || textures.isEmpty())
&& profile.getId().equals(minecraft.getSession().getProfile().getId())) {
textures = sessionService.getTextures(sessionService.fillProfileProperties(profile, false), false);
}
storeTexturesForProfile(profile, textures);
return textures;
}
MinecraftSessionService sessionService = minecraft.getSessionService();
Map<Type, MinecraftProfileTexture> textures = null;
try {
textures = sessionService.getTextures(profile, true);
} catch (InsecureTextureException var6) {
textures = sessionService.getTextures(profile, false);
}
if ((textures == null || textures.isEmpty()) && profile.getId().equals(minecraft.getSession().getProfile().getId())) {
textures = sessionService.getTextures(sessionService.fillProfileProperties(profile, false), false);
}
storeTexturesForProfile(profile, textures);
return textures;
}
private static Cache<GameProfile, Map<Type, MinecraftProfileTexture>> getSkinsCache() {
@ -211,8 +209,7 @@ public final class HDSkinManager {
}
String url = skin.getUrl();
skinTexture = new PreviewTexture(url, DefaultPlayerSkin.getDefaultSkin(profile.getId()),
new ImageBufferDownloadHD());
skinTexture = new PreviewTexture(url, DefaultPlayerSkin.getDefaultSkin(profile.getId()), new ImageBufferDownloadHD());
textureManager.loadTexture(skinResource, (ITextureObject) skinTexture);
}
@ -231,6 +228,5 @@ public final class HDSkinManager {
getSkinsCache().invalidateAll();
cachedTextures.clear();
playerHashes.clear();
}
}

View file

@ -16,37 +16,35 @@ public class ImageBufferDownloadHD implements IImageBuffer {
public BufferedImage parseUserSkin(BufferedImage downloadedImage) {
if (downloadedImage == null) {
return null;
} else {
int imageWidth = downloadedImage.getWidth();
int imageHeight = downloadedImage.getHeight();
if (imageHeight == imageWidth) {
return downloadedImage;
} else {
scale = imageWidth / 64;
image = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
graphics = image.getGraphics();
graphics.drawImage(downloadedImage, 0, 0, (ImageObserver) null);
// copy layers
// leg
drawImage(24, 48, 20, 52, 4, 16, 8, 20); // top
drawImage(28, 48, 24, 52, 8, 16, 12, 20); // bottom
drawImage(20, 52, 16, 64, 8, 20, 12, 32); // inside
drawImage(24, 52, 20, 64, 4, 20, 8, 32); // front
drawImage(28, 52, 24, 64, 0, 20, 4, 32); // outside
drawImage(32, 52, 28, 64, 12, 20, 16, 32); // back
// arm
drawImage(40, 48, 36, 52, 44, 16, 48, 20); // top
drawImage(44, 48, 40, 52, 48, 16, 52, 20); // bottom
drawImage(36, 52, 32, 64, 48, 20, 52, 32); //
drawImage(40, 52, 36, 64, 44, 20, 48, 32); //
drawImage(44, 52, 40, 64, 40, 20, 44, 32);
drawImage(48, 52, 44, 64, 52, 20, 56, 32);
graphics.dispose();
return image;
}
}
int imageWidth = downloadedImage.getWidth();
int imageHeight = downloadedImage.getHeight();
if (imageHeight == imageWidth) {
return downloadedImage;
}
scale = imageWidth / 64;
image = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
graphics = image.getGraphics();
graphics.drawImage(downloadedImage, 0, 0, (ImageObserver) null);
// copy layers
// leg
drawImage(24, 48, 20, 52, 4, 16, 8, 20); // top
drawImage(28, 48, 24, 52, 8, 16, 12, 20); // bottom
drawImage(20, 52, 16, 64, 8, 20, 12, 32); // inside
drawImage(24, 52, 20, 64, 4, 20, 8, 32); // front
drawImage(28, 52, 24, 64, 0, 20, 4, 32); // outside
drawImage(32, 52, 28, 64, 12, 20, 16, 32); // back
// arm
drawImage(40, 48, 36, 52, 44, 16, 48, 20); // top
drawImage(44, 48, 40, 52, 48, 16, 52, 20); // bottom
drawImage(36, 52, 32, 64, 48, 20, 52, 32); //
drawImage(40, 52, 36, 64, 44, 20, 48, 32); //
drawImage(44, 52, 40, 64, 40, 20, 44, 32);
drawImage(48, 52, 44, 64, 52, 20, 56, 32);
graphics.dispose();
return image;
}
private void drawImage(int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {

View file

@ -82,7 +82,8 @@ public class EntityPlayerModel extends EntityLiving {
return !this.remoteSkin && this.hasLocalTexture;
}
public float d(float par1) {
@Override
public float getBrightness(float par1) {
return 1.0F;
}

View file

@ -182,6 +182,9 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
protected void onSetRemoteSkin() {}
/**
* @param skin The skin
*/
protected void onSetLocalSkin(BufferedImage skin) {}
private void setRemoteSkin() {
@ -415,7 +418,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
popMatrix();
}
private void renderCubeMapTexture(int mouseX, int mouseY, float partialTick) {
private void renderCubeMapTexture(float partialTick) {
this.setupCubemapCamera();
color(1.0F, 1.0F, 1.0F, 1.0F);
rotate(180.0F, 1.0F, 0.0F, 0.0F);
@ -484,7 +487,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
this.revertPanoramaMatrix();
}
private void rotateAndBlurCubemap(float partialTick) {
private void rotateAndBlurCubemap() {
this.mc.getTextureManager().bindTexture(this.viewportTexture);
GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, 256, 256);
GL11.glEnable(3042);
@ -512,12 +515,12 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
@Override
public boolean renderPanorama(int mouseX, int mouseY, float partialTicks) {
GL11.glViewport(0, 0, 256, 256);
this.renderCubeMapTexture(mouseX, mouseY, partialTicks);
this.renderCubeMapTexture(partialTicks);
GL11.glDisable(3553);
GL11.glEnable(3553);
for (int tessellator = 0; tessellator < 8; ++tessellator) {
this.rotateAndBlurCubemap(partialTicks);
this.rotateAndBlurCubemap();
}
GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
@ -640,7 +643,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
}
public void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale,
float mouseX, float mouseY, float partialTick) {
@SuppressWarnings("unused") float mouseX, float mouseY, float partialTick) {
GL11.glEnable(GL.GL_COLOR_MATERIAL);
pushMatrix();
translate(xPosition, yPosition, 300.0F);
@ -688,37 +691,35 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
private boolean clearUploadedSkin(Session session) {
if (!this.registerServerConnection(session, skinServerId)) {
return false;
} else {
HashMap<String, Object> sourceData = new HashMap<String, Object>();
sourceData.put("user", session.getUsername());
sourceData.put("uuid", session.getPlayerID());
sourceData.put("clear", "1");
this.uploadError = null;
this.uploadingSkin = true;
this.skinUploadMessage = request;
this.threadSkinUpload = new ThreadMultipartPostUpload("http://minelpskinmanager.voxelmodpack.com/",
sourceData, this);
this.threadSkinUpload.start();
return true;
}
HashMap<String, Object> sourceData = new HashMap<String, Object>();
sourceData.put("user", session.getUsername());
sourceData.put("uuid", session.getPlayerID());
sourceData.put("clear", "1");
this.uploadError = null;
this.uploadingSkin = true;
this.skinUploadMessage = request;
this.threadSkinUpload = new ThreadMultipartPostUpload("http://minelpskinmanager.voxelmodpack.com/",
sourceData, this);
this.threadSkinUpload.start();
return true;
}
private boolean uploadSkin(Session session, File skinFile) {
if (!this.registerServerConnection(session, skinServerId)) {
return false;
} else {
HashMap<String, Object> sourceData = new HashMap<String, Object>();
sourceData.put("user", session.getUsername());
sourceData.put("uuid", session.getPlayerID());
sourceData.put("skin", skinFile);
this.uploadError = null;
this.uploadingSkin = true;
this.skinUploadMessage = upload;
this.threadSkinUpload = new ThreadMultipartPostUpload("http://minelpskinmanager.voxelmodpack.com/",
sourceData, this);
this.threadSkinUpload.start();
return true;
}
HashMap<String, Object> sourceData = new HashMap<String, Object>();
sourceData.put("user", session.getUsername());
sourceData.put("uuid", session.getPlayerID());
sourceData.put("skin", skinFile);
this.uploadError = null;
this.uploadingSkin = true;
this.skinUploadMessage = upload;
this.threadSkinUpload = new ThreadMultipartPostUpload("http://minelpskinmanager.voxelmodpack.com/",
sourceData, this);
this.threadSkinUpload.start();
return true;
}
private void setUploadError(String error) {

View file

@ -34,7 +34,7 @@ public class HDSkinsModCore implements HDSkinsMod {
new Class[] { Class.class, String.class });
mRegisterCustomScreen.invoke(null, GuiSkins.class, "HD Skins Manager");
} catch (ClassNotFoundException var4) {
;
} catch (Exception var5) {
var5.printStackTrace();
}
@ -69,7 +69,7 @@ public class HDSkinsModCore implements HDSkinsMod {
return panoramaRenderer;
}
} catch (ClassNotFoundException var4) {
;
} catch (Exception var5) {
var5.printStackTrace();
}