More fun with Scala to Java. Down to porting ModelSpec files and network code. Numina nearly finished too.
This commit is contained in:
parent
a1bff1be20
commit
f5d3ac5219
|
@ -39,13 +39,11 @@ public class NBTTagAccessor extends NBTTagCompound {
|
||||||
SecurityException {
|
SecurityException {
|
||||||
if (mTagAccessor == null) {
|
if (mTagAccessor == null) {
|
||||||
try {
|
try {
|
||||||
mTagAccessor = NBTTagCompound.class.getDeclaredMethod(
|
mTagAccessor = NBTTagCompound.class.getDeclaredMethod("getTagMap", NBTTagCompound.class);
|
||||||
"getTagMap", NBTTagCompound.class);
|
|
||||||
mTagAccessor.setAccessible(true);
|
mTagAccessor.setAccessible(true);
|
||||||
return mTagAccessor;
|
return mTagAccessor;
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
mTagAccessor = NBTTagCompound.class.getDeclaredMethod(
|
mTagAccessor = NBTTagCompound.class.getDeclaredMethod("a", NBTTagCompound.class);
|
||||||
"a", NBTTagCompound.class);
|
|
||||||
mTagAccessor.setAccessible(true);
|
mTagAccessor.setAccessible(true);
|
||||||
return mTagAccessor;
|
return mTagAccessor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ import net.machinemuse.numina.general.MuseMathUtils;
|
||||||
import net.machinemuse.numina.geometry.Colour;
|
import net.machinemuse.numina.geometry.Colour;
|
||||||
import net.machinemuse.numina.geometry.DrawableMuseRect;
|
import net.machinemuse.numina.geometry.DrawableMuseRect;
|
||||||
import net.machinemuse.numina.geometry.MusePoint2D;
|
import net.machinemuse.numina.geometry.MusePoint2D;
|
||||||
import net.machinemuse.powersuits.client.render.item.ArmorModel$;
|
import net.machinemuse.powersuits.client.render.item.ArmorModelInstance;
|
||||||
|
import net.machinemuse.powersuits.client.render.item.IArmorModel;
|
||||||
import net.machinemuse.powersuits.item.ItemPowerArmor;
|
import net.machinemuse.powersuits.item.ItemPowerArmor;
|
||||||
import net.machinemuse.utils.MuseItemUtils;
|
import net.machinemuse.utils.MuseItemUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -119,8 +120,8 @@ public class ItemModelViewFrame implements IGuiFrame
|
||||||
this.border.draw();
|
this.border.draw();
|
||||||
if (this.itemSelector.getSelectedItem() != null && this.getSelectedItem().getItem().getItem() instanceof ItemPowerArmor) {
|
if (this.itemSelector.getSelectedItem() != null && this.getSelectedItem().getItem().getItem() instanceof ItemPowerArmor) {
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
ArmorModel$.MODULE$.instance().renderSpec_$eq(MuseItemUtils.getMuseRenderTag(this.getSelectedItem().getItem(), this.getArmorSlot()));
|
((IArmorModel)ArmorModelInstance.getInstance()).setRenderSpec((MuseItemUtils.getMuseRenderTag(this.getSelectedItem().getItem(), this.getArmorSlot())));
|
||||||
ArmorModel$.MODULE$.instance().visibleSection_$eq(this.getArmorSlot());
|
((IArmorModel)ArmorModelInstance.getInstance()).setVisibleSection(this.getArmorSlot());
|
||||||
GL11.glTranslated(this.border.centerx() + this.offsetx, this.border.centery() + this.offsety, 0.0);
|
GL11.glTranslated(this.border.centerx() + this.offsetx, this.border.centery() + this.offsety, 0.0);
|
||||||
GL11.glScaled(this.zoom, this.zoom, this.zoom);
|
GL11.glScaled(this.zoom, this.zoom, this.zoom);
|
||||||
GL11.glClear(256);
|
GL11.glClear(256);
|
||||||
|
@ -128,7 +129,7 @@ public class ItemModelViewFrame implements IGuiFrame
|
||||||
GL11.glRotatef((float)this.rotx, 1.0f, 0.0f, 0.0f);
|
GL11.glRotatef((float)this.rotx, 1.0f, 0.0f, 0.0f);
|
||||||
GL11.glRotatef((float)this.roty, 0.0f, 1.0f, 0.0f);
|
GL11.glRotatef((float)this.roty, 0.0f, 1.0f, 0.0f);
|
||||||
GL11.glTranslated(0.0, -this.getArmorSlot() / 2.0, 0.0);
|
GL11.glTranslated(0.0, -this.getArmorSlot() / 2.0, 0.0);
|
||||||
((ModelBiped)ArmorModel$.MODULE$.instance()).render((Entity)mc.thePlayer, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f);
|
ArmorModelInstance.getInstance().render((Entity)mc.thePlayer, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,32 @@
|
||||||
package net.machinemuse.powersuits.client.render.item;
|
package net.machinemuse.powersuits.client.render.item;
|
||||||
|
|
||||||
import net.machinemuse.numina.general.MuseLogger;
|
import net.machinemuse.numina.general.MuseLogger;
|
||||||
|
import net.minecraft.client.model.ModelBiped;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: MachineMuse (Claire Semple)
|
* Author: MachineMuse (Claire Semple)
|
||||||
* Created: 10:01 PM, 11/07/13
|
* Created: 10:01 PM, 11/07/13
|
||||||
*/
|
*/
|
||||||
public class ArmorModelInstance {
|
public class ArmorModelInstance {
|
||||||
private static ArmorModel instance = null;
|
private static ModelBiped instance = null;
|
||||||
|
private static NBTTagCompound renderSpec;
|
||||||
|
|
||||||
|
private static boolean smartMoving = false;
|
||||||
|
|
||||||
|
public static ModelBiped getInstance() {
|
||||||
|
// TODO: Actual (skinned) vanilla model as low bandwitdth alternative
|
||||||
|
|
||||||
public static ArmorModel getInstance() {
|
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
// instance = new VanillaArmorModel();
|
// try {
|
||||||
try {
|
// MuseLogger.logInfo("Attempting to load Smart Moving armor model.");
|
||||||
MuseLogger.logInfo("Attempting to load Smart Moving armor model.");
|
// instance = SMovingArmorModel.getInstance();
|
||||||
instance = new SMovingArmorModel();
|
// smartMoving = true;
|
||||||
MuseLogger.logInfo("Smart Moving armor model loaded successfully!");
|
// MuseLogger.logInfo("Smart Moving armor model loaded successfully!");
|
||||||
} catch (Throwable e) {
|
// } catch (Throwable e) {
|
||||||
MuseLogger.logInfo("Smart Moving armor model did not load successfully. Either Smart Moving is not installed, or there was another problem.");
|
// MuseLogger.logInfo("Smart Moving armor model did not load successfully. Either Smart Moving is not installed, or there was another problem.");
|
||||||
instance = new VanillaArmorModel();
|
instance = VanillaArmorModel.getInstance();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package net.machinemuse.powersuits.client.render.item;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ported to Java by lehjr on 10/21/16.
|
||||||
|
*/
|
||||||
|
public interface IArmorModel {
|
||||||
|
NBTTagCompound renderSpec = null;
|
||||||
|
int visibleSection = 0;
|
||||||
|
|
||||||
|
NBTTagCompound getRenderSpec();
|
||||||
|
|
||||||
|
void setRenderSpec(NBTTagCompound nbt);
|
||||||
|
|
||||||
|
int getVisibleSection();
|
||||||
|
|
||||||
|
void setVisibleSection(int value);
|
||||||
|
|
||||||
|
void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo);
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void setInitialOffsets(ModelRenderer r, float x, float y, float z);
|
||||||
|
|
||||||
|
void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale);
|
||||||
|
|
||||||
|
void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale);
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
package net.machinemuse.powersuits.client.render.item;
|
||||||
|
|
||||||
|
import api.player.model.ModelPlayer;
|
||||||
|
import net.machinemuse.powersuits.client.render.modelspec.RenderPart;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.EnumAction;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.smart.render.SmartRenderModel;
|
||||||
|
import net.smart.render.playerapi.SmartRender;
|
||||||
|
import net.smart.render.playerapi.SmartRenderModelPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: MachineMuse (Claire Semple)
|
||||||
|
* Created: 9:23 PM, 11/07/13
|
||||||
|
*
|
||||||
|
* Ported to Java by lehjr on 11/7/16.
|
||||||
|
*/
|
||||||
|
public class SMovingArmorModel extends ModelPlayer implements IArmorModel {
|
||||||
|
public static NBTTagCompound renderSpec = null;
|
||||||
|
public static int visibleSection = 0;
|
||||||
|
private SmartRenderModelPlayerBase renderPlayerBase = SmartRender.getPlayerBase(this);
|
||||||
|
private SmartRenderModel model = renderPlayerBase.getRenderModel();
|
||||||
|
|
||||||
|
private SMovingArmorModel() {
|
||||||
|
super(0);
|
||||||
|
|
||||||
|
this.bipedBody = model.bipedBody;
|
||||||
|
this.bipedRightArm = model.bipedRightArm;
|
||||||
|
this.bipedLeftArm = model.bipedLeftArm;
|
||||||
|
this.bipedRightLeg = model.bipedRightLeg;
|
||||||
|
this.bipedLeftLeg = model.bipedLeftLeg;
|
||||||
|
this.bipedHeadwear = model.bipedHeadwear;
|
||||||
|
this.bipedEars = model.bipedEars;
|
||||||
|
this.bipedCloak = model.bipedCloak;
|
||||||
|
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SMovingArmorModel INSTANCE;
|
||||||
|
public static SMovingArmorModel getInstance() {
|
||||||
|
if (INSTANCE == null)
|
||||||
|
INSTANCE = new SMovingArmorModel();
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getRenderSpec() {
|
||||||
|
return renderSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRenderSpec(NBTTagCompound nbt) {
|
||||||
|
renderSpec = nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getVisibleSection() {
|
||||||
|
return visibleSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisibleSection(int value) {
|
||||||
|
visibleSection = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the models various rotation angles then renders the model.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
System.out.println("Stuff is happening here!!");
|
||||||
|
|
||||||
|
|
||||||
|
prep(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
renderPlayerBase.setRotationAngles(par2, par3, par4, par5, par6, scale, entity);
|
||||||
|
renderPlayerBase.render(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
post(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo) {
|
||||||
|
mr.cubeList.clear();
|
||||||
|
RenderPart rp = new RenderPart(this, mr);
|
||||||
|
mr.addChild(rp);
|
||||||
|
setInitialOffsets(rp, xo, yo, zo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F, 0.0F);
|
||||||
|
bipedHeadwear.cubeList.clear();
|
||||||
|
bipedEars.cubeList.clear();
|
||||||
|
bipedCloak.cubeList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void logModelParts(WavefrontObject model) {
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
// MuseLogger.logDebug(model.toString() + ":");
|
||||||
|
// for (GroupObject group : model.groupObjects) {
|
||||||
|
// MuseLogger.logDebug("-" + group.name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInitialOffsets(ModelRenderer r, float x, float y, float z) {
|
||||||
|
r.offsetX = x;
|
||||||
|
r.offsetY = y;
|
||||||
|
r.offsetZ = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
try {
|
||||||
|
EntityLivingBase entLive = (EntityLivingBase) entity;
|
||||||
|
ItemStack stack = entLive.getEquipmentInSlot(0);
|
||||||
|
heldItemRight = (stack != null) ? 1 : 0;
|
||||||
|
isSneak = entLive.isSneaking();
|
||||||
|
isRiding = entLive.isRiding();
|
||||||
|
EntityPlayer entPlayer = (EntityPlayer) entLive;
|
||||||
|
if ((stack != null) && (entPlayer.getItemInUseCount() > 0)) {
|
||||||
|
EnumAction enumaction = stack.getItemUseAction();
|
||||||
|
if (enumaction == EnumAction.block) {
|
||||||
|
heldItemRight = 3;
|
||||||
|
} else if (enumaction == EnumAction.bow) {
|
||||||
|
aimedBow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bipedHead.isHidden = false;
|
||||||
|
bipedBody.isHidden = false;
|
||||||
|
bipedRightArm.isHidden = false;
|
||||||
|
bipedLeftArm.isHidden = false;
|
||||||
|
bipedRightLeg.isHidden = false;
|
||||||
|
bipedLeftLeg.isHidden = false;
|
||||||
|
|
||||||
|
bipedHead.showModel = true;
|
||||||
|
bipedBody.showModel = true;
|
||||||
|
bipedRightArm.showModel = true;
|
||||||
|
bipedLeftArm.showModel = true;
|
||||||
|
bipedRightLeg.showModel = true;
|
||||||
|
bipedLeftLeg.showModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
aimedBow = false;
|
||||||
|
isSneak = false;
|
||||||
|
heldItemRight = 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
package net.machinemuse.powersuits.client.render.item;
|
||||||
|
|
||||||
|
import net.machinemuse.powersuits.client.render.modelspec.RenderPart;
|
||||||
|
import net.minecraft.client.model.ModelBiped;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.EnumAction;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: MachineMuse (Claire Semple)
|
||||||
|
* Created: 9:24 PM, 11/07/13
|
||||||
|
*
|
||||||
|
* Ported to Java by lehjr on 11/7/16.
|
||||||
|
*
|
||||||
|
* FIXME: IMPORTANT!!!!: Note that SmartMoving will mess up the rendering here and the armor's yaw will not change with the player's yaw but will be fine with it not installed.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class VanillaArmorModel extends ModelBiped implements IArmorModel {
|
||||||
|
public NBTTagCompound renderSpec = null;
|
||||||
|
public int visibleSection = 0;
|
||||||
|
|
||||||
|
private static VanillaArmorModel INSTANCE;
|
||||||
|
|
||||||
|
public static VanillaArmorModel getInstance() {
|
||||||
|
if (INSTANCE == null)
|
||||||
|
INSTANCE = new VanillaArmorModel();
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VanillaArmorModel() {
|
||||||
|
super(0);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getRenderSpec() {
|
||||||
|
return this.renderSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRenderSpec(NBTTagCompound nbt) {
|
||||||
|
renderSpec = nbt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getVisibleSection() {
|
||||||
|
return this.visibleSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisibleSection(int value) {
|
||||||
|
this.visibleSection = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the models various rotation angles then renders the model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
prep(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
this.bipedBody.rotateAngleY = entity.rotationYaw;
|
||||||
|
setRotationAngles(par2, par3, par4, par5, par6, scale, entity);
|
||||||
|
super.render(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
post(entity, par2, par3, par4, par5, par6, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo) {
|
||||||
|
mr.cubeList.clear();
|
||||||
|
RenderPart rp = new RenderPart(this, mr);
|
||||||
|
mr.addChild(rp);
|
||||||
|
setInitialOffsets(rp, xo, yo, zo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F, 0.0F);
|
||||||
|
clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F, 0.0F);
|
||||||
|
bipedHeadwear.cubeList.clear();
|
||||||
|
bipedEars.cubeList.clear();
|
||||||
|
bipedCloak.cubeList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void logModelParts(WavefrontObject model) {
|
||||||
|
// MuseLogger.logDebug(model.toString() + ":");
|
||||||
|
// for (GroupObject group : model.groupObjects) {
|
||||||
|
// MuseLogger.logDebug("-" + group.name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInitialOffsets(ModelRenderer r, float x, float y, float z) {
|
||||||
|
r.offsetX = x;
|
||||||
|
r.offsetY = y;
|
||||||
|
r.offsetZ = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
try {
|
||||||
|
EntityLivingBase entLive = (EntityLivingBase) entity;
|
||||||
|
ItemStack stack = entLive.getEquipmentInSlot(0);
|
||||||
|
heldItemRight = (stack != null) ? 1 : 0;
|
||||||
|
isSneak = entLive.isSneaking();
|
||||||
|
isRiding = entLive.isRiding();
|
||||||
|
EntityPlayer entPlayer = (EntityPlayer) entLive;
|
||||||
|
if ((stack != null) && (entPlayer.getItemInUseCount() > 0)) {
|
||||||
|
EnumAction enumaction = stack.getItemUseAction();
|
||||||
|
if (enumaction == EnumAction.block) {
|
||||||
|
heldItemRight = 3;
|
||||||
|
} else if (enumaction == EnumAction.bow) {
|
||||||
|
aimedBow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bipedHead.isHidden = false;
|
||||||
|
bipedBody.isHidden = false;
|
||||||
|
bipedRightArm.isHidden = false;
|
||||||
|
bipedLeftArm.isHidden = false;
|
||||||
|
bipedRightLeg.isHidden = false;
|
||||||
|
bipedLeftLeg.isHidden = false;
|
||||||
|
|
||||||
|
bipedHead.showModel = true;
|
||||||
|
bipedBody.showModel = true;
|
||||||
|
bipedRightArm.showModel = true;
|
||||||
|
bipedLeftArm.showModel = true;
|
||||||
|
bipedRightLeg.showModel = true;
|
||||||
|
bipedLeftLeg.showModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
||||||
|
aimedBow = false;
|
||||||
|
isSneak = false;
|
||||||
|
heldItemRight = 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package net.machinemuse.powersuits.client.render.modelspec;
|
||||||
|
|
||||||
|
import net.machinemuse.general.NBTTagAccessor;
|
||||||
|
import net.machinemuse.numina.geometry.Colour;
|
||||||
|
import net.machinemuse.numina.render.MuseTextureUtils;
|
||||||
|
import net.machinemuse.powersuits.client.render.item.ArmorModelInstance;
|
||||||
|
import net.machinemuse.powersuits.client.render.item.IArmorModel;
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import scala.Option;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: MachineMuse (Claire Semple)
|
||||||
|
* Created: 4:16 AM, 29/04/13
|
||||||
|
*
|
||||||
|
* Ported to Java by lehjr on 11/6/16.
|
||||||
|
*/
|
||||||
|
public class RenderPart extends ModelRenderer {
|
||||||
|
ModelRenderer parent;
|
||||||
|
|
||||||
|
public RenderPart(ModelBase base, ModelRenderer parent) {
|
||||||
|
super (base);
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float scale) {
|
||||||
|
NBTTagCompound renderSpec = ((IArmorModel)(ArmorModelInstance.getInstance())).getRenderSpec();
|
||||||
|
int[] colours = renderSpec.getIntArray("colours");
|
||||||
|
for (NBTTagCompound nbt : NBTTagAccessor.getValues(renderSpec)) {
|
||||||
|
Option<ModelPartSpec> part = ModelRegistry.getPart(nbt);
|
||||||
|
/* checks for None TODO: Null check for Java port.*/
|
||||||
|
if (part.isDefined()) {
|
||||||
|
if (part.get().slot() == ((IArmorModel)(ArmorModelInstance.getInstance())).getVisibleSection() && part.get().morph().apply(ArmorModelInstance.getInstance()) == parent) {
|
||||||
|
float prevBrightX = OpenGlHelper.lastBrightnessX;
|
||||||
|
float prevBrightY = OpenGlHelper.lastBrightnessY;
|
||||||
|
|
||||||
|
// GLOW stuff on
|
||||||
|
if (part.get().getGlow(nbt)) {
|
||||||
|
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glScaled(scale, scale, scale);
|
||||||
|
MuseTextureUtils.bindTexture(part.get().getTexture(nbt));
|
||||||
|
applyTransform();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ix = part.get().getColourIndex(nbt);
|
||||||
|
if (ix < colours.length && ix >= 0) {
|
||||||
|
Colour.doGLByInt(colours[ix]);
|
||||||
|
}
|
||||||
|
part.get().modelSpec().applyOffsetAndRotation(); // not yet implemented
|
||||||
|
part.get().modelSpec().model().renderPart(part.get().partName());
|
||||||
|
Colour.WHITE.doGL();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
// GLOW stuff off
|
||||||
|
if (part.get().getGlow(nbt)) {
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY);
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyTransform() {
|
||||||
|
// float degrad = (float) (180F / Math.PI);
|
||||||
|
// GL11.glTranslatef(rotationPointX, rotationPointY, rotationPointZ);
|
||||||
|
// GL11.glRotatef(rotateAngleZ * degrad, 0.0F, 0.0F, 1.0F);
|
||||||
|
// GL11.glRotatef(rotateAngleY * degrad, 0.0F, 1.0F, 0.0F);
|
||||||
|
// GL11.glRotatef(rotateAngleX * degrad, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glRotatef(180, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glTranslated(offsetX, offsetY - 26, offsetZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import net.machinemuse.api.ApiaristArmor;
|
||||||
import net.machinemuse.api.IArmorTraits;
|
import net.machinemuse.api.IArmorTraits;
|
||||||
import net.machinemuse.api.ModuleManager;
|
import net.machinemuse.api.ModuleManager;
|
||||||
import net.machinemuse.numina.geometry.Colour;
|
import net.machinemuse.numina.geometry.Colour;
|
||||||
import net.machinemuse.powersuits.client.render.item.ArmorModel;
|
import net.machinemuse.powersuits.client.render.item.ArmorModelInstance;
|
||||||
import net.machinemuse.powersuits.client.render.item.ArmorModel$;
|
import net.machinemuse.powersuits.client.render.item.IArmorModel;
|
||||||
import net.machinemuse.powersuits.common.Config;
|
import net.machinemuse.powersuits.common.Config;
|
||||||
import net.machinemuse.powersuits.powermodule.misc.InvisibilityModule;
|
import net.machinemuse.powersuits.powermodule.misc.InvisibilityModule;
|
||||||
import net.machinemuse.utils.ElectricItemUtils;
|
import net.machinemuse.utils.ElectricItemUtils;
|
||||||
|
@ -90,21 +90,21 @@ public abstract class ItemPowerArmor extends ItemElectricArmor implements ISpeci
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ModelBiped getArmorModel(final EntityLivingBase entity, final ItemStack itemstack, final int armorSlot) {
|
public ModelBiped getArmorModel(final EntityLivingBase entity, final ItemStack itemstack, final int armorSlot) {
|
||||||
final ArmorModel model = ArmorModel$.MODULE$.instance();
|
final ModelBiped model = ArmorModelInstance.getInstance();
|
||||||
model.visibleSection_$eq(armorSlot);
|
((IArmorModel)model).setVisibleSection(armorSlot);
|
||||||
if (itemstack != null) {
|
if (itemstack != null) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
ItemStack armorChest = ((EntityPlayer)entity).getCurrentArmor(2);
|
ItemStack armorChest = ((EntityPlayer)entity).getCurrentArmor(2);
|
||||||
|
|
||||||
if (!armorChest.equals(null) && armorChest.getItem() instanceof ItemPowerArmor)
|
if (!armorChest.equals(null) && armorChest.getItem() instanceof ItemPowerArmor)
|
||||||
if (ModuleManager.itemHasActiveModule(armorChest, InvisibilityModule.MODULE_ACTIVE_CAMOUFLAGE)) model.visibleSection_$eq(99);
|
if (ModuleManager.itemHasActiveModule(armorChest, InvisibilityModule.MODULE_ACTIVE_CAMOUFLAGE)) ((IArmorModel)model).setVisibleSection(99);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModuleManager.itemHasActiveModule(itemstack, "Transparent Armor")) {
|
if (ModuleManager.itemHasActiveModule(itemstack, "Transparent Armor")) {
|
||||||
model.visibleSection_$eq(99);
|
((IArmorModel)model).setVisibleSection(99);
|
||||||
}
|
}
|
||||||
model.renderSpec_$eq(MuseItemUtils.getMuseRenderTag(itemstack, armorSlot));
|
((IArmorModel)model).setRenderSpec(MuseItemUtils.getMuseRenderTag(itemstack, armorSlot));
|
||||||
}
|
}
|
||||||
return (ModelBiped)model;
|
return (ModelBiped)model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
//package net.machinemuse.powersuits.client.render.item;
|
|
||||||
//
|
|
||||||
//import net.machinemuse.numina.general.MuseLogger;
|
|
||||||
//import net.machinemuse.powersuits.client.render.modelspec.RenderPart;
|
|
||||||
//import net.minecraft.client.model.ModelBiped;
|
|
||||||
//import net.minecraft.client.model.ModelRenderer;
|
|
||||||
//import net.minecraft.entity.Entity;
|
|
||||||
//import net.minecraft.entity.EntityLivingBase;
|
|
||||||
//import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
//import net.minecraft.item.EnumAction;
|
|
||||||
//import net.minecraft.item.ItemStack;
|
|
||||||
//import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
//import net.minecraftforge.client.model.obj.GroupObject;
|
|
||||||
//import net.minecraftforge.client.model.obj.WavefrontObject;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Ported to Java by lehjr on 10/21/16.
|
|
||||||
// */
|
|
||||||
//public class ArmorModel extends ModelBiped implements IArmorModel{
|
|
||||||
//
|
|
||||||
// public NBTTagCompound renderSpec = null;
|
|
||||||
// public int visibleSection = 0;
|
|
||||||
//
|
|
||||||
// public static ArmorModel instance = ArmorModelInstance.getInstance();
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo) {
|
|
||||||
// mr.cubeList.clear();
|
|
||||||
// RenderPart rp = new RenderPart(this, mr);
|
|
||||||
// mr.addChild(rp);
|
|
||||||
// setInitialOffsets(rp, xo, yo, zo);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void init() {
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F, 0.0F);
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F, 0.0F);
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F, 0.0F);
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F, 0.0F);
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F, 0.0F);
|
|
||||||
// clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F, 0.0F);
|
|
||||||
// bipedHeadwear.cubeList.clear();
|
|
||||||
// bipedEars.cubeList.clear();
|
|
||||||
// bipedCloak.cubeList.clear();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void logModelParts(WavefrontObject model) {
|
|
||||||
// MuseLogger.logDebug(model.toString() + ":");
|
|
||||||
//
|
|
||||||
// for (GroupObject group : model.groupObjects) {
|
|
||||||
// MuseLogger.logDebug("-" + group.name);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void setInitialOffsets(ModelRenderer r, float x, float y, float z) {
|
|
||||||
// r.offsetX = x;
|
|
||||||
// r.offsetY = y;
|
|
||||||
// r.offsetZ = z;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
|
||||||
// try {
|
|
||||||
// EntityLivingBase entLive = (EntityLivingBase)entity;
|
|
||||||
// ItemStack stack = entLive.getEquipmentInSlot(0);
|
|
||||||
// heldItemRight = (stack != null) ? 1 : 0;
|
|
||||||
// isSneak = entLive.isSneaking();
|
|
||||||
// isRiding = entLive.isRiding();
|
|
||||||
// EntityPlayer entPlayer = (EntityPlayer) entLive;
|
|
||||||
// if ((stack != null) && (entPlayer.getItemInUseCount() > 0))
|
|
||||||
// {
|
|
||||||
// EnumAction enumaction = stack.getItemUseAction();
|
|
||||||
// if (enumaction == EnumAction.block) {
|
|
||||||
// heldItemRight = 3;
|
|
||||||
// } else if (enumaction == EnumAction.bow) {
|
|
||||||
// aimedBow = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (Exception e){
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// bipedHead.isHidden = false;
|
|
||||||
// bipedBody.isHidden = false;
|
|
||||||
// bipedRightArm.isHidden = false;
|
|
||||||
// bipedLeftArm.isHidden = false;
|
|
||||||
// bipedRightLeg.isHidden = false;
|
|
||||||
// bipedLeftLeg.isHidden = false;
|
|
||||||
//
|
|
||||||
// bipedHead.showModel = true;
|
|
||||||
// bipedBody.showModel = true;
|
|
||||||
// bipedRightArm.showModel = true;
|
|
||||||
// bipedLeftArm.showModel = true;
|
|
||||||
// bipedRightLeg.showModel = true;
|
|
||||||
// bipedLeftLeg.showModel = true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
|
||||||
// aimedBow = false;
|
|
||||||
// isSneak = false;
|
|
||||||
// heldItemRight = 0;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
|
@ -1,100 +0,0 @@
|
||||||
package net.machinemuse.powersuits.client.render.item
|
|
||||||
|
|
||||||
import net.machinemuse.numina.general.MuseLogger
|
|
||||||
import net.machinemuse.powersuits.client.render.modelspec._
|
|
||||||
import net.minecraft.client.model.{ModelBiped, ModelRenderer}
|
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
|
||||||
import net.minecraft.entity.{Entity, EntityLivingBase}
|
|
||||||
import net.minecraft.item.{EnumAction, ItemStack}
|
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
|
||||||
import net.minecraftforge.client.model.obj.WavefrontObject
|
|
||||||
|
|
||||||
|
|
||||||
object ArmorModel {
|
|
||||||
def instance: ArmorModel = ArmorModelInstance.getInstance()
|
|
||||||
}
|
|
||||||
|
|
||||||
trait ArmorModel extends ModelBiped {
|
|
||||||
var renderSpec: NBTTagCompound = null
|
|
||||||
var visibleSection: Int = 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def clearAndAddChildWithInitialOffsets(mr: ModelRenderer, xo: Float, yo: Float, zo: Float) {
|
|
||||||
mr.cubeList.clear()
|
|
||||||
val rp = new RenderPart(this, mr)
|
|
||||||
mr.addChild(rp)
|
|
||||||
setInitialOffsets(rp, xo, yo, zo)
|
|
||||||
}
|
|
||||||
|
|
||||||
def init(): Unit = {
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F, 0.0F)
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F, 0.0F)
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F, 0.0F)
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F, 0.0F)
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F, 0.0F)
|
|
||||||
clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F, 0.0F)
|
|
||||||
bipedHeadwear.cubeList.clear()
|
|
||||||
bipedEars.cubeList.clear()
|
|
||||||
bipedCloak.cubeList.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private def logModelParts(model: WavefrontObject) {
|
|
||||||
MuseLogger.logDebug(model.toString + ":")
|
|
||||||
import scala.collection.JavaConversions._
|
|
||||||
for (group <- model.groupObjects) {
|
|
||||||
MuseLogger.logDebug("-" + group.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def setInitialOffsets(r: ModelRenderer, x: Float, y: Float, z: Float) {
|
|
||||||
r.offsetX = x
|
|
||||||
r.offsetY = y
|
|
||||||
r.offsetZ = z
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def prep(entity: Entity, par2: Float, par3: Float, par4: Float, par5: Float, par6: Float, scale: Float) {
|
|
||||||
try {
|
|
||||||
val entLive: EntityLivingBase = entity.asInstanceOf[EntityLivingBase]
|
|
||||||
val stack: ItemStack = entLive.getEquipmentInSlot(0)
|
|
||||||
heldItemRight = if (stack != null) 1 else 0
|
|
||||||
isSneak = entLive.isSneaking
|
|
||||||
isRiding = entLive.isRiding
|
|
||||||
val entPlayer = entLive.asInstanceOf[EntityPlayer]
|
|
||||||
if ((stack != null) && (entPlayer.getItemInUseCount > 0))
|
|
||||||
{
|
|
||||||
val enumaction = stack.getItemUseAction
|
|
||||||
if (enumaction == EnumAction.block) {
|
|
||||||
heldItemRight = 3
|
|
||||||
} else if (enumaction == EnumAction.bow) {
|
|
||||||
aimedBow = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case _: Exception =>
|
|
||||||
}
|
|
||||||
|
|
||||||
bipedHead.isHidden = false
|
|
||||||
bipedBody.isHidden = false
|
|
||||||
bipedRightArm.isHidden = false
|
|
||||||
bipedLeftArm.isHidden = false
|
|
||||||
bipedRightLeg.isHidden = false
|
|
||||||
bipedLeftLeg.isHidden = false
|
|
||||||
|
|
||||||
bipedHead.showModel = true
|
|
||||||
bipedBody.showModel = true
|
|
||||||
bipedRightArm.showModel = true
|
|
||||||
bipedLeftArm.showModel = true
|
|
||||||
bipedRightLeg.showModel = true
|
|
||||||
bipedLeftLeg.showModel = true
|
|
||||||
}
|
|
||||||
|
|
||||||
def post(entity: Entity, par2: Float, par3: Float, par4: Float, par5: Float, par6: Float, scale: Float): Unit = {
|
|
||||||
aimedBow = false
|
|
||||||
isSneak = false
|
|
||||||
heldItemRight = 0
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
//package net.machinemuse.powersuits.client.render.item;
|
|
||||||
//
|
|
||||||
//import net.minecraft.client.model.ModelRenderer;
|
|
||||||
//import net.minecraft.entity.Entity;
|
|
||||||
//import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Ported to Java by lehjr on 10/21/16.
|
|
||||||
// */
|
|
||||||
//interface IArmorModel {
|
|
||||||
// NBTTagCompound renderSpec = null;
|
|
||||||
// int visibleSection = 0;
|
|
||||||
//
|
|
||||||
// ArmorModel instance = ArmorModelInstance.getInstance();
|
|
||||||
//
|
|
||||||
// void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo);
|
|
||||||
//
|
|
||||||
// void init();
|
|
||||||
//
|
|
||||||
// void setInitialOffsets(ModelRenderer r, float x, float y, float z);
|
|
||||||
//
|
|
||||||
// void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale);
|
|
||||||
//
|
|
||||||
// void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale);
|
|
||||||
//}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package net.machinemuse.powersuits.client.render.item
|
|
||||||
|
|
||||||
import api.player.model.ModelPlayer
|
|
||||||
import net.minecraft.entity.Entity
|
|
||||||
import net.smart.render.playerapi.SmartRender
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: MachineMuse (Claire Semple)
|
|
||||||
* Created: 9:23 PM, 11/07/13
|
|
||||||
*/
|
|
||||||
class SMovingArmorModel extends ModelPlayer(0) with ArmorModel {
|
|
||||||
val renderPlayerBase = SmartRender.getPlayerBase(this)
|
|
||||||
val model = renderPlayerBase.getRenderModel
|
|
||||||
|
|
||||||
this.bipedHead = model.bipedHead
|
|
||||||
this.bipedBody = model.bipedBody
|
|
||||||
this.bipedRightArm = model.bipedRightArm
|
|
||||||
this.bipedLeftArm = model.bipedLeftArm
|
|
||||||
this.bipedRightLeg = model.bipedRightLeg
|
|
||||||
this.bipedLeftLeg = model.bipedLeftLeg
|
|
||||||
this.bipedHeadwear = model.bipedHeadwear
|
|
||||||
this.bipedEars = model.bipedEars
|
|
||||||
this.bipedCloak = model.bipedCloak
|
|
||||||
init()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the models various rotation angles then renders the model.
|
|
||||||
*/
|
|
||||||
override def render(entity: Entity, par2: Float, par3: Float, par4: Float, par5: Float, par6: Float, scale: Float) {
|
|
||||||
prep(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
renderPlayerBase.setRotationAngles(par2, par3, par4, par5, par6, scale, entity)
|
|
||||||
renderPlayerBase.render(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
post(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
//package net.machinemuse.powersuits.client.render.item;
|
|
||||||
//
|
|
||||||
//import net.minecraft.client.model.ModelRenderer;
|
|
||||||
//import net.minecraft.entity.Entity;
|
|
||||||
//import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Author: MachineMuse (Claire Semple)
|
|
||||||
// * Created: 9:24 PM, 11/07/13
|
|
||||||
// *
|
|
||||||
// * Ported to Java by lehjr on 10/20/16.
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
///*
|
|
||||||
// Probably hold off on this for now. looks like some of the traits will need to be converted to Java classes and Interfaces.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//public class VanillaArmorModel implements ArmorModel {
|
|
||||||
// @Override
|
|
||||||
// public void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo) {
|
|
||||||
// super.clearAndAddChildWithInitialOffsets(mr, xo, yo, zo);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void init() {
|
|
||||||
// super.init();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void setInitialOffsets(ModelRenderer r, float x, float y, float z) {
|
|
||||||
// super.setInitialOffsets(r, x, y, z);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
|
||||||
// super.prep(entity, par2, par3, par4, par5, par6, scale);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
|
||||||
// super.post(entity, par2, par3, par4, par5, par6, scale);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Sets the models various rotation angles then renders the model.
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale) {
|
|
||||||
// prep(entity, par2, par3, par4, par5, par6, scale);
|
|
||||||
// setRotationAngles(par2, par3, par4, par5, par6, scale, entity);
|
|
||||||
// super.render(entity, par2, par3, par4, par5, par6, scale);
|
|
||||||
// post(entity, par2, par3, par4, par5, par6, scale);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public NBTTagCompound renderSpec() {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void renderSpec_$eq(NBTTagCompound renderSpec) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int visibleSection() {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void visibleSection_$eq(int visibleSection) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
|
@ -1,20 +0,0 @@
|
||||||
package net.machinemuse.powersuits.client.render.item
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: MachineMuse (Claire Semple)
|
|
||||||
* Created: 9:24 PM, 11/07/13
|
|
||||||
*/
|
|
||||||
class VanillaArmorModel extends ArmorModel {
|
|
||||||
init()
|
|
||||||
/**
|
|
||||||
* Sets the models various rotation angles then renders the model.
|
|
||||||
*/
|
|
||||||
override def render(entity: Entity, par2: Float, par3: Float, par4: Float, par5: Float, par6: Float, scale: Float) {
|
|
||||||
prep(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
setRotationAngles(par2, par3, par4, par5, par6, scale, entity)
|
|
||||||
super.render(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
post(entity, par2, par3, par4, par5, par6, scale)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +1,11 @@
|
||||||
//package net.machinemuse.powersuits.client.render.modelspec;
|
package net.machinemuse.powersuits.client.render.modelspec;
|
||||||
//
|
|
||||||
//import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
//import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * Ported to Java by lehjr on 11/5/16.
|
* Ported to Java by lehjr on 11/5/16.
|
||||||
// */
|
*/
|
||||||
//public class ArmorMorphTarget {
|
//public class ArmorMorphTarget {
|
||||||
// public interface MorphTarget {
|
// public interface MorphTarget {
|
||||||
// String name = null;
|
// String name = null;
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
//package net.machinemuse.powersuits.client.render.modelspec;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * Ported to Java by lehjr on 11/8/16.
|
||||||
|
// */
|
||||||
|
//public enum MorphTarget {
|
||||||
|
// Cloak("Cloak", m.bipedCloak),
|
||||||
|
// Head("Head", m.bipedHead),
|
||||||
|
// Body("Body", m.bipedBody),
|
||||||
|
// RightArm("RightArm", m.bipedRightArm),
|
||||||
|
// LeftArm("LeftArm", m.bipedRightArm),
|
||||||
|
// RightLeg("RightLe", m.bipedRightLeg),
|
||||||
|
// LeftLeg("LeftLeg", m.bipedLeftLeg);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public MorphTarget(String name, ModelBiped)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// sealed trait MorphTarget {
|
||||||
|
//// val name: String
|
||||||
|
//// val degrad = 180F / Math.PI.asInstanceOf[Float]
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped): ModelRenderer
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object Cloak extends MorphTarget {
|
||||||
|
//// val name = "Cloak"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedCloak
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object Head extends MorphTarget {
|
||||||
|
//// val name = "Head"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedHead
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object Body extends MorphTarget {
|
||||||
|
//// val name = "Body"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedBody
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object RightArm extends MorphTarget {
|
||||||
|
//// val name = "RightArm"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedRightArm
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object LeftArm extends MorphTarget {
|
||||||
|
//// val name = "LeftArm"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedLeftArm
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object RightLeg extends MorphTarget {
|
||||||
|
//// val name = "RightLeg"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedRightLeg
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////case object LeftLeg extends MorphTarget {
|
||||||
|
//// val name = "LeftLeg"
|
||||||
|
////
|
||||||
|
//// def apply(m: ModelBiped) = m.bipedLeftLeg
|
||||||
|
////}
|
|
@ -1,81 +0,0 @@
|
||||||
package net.machinemuse.powersuits.client.render.modelspec
|
|
||||||
|
|
||||||
import net.machinemuse.general.NBTTagAccessor
|
|
||||||
import net.machinemuse.numina.geometry.Colour
|
|
||||||
import net.machinemuse.numina.render.MuseTextureUtils
|
|
||||||
import net.machinemuse.powersuits.client.render.item.ArmorModel
|
|
||||||
import net.machinemuse.utils.render.Render
|
|
||||||
import net.minecraft.client.model.{ModelBase, ModelRenderer}
|
|
||||||
import net.minecraft.client.renderer.{OpenGlHelper, RenderHelper}
|
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
|
||||||
import org.lwjgl.opengl.GL11
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author: MachineMuse (Claire Semple)
|
|
||||||
* Created: 4:16 AM, 29/04/13
|
|
||||||
*/
|
|
||||||
|
|
||||||
class RenderPart(base: ModelBase, val parent: ModelRenderer) extends ModelRenderer(base) {
|
|
||||||
override def render(scale: Float) {
|
|
||||||
val renderSpec = ArmorModel.instance.renderSpec
|
|
||||||
import scala.collection.JavaConverters._
|
|
||||||
val colours = renderSpec.getIntArray("colours")
|
|
||||||
|
|
||||||
for (nbt <- NBTTagAccessor.getValues(renderSpec).asScala) {
|
|
||||||
val part = ModelRegistry.getPart(nbt)
|
|
||||||
if (part.isDefined) {
|
|
||||||
if (part.get.slot == ArmorModel.instance.visibleSection && part.get.morph.apply(ArmorModel.instance) == parent) {
|
|
||||||
var prevBrightX: Float = OpenGlHelper.lastBrightnessX;
|
|
||||||
var prevBrightY: Float = OpenGlHelper.lastBrightnessY;
|
|
||||||
|
|
||||||
// GLOW stuff on
|
|
||||||
if (part.get.getGlow(nbt)) {
|
|
||||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT)
|
|
||||||
RenderHelper.disableStandardItemLighting()
|
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F)
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glPushMatrix()
|
|
||||||
GL11.glScaled(scale, scale, scale)
|
|
||||||
MuseTextureUtils.bindTexture(part.get.getTexture(nbt))
|
|
||||||
applyTransform()
|
|
||||||
val ix = part.get.getColourIndex(nbt)
|
|
||||||
if (ix < colours.size && ix >= 0) {
|
|
||||||
Colour.doGLByInt(colours(ix))
|
|
||||||
}
|
|
||||||
part.get.modelSpec.applyOffsetAndRotation() // not yet implemented
|
|
||||||
part.get.modelSpec.model.renderPart(part.get.partName)
|
|
||||||
Colour.WHITE.doGL()
|
|
||||||
GL11.glPopMatrix()
|
|
||||||
|
|
||||||
// GLOW stuff off
|
|
||||||
if (part.get.getGlow(nbt)) {
|
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY)
|
|
||||||
GL11.glPopAttrib()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val degrad = 180F / Math.PI.asInstanceOf[Float]
|
|
||||||
|
|
||||||
// def withMaybeGlow[A](part: ModelPartSpec, nbt: NBTTagCompound)(r: Render[A]): Render[A] = {
|
|
||||||
// if (part.getGlow(nbt)) {
|
|
||||||
// Render withGlow r
|
|
||||||
// } else {
|
|
||||||
// r
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
def applyTransform() {
|
|
||||||
// glTranslatef(rotationPointX, rotationPointY, rotationPointZ)
|
|
||||||
// glRotatef(rotateAngleZ * degrad, 0.0F, 0.0F, 1.0F)
|
|
||||||
// glRotatef(rotateAngleY * degrad, 0.0F, 1.0F, 0.0F)
|
|
||||||
// glRotatef(rotateAngleX * degrad, 1.0F, 0.0F, 0.0F)
|
|
||||||
GL11.glRotatef(180, 1.0F, 0.0F, 0.0F)
|
|
||||||
|
|
||||||
GL11.glTranslated(offsetX, offsetY - 26, offsetZ)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,108 +1,108 @@
|
||||||
package net.machinemuse.utils.render
|
//package net.machinemuse.utils.render
|
||||||
|
//
|
||||||
import net.minecraft.client.renderer.{GLAllocation, OpenGlHelper, RenderHelper}
|
//import net.minecraft.client.renderer.{GLAllocation, OpenGlHelper, RenderHelper}
|
||||||
import org.lwjgl.opengl.GL11
|
//import org.lwjgl.opengl.GL11
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Library for working with rendering.
|
// * Library for working with rendering.
|
||||||
*
|
// *
|
||||||
* (c) 2013 Byron Shelden
|
// * (c) 2013 Byron Shelden
|
||||||
* Edited by Claire Semple
|
// * Edited by Claire Semple
|
||||||
*/
|
// */
|
||||||
trait Render[A] {
|
//trait Render[A] {
|
||||||
def run(): A
|
// def run(): A
|
||||||
|
//
|
||||||
import Render._
|
// import Render._
|
||||||
|
//
|
||||||
def compile(): Render[A] = Render.compile(this)
|
// def compile(): Render[A] = Render.compile(this)
|
||||||
|
//
|
||||||
def map[B](f: A => B) = mk {
|
// def map[B](f: A => B) = mk {
|
||||||
f(run())
|
// f(run())
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def flatMap[B](f: A => Render[B]) = mk {
|
// def flatMap[B](f: A => Render[B]) = mk {
|
||||||
f(run()).run()
|
// f(run()).run()
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
object Render {
|
//object Render {
|
||||||
private def mk[A](act: => A): Render[A] = new Render[A] {
|
// private def mk[A](act: => A): Render[A] = new Render[A] {
|
||||||
def run() = act
|
// def run() = act
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def apply[A](act: => A): Render[A] = mk(act)
|
// def apply[A](act: => A): Render[A] = mk(act)
|
||||||
|
//
|
||||||
def liftIO[A](act: => A): Render[A] = mk(act)
|
// def liftIO[A](act: => A): Render[A] = mk(act)
|
||||||
|
//
|
||||||
def pure[A](a: => A): Render[A] = mk(a)
|
// def pure[A](a: => A): Render[A] = mk(a)
|
||||||
|
//
|
||||||
def withPushedMatrix[A](r: Render[A]): Render[A] = mk {
|
// def withPushedMatrix[A](r: Render[A]): Render[A] = mk {
|
||||||
GL11.glPushMatrix()
|
// GL11.glPushMatrix()
|
||||||
val a = r.run()
|
// val a = r.run()
|
||||||
GL11.glPopMatrix()
|
// GL11.glPopMatrix()
|
||||||
a
|
// a
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def fromBuffer[A](buf: TextureBuffer)(r: Render[A]): Render[A] = mk {
|
// def fromBuffer[A](buf: TextureBuffer)(r: Render[A]): Render[A] = mk {
|
||||||
buf.bindRead()
|
// buf.bindRead()
|
||||||
// MuseLogger.logDebug("Bound buffer for reading")
|
// // MuseLogger.logDebug("Bound buffer for reading")
|
||||||
val a = r.run()
|
// val a = r.run()
|
||||||
// MuseLogger.logDebug("Unbound buffer for reading")
|
// // MuseLogger.logDebug("Unbound buffer for reading")
|
||||||
buf.unbindRead()
|
// buf.unbindRead()
|
||||||
a
|
// a
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def toBuffer[A](buf: TextureBuffer)(r: Render[A]): Render[A] = mk {
|
// def toBuffer[A](buf: TextureBuffer)(r: Render[A]): Render[A] = mk {
|
||||||
buf.bindWrite()
|
// buf.bindWrite()
|
||||||
// MuseLogger.logDebug("Bound buffer for writing")
|
// // MuseLogger.logDebug("Bound buffer for writing")
|
||||||
val a = r.run()
|
// val a = r.run()
|
||||||
// MuseLogger.logDebug("Unbound buffer for writing")
|
// // MuseLogger.logDebug("Unbound buffer for writing")
|
||||||
buf.unbindWrite()
|
// buf.unbindWrite()
|
||||||
a
|
// a
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def withPushedAttrib[A](mask: Int)(r: Render[A]): Render[A] = mk {
|
// def withPushedAttrib[A](mask: Int)(r: Render[A]): Render[A] = mk {
|
||||||
GL11.glPushAttrib(mask)
|
// GL11.glPushAttrib(mask)
|
||||||
val a = r.run()
|
// val a = r.run()
|
||||||
GL11.glPopAttrib()
|
// GL11.glPopAttrib()
|
||||||
a
|
// a
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Compiles the given render into a display list.
|
// * Compiles the given render into a display list.
|
||||||
*
|
// *
|
||||||
* Note that the yield from the compiled render is captured and used as the yield of the call action.
|
// * Note that the yield from the compiled render is captured and used as the yield of the call action.
|
||||||
*
|
// *
|
||||||
* @return a render action that invokes the compiled display list.
|
// * @return a render action that invokes the compiled display list.
|
||||||
*/
|
// */
|
||||||
def compile[A](r: Render[A]): Render[A] = {
|
// def compile[A](r: Render[A]): Render[A] = {
|
||||||
val listIndex = GLAllocation.generateDisplayLists(1)
|
// val listIndex = GLAllocation.generateDisplayLists(1)
|
||||||
GL11.glNewList(listIndex, GL11.GL_COMPILE)
|
// GL11.glNewList(listIndex, GL11.GL_COMPILE)
|
||||||
val a = r.run()
|
// val a = r.run()
|
||||||
GL11.glEndList()
|
// GL11.glEndList()
|
||||||
|
//
|
||||||
mk {
|
// mk {
|
||||||
GL11.glCallList(listIndex)
|
// GL11.glCallList(listIndex)
|
||||||
a
|
// a
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
def withGlow[A](r: Render[A]): Render[A] = {
|
// def withGlow[A](r: Render[A]): Render[A] = {
|
||||||
for {
|
// for {
|
||||||
saved <- Render.liftIO {
|
// saved <- Render.liftIO {
|
||||||
(OpenGlHelper.lastBrightnessX, OpenGlHelper.lastBrightnessY)
|
// (OpenGlHelper.lastBrightnessX, OpenGlHelper.lastBrightnessY)
|
||||||
}
|
// }
|
||||||
_ <- Render {
|
// _ <- Render {
|
||||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT)
|
// GL11.glPushAttrib(GL11.GL_LIGHTING_BIT)
|
||||||
RenderHelper.disableStandardItemLighting()
|
// RenderHelper.disableStandardItemLighting()
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F)
|
// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F)
|
||||||
}
|
// }
|
||||||
a <- r
|
// a <- r
|
||||||
_ <- Render {
|
// _ <- Render {
|
||||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, saved._1, saved._2)
|
// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, saved._1, saved._2)
|
||||||
GL11.glPopAttrib()
|
// GL11.glPopAttrib()
|
||||||
}
|
// }
|
||||||
} yield (a)
|
// } yield (a)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
Loading…
Reference in a new issue