diff --git a/src/minecraft/net/machinemuse/powersuits/client/render/item/ArmorModel.scala b/src/minecraft/net/machinemuse/powersuits/client/render/item/ArmorModel.scala index da6a916..db3f701 100644 --- a/src/minecraft/net/machinemuse/powersuits/client/render/item/ArmorModel.scala +++ b/src/minecraft/net/machinemuse/powersuits/client/render/item/ArmorModel.scala @@ -12,10 +12,10 @@ import net.minecraft.nbt.NBTTagCompound import net.minecraft.src.ModelPlayer object ArmorModel { - val instance = new ArmorModel(0.0F, 0.0f, 64, 32) + val instance = new ArmorModel(0.0F) } -class ArmorModel(par1: Float, par2: Float, par3: Int, par4: Int) extends ModelPlayer(0.0F) { +class ArmorModel(height: Float) extends ModelPlayer(0.0F) { var renderSpec: NBTTagCompound = null var visible: Int = 0 @@ -26,12 +26,12 @@ class ArmorModel(par1: Float, par2: Float, par3: Int, par4: Int) extends ModelPl setInitialOffsets(rp, xo, yo, zo) } - clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F + par2, 0.0F) - clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F + par2, 0.0F) - clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F + par2, 0.0F) - clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F + par2, 0.0F) - clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F + par2, 0.0F) - clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F + par2, 0.0F) + clearAndAddChildWithInitialOffsets(bipedHead, 0.0F, 0.0F + height, 0.0F) + clearAndAddChildWithInitialOffsets(bipedBody, 0.0F, 0.0F + height, 0.0F) + clearAndAddChildWithInitialOffsets(bipedRightArm, 5, 2.0F + height, 0.0F) + clearAndAddChildWithInitialOffsets(bipedLeftArm, -5, 2.0F + height, 0.0F) + clearAndAddChildWithInitialOffsets(bipedRightLeg, 2, 12.0F + height, 0.0F) + clearAndAddChildWithInitialOffsets(bipedLeftLeg, -2, 12.0F + height, 0.0F) bipedHeadwear.cubeList.clear() bipedEars.cubeList.clear() diff --git a/src/minecraft/net/machinemuse/powersuits/event/RenderEventHandler.java b/src/minecraft/net/machinemuse/powersuits/event/RenderEventHandler.java index f10fc17..f60306f 100644 --- a/src/minecraft/net/machinemuse/powersuits/event/RenderEventHandler.java +++ b/src/minecraft/net/machinemuse/powersuits/event/RenderEventHandler.java @@ -3,9 +3,11 @@ package net.machinemuse.powersuits.event; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.machinemuse.powersuits.common.Config; +import net.machinemuse.utils.MusePlayerUtils; import net.machinemuse.utils.render.GlowBuffer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; +import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.event.ForgeSubscribe; @@ -26,4 +28,20 @@ public class RenderEventHandler { public void onTextureStitch(TextureStitchEvent.Post event) { // MuseIcon.registerAllIcons(event.map); } + + static boolean ownFly = false; + @ForgeSubscribe + public void onPreRenderPlayer(RenderPlayerEvent.Pre event) { + if(!event.entityPlayer.capabilities.isFlying && !event.entityPlayer.onGround && MusePlayerUtils.computePlayerVelocity(event.entityPlayer) > 0.2) { + event.entityPlayer.capabilities.isFlying = true; + ownFly = true; + } + } + @ForgeSubscribe + public void onPostRenderPlayer(RenderPlayerEvent.Post event) { + if(ownFly) { + ownFly = false; + event.entityPlayer.capabilities.isFlying = false; + } + } } diff --git a/src/minecraft/net/machinemuse/powersuits/item/ModularItemBase.scala b/src/minecraft/net/machinemuse/powersuits/item/ModularItemBase.scala index b73d51e..448167d 100644 --- a/src/minecraft/net/machinemuse/powersuits/item/ModularItemBase.scala +++ b/src/minecraft/net/machinemuse/powersuits/item/ModularItemBase.scala @@ -17,8 +17,7 @@ import net.machinemuse.api.{ModuleManager, IModularItem} */ trait ModularItemBase extends Item with IModularItem with MuseElectricItem { @SideOnly(Side.CLIENT) override def getColorFromItemStack(stack: ItemStack, par2: Int): Int = { - val c: Colour = getColorFromItemStack(stack) - return c.getInt + getColorFromItemStack(stack).getInt } def getGlowFromItemStack(stack: ItemStack): Colour = { @@ -29,7 +28,7 @@ trait ModularItemBase extends Item with IModularItem with MuseElectricItem { val computedgreen: Double = ModuleManager.computeModularProperty(stack, CosmeticGlowModule.GREEN_GLOW) val computedblue: Double = ModuleManager.computeModularProperty(stack, CosmeticGlowModule.BLUE_GLOW) val colour: Colour = new Colour(clampDouble(computedred, 0, 1), clampDouble(computedgreen, 0, 1), clampDouble(computedblue, 0, 1), 0.8) - return colour + colour } def getColorFromItemStack(stack: ItemStack): Colour = { @@ -40,12 +39,10 @@ trait ModularItemBase extends Item with IModularItem with MuseElectricItem { val computedgreen: Double = ModuleManager.computeModularProperty(stack, TintModule.GREEN_TINT) val computedblue: Double = ModuleManager.computeModularProperty(stack, TintModule.BLUE_TINT) val colour: Colour = new Colour(clampDouble(computedred, 0, 1), clampDouble(computedgreen, 0, 1), clampDouble(computedblue, 0, 1), 1.0F) - return colour + colour } - @SideOnly(Side.CLIENT) override def requiresMultipleRenderPasses: Boolean = { - return false - } + @SideOnly(Side.CLIENT) override def requiresMultipleRenderPasses: Boolean = false /** * Adds information to the item's tooltip when 'getting' it. @@ -63,16 +60,14 @@ trait ModularItemBase extends Item with IModularItem with MuseElectricItem { MuseCommonStrings.addInformation(stack, player, currentTipList, advancedToolTips) } - def formatInfo(string: String, value: Double): String = { - return string + '\t' + MuseStringUtils.formatNumberShort(value) - } + def formatInfo(string: String, value: Double): String = string + '\t' + MuseStringUtils.formatNumberShort(value) def getLongInfo(player: EntityPlayer, stack: ItemStack): java.util.List[String] = { val info = new java.util.ArrayList[String] - info.add("Detailed Summary") - info.add(formatInfo("Armor", getArmorDouble(player, stack))) - info.add(formatInfo("Energy Storage", getCurrentEnergy(stack)) + 'J') - info.add(formatInfo("Weight", MuseCommonStrings.getTotalWeight(stack)) + 'g') + info add "Detailed Summary" + info add formatInfo("Armor", getArmorDouble(player, stack)) + info add formatInfo("Energy Storage", getCurrentEnergy(stack)) + 'J' + info add formatInfo("Weight", MuseCommonStrings.getTotalWeight(stack)) + 'g' info } diff --git a/src/minecraft/net/machinemuse/utils/MusePlayerUtils.java b/src/minecraft/net/machinemuse/utils/MusePlayerUtils.java index 5f369f5..1d778b7 100644 --- a/src/minecraft/net/machinemuse/utils/MusePlayerUtils.java +++ b/src/minecraft/net/machinemuse/utils/MusePlayerUtils.java @@ -379,4 +379,8 @@ public class MusePlayerUtils { } return movementfactorfieldinstance; } + + public static double computePlayerVelocity(EntityPlayer entityPlayer) { + return MuseMathUtils.pythag(entityPlayer.motionX, entityPlayer.motionY, entityPlayer.motionZ); + } }