mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:01:32 +01:00
Animations Mod 2.0
This commit is contained in:
parent
381620b7ca
commit
7d8e00a983
@ -9,8 +9,6 @@ import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.shader.ShaderGroup;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.cosmetics.StaticResourceLocation;
|
||||
@ -26,10 +24,12 @@ import net.silentclient.client.mods.settings.RenderMod;
|
||||
import net.silentclient.client.utils.CloudRenderer;
|
||||
import net.silentclient.client.utils.HUDCaching;
|
||||
import net.silentclient.client.utils.OptifinePatch;
|
||||
import net.silentclient.client.utils.animations.SneakHandler;
|
||||
import net.silentclient.client.utils.culling.EntityCulling;
|
||||
import net.silentclient.client.utils.shader.MotionBlurUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@ -46,10 +46,12 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
private float prevRotationYaw;
|
||||
private float rotationPitch;
|
||||
private float prevRotationPitch;
|
||||
@Unique
|
||||
private float partialTicks;
|
||||
|
||||
@Inject(method = "orientCamera", at = @At("HEAD"))
|
||||
public void orientCamera(float partialTicks, CallbackInfo ci) {
|
||||
|
||||
this.partialTicks = partialTicks;
|
||||
rotationYaw = mc.getRenderViewEntity().rotationYaw;
|
||||
prevRotationYaw = mc.getRenderViewEntity().prevRotationYaw;
|
||||
rotationPitch = mc.getRenderViewEntity().rotationPitch;
|
||||
@ -68,35 +70,10 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
GlStateManager.rotate(event.getRoll(), 0, 0, 1);
|
||||
}
|
||||
|
||||
private float eyeHeightSubtractor;
|
||||
private long lastEyeHeightUpdate;
|
||||
|
||||
@Redirect(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getEyeHeight()F"))
|
||||
public float orientCamera(Entity entity) {
|
||||
if(Client.getInstance().getModInstances().getModByClass(AnimationsMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "Smooth Sneaking").getValBoolean() && entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
float height = player.getEyeHeight();
|
||||
if(player.isSneaking()) {
|
||||
height += 0.08F;
|
||||
}
|
||||
float actualEyeHeightSubtractor = player.isSneaking() ? 0.08F : 0;
|
||||
long sinceLastUpdate = System.currentTimeMillis() - lastEyeHeightUpdate;
|
||||
lastEyeHeightUpdate = System.currentTimeMillis();
|
||||
if(actualEyeHeightSubtractor > eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor += sinceLastUpdate / 500f;
|
||||
if(actualEyeHeightSubtractor < eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor = actualEyeHeightSubtractor;
|
||||
}
|
||||
}
|
||||
else if(actualEyeHeightSubtractor < eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor -= sinceLastUpdate / 500f;
|
||||
if(actualEyeHeightSubtractor > eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor = actualEyeHeightSubtractor;
|
||||
}
|
||||
}
|
||||
return height - eyeHeightSubtractor;
|
||||
}
|
||||
return entity.getEyeHeight();
|
||||
if (mc.getRenderViewEntity() != mc.thePlayer) return entity.getEyeHeight();
|
||||
return SneakHandler.getInstance().getEyeHeight(partialTicks);
|
||||
}
|
||||
|
||||
@Redirect(method = "orientCamera", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;rotationYaw:F"))
|
||||
@ -226,20 +203,6 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
NotificationManager.render();
|
||||
}
|
||||
|
||||
@Inject(method = "renderHand", at = @At("HEAD"))
|
||||
public void swingProgress(float partialTicks, int xOffset, CallbackInfo ci) {
|
||||
if(mc.thePlayer != null && Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Punching Animation").getValBoolean()
|
||||
&& mc.objectMouseOver != null
|
||||
&& mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK
|
||||
&& mc.thePlayer != null
|
||||
&& mc.gameSettings.keyBindAttack.isKeyDown() && mc.gameSettings.keyBindUseItem.isKeyDown()
|
||||
&& mc.thePlayer.getItemInUseCount() > 0 && (!mc.thePlayer.isSwingInProgress
|
||||
|| mc.thePlayer.swingProgressInt < 0)) {
|
||||
mc.thePlayer.swingProgressInt = -1;
|
||||
mc.thePlayer.isSwingInProgress = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiIngame;renderGameOverlay(F)V"))
|
||||
public void renderCachedHUD(GuiIngame guiIngame, float partialTicks) {
|
||||
HUDCaching.renderCachedHud((EntityRenderer) (Object) this, guiIngame, partialTicks);
|
||||
|
@ -36,7 +36,7 @@ public abstract class GuiInGameMixin extends Gui {
|
||||
|
||||
@Redirect(method = "renderPlayerStats", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiIngame;drawTexturedModalRect(IIIIII)V", ordinal = 4))
|
||||
public void oldHealth(GuiIngame instance, int i1, int i2, int i3, int i4, int i5, int i6) {
|
||||
if(!Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() || !Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Health Animation").getValBoolean()) {
|
||||
if(!Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() || !AnimationsMod.getSettingBoolean("Remove Health Bar Flashing")) {
|
||||
instance.drawTexturedModalRect(i1, i2, i3, i4, i5, i6);
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,11 @@ package net.silentclient.client.mixin.mixins;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.impl.EventTransformFirstPersonItem;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import net.silentclient.client.mods.render.PackTweaksMod;
|
||||
import net.silentclient.client.utils.animations.AnimationHandler;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -13,6 +15,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ItemRenderer.class)
|
||||
@ -25,6 +28,8 @@ public class ItemRendererMixin {
|
||||
|
||||
@Shadow @Final private Minecraft mc;
|
||||
|
||||
@Shadow private int equippedItemSlot;
|
||||
|
||||
@Inject(method = "transformFirstPersonItem", at = @At("HEAD"))
|
||||
public void transformFirstPersonItem(float equipProgress, float swingProgress, CallbackInfo ci) {
|
||||
EventTransformFirstPersonItem event = new EventTransformFirstPersonItem(itemToRender, equipProgress, swingProgress);
|
||||
@ -42,6 +47,16 @@ public class ItemRendererMixin {
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(method = "updateEquippedItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/MathHelper;clamp_float(FFF)F"), index = 0)
|
||||
private float handleItemSwitch(float original) {
|
||||
EntityPlayer entityplayer = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
|
||||
if (AnimationsMod.getSettingBoolean("Item Switching Animation") && this.equippedItemSlot == entityplayer.inventory.currentItem && ItemStack.areItemsEqual(this.itemToRender, itemstack)) {
|
||||
return 1.0f - this.equippedProgress;
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
@Inject(method = "renderWaterOverlayTexture", at = @At("HEAD"), cancellable = true)
|
||||
public void cancelWaterOverlay(float partialTicks, CallbackInfo ci) {
|
||||
if (Client.getInstance().getModInstances().getModByClass(PackTweaksMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(PackTweaksMod.class, "Water Fog").getValBoolean() == false) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -11,9 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public class LayerArmorBaseMixin {
|
||||
@Inject(method = "shouldCombineTextures", at = @At("HEAD"), cancellable = true)
|
||||
private void shouldCombineTextures(CallbackInfoReturnable<Boolean> cir) {
|
||||
if(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled()) {
|
||||
cir.setReturnValue(true);
|
||||
cir.cancel();
|
||||
}
|
||||
if (AnimationsMod.getSettingBoolean("Red Armor")) cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
|
||||
}
|
||||
|
||||
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;endSection()V", shift = At.Shift.BEFORE))
|
||||
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;endSection()V", ordinal = 1, shift = At.Shift.BEFORE))
|
||||
public void tickEvent(CallbackInfo callbackInfo) {
|
||||
new ClientTickEvent().call();
|
||||
}
|
||||
@ -195,11 +195,15 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
|
||||
@Inject(method = "rightClickMouse", at = @At("HEAD"))
|
||||
public void rightClickMouse(CallbackInfo ci) {
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Punching Animation").getValBoolean() &&
|
||||
if (AnimationsMod.getSettingBoolean("Punching During Usage") &&
|
||||
Minecraft.getMinecraft().playerController.getIsHittingBlock() &&
|
||||
Minecraft.getMinecraft().thePlayer.getHeldItem() != null &&
|
||||
(Minecraft.getMinecraft().thePlayer.getHeldItem().getItemUseAction() != EnumAction.NONE ||
|
||||
Minecraft.getMinecraft().thePlayer.getHeldItem().getItem() instanceof ItemBlock)) {
|
||||
// This sends packets to the server saying we stopped breaking.
|
||||
// Simply making getIsHittingBlock return false will make the server
|
||||
// think we are still breaking the block while right clicking.
|
||||
// Which is bad. Obviously.
|
||||
Minecraft.getMinecraft().playerController.resetBlockRemoving();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
@ -11,6 +10,6 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
public class ModelBipedMixin {
|
||||
@ModifyConstant(method = "setRotationAngles", constant = @Constant(floatValue = -0.5235988F))
|
||||
private float cancelRotation(float original) {
|
||||
return Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block Animation").getValBoolean() ? 0 : original;
|
||||
return AnimationsMod.getSettingBoolean("1.7 3rd Person Block Animation") ? 0 : original;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderFish;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import net.silentclient.client.utils.animations.FishingLineHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = RenderFish.class, priority = 1001)
|
||||
public class RenderFishMixin {
|
||||
@Redirect(method = "doRender", at = @At(value = "NEW", target = "net/minecraft/util/Vec3", ordinal = 0))
|
||||
private Vec3 oldFishingLine(double x, double y, double z) {
|
||||
return !AnimationsMod.getSettingBoolean("1.7 Rod Position") ? new Vec3(x, y, z) : FishingLineHandler.getInstance().getOffset();
|
||||
}
|
||||
}
|
@ -34,6 +34,24 @@ public abstract class RenderItemMixin {
|
||||
lastEntityToRenderFor = entityToRenderFor;
|
||||
}
|
||||
|
||||
@Inject(method = "renderItemModelTransform", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(" +
|
||||
"Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V")
|
||||
)
|
||||
public void renderItemModelForEntity_renderItem(ItemStack stack, IBakedModel model,
|
||||
ItemCameraTransforms.TransformType cameraTransformType, CallbackInfo ci) {
|
||||
if (cameraTransformType == ItemCameraTransforms.TransformType.THIRD_PERSON &&
|
||||
lastEntityToRenderFor instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) lastEntityToRenderFor;
|
||||
ItemStack heldStack = p.getHeldItem();
|
||||
if (heldStack != null && p.getItemInUseCount() > 0 &&
|
||||
heldStack.getItemUseAction() == EnumAction.BLOCK) {
|
||||
AnimationHandler.getInstance().doSwordBlock3rdPersonTransform();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow protected abstract void renderEffect(IBakedModel model);
|
||||
|
||||
@Shadow protected abstract void renderModel(IBakedModel model, int color);
|
||||
@ -76,22 +94,4 @@ public abstract class RenderItemMixin {
|
||||
renderEffect(model);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderItemModelTransform", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderItem(" +
|
||||
"Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V")
|
||||
)
|
||||
public void renderItemModelForEntity_renderItem(ItemStack stack, IBakedModel model,
|
||||
ItemCameraTransforms.TransformType cameraTransformType, CallbackInfo ci) {
|
||||
if (cameraTransformType == ItemCameraTransforms.TransformType.THIRD_PERSON &&
|
||||
lastEntityToRenderFor instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) lastEntityToRenderFor;
|
||||
ItemStack heldStack = p.getHeldItem();
|
||||
if (heldStack != null && p.getItemInUseCount() > 0 &&
|
||||
heldStack.getItemUseAction() == EnumAction.BLOCK) {
|
||||
AnimationHandler.getInstance().doSwordBlock3rdPersonTransform();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
package net.silentclient.client.mods.render;
|
||||
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.EventTarget;
|
||||
import net.silentclient.client.event.impl.ClientTickEvent;
|
||||
import net.silentclient.client.mods.Mod;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
import net.silentclient.client.utils.animations.AnimationHandler;
|
||||
import net.silentclient.client.utils.animations.SneakHandler;
|
||||
|
||||
public class AnimationsMod extends Mod {
|
||||
|
||||
@ -11,19 +16,32 @@ public class AnimationsMod extends Mod {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setUpdated(true);
|
||||
this.addBooleanSetting("1.7 Item Positions", this, true);
|
||||
this.addBooleanSetting("1.7 Bow Pullback", this, true);
|
||||
this.addBooleanSetting("1.7 Block Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Rod Position", this, true);
|
||||
this.addBooleanSetting("1.7 Punching Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Health Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Eating & Drinking Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Block-Hitting Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Item Switching Animation", this, true);
|
||||
this.addBooleanSetting("1.7 3rd Person Block Animation", this, true);
|
||||
this.addBooleanSetting("1.7 Throwing", this, true);
|
||||
this.addBooleanSetting("1.7 Enchant Glint", this, true);
|
||||
this.addBooleanSetting("1.7 Skins", this, false);
|
||||
this.addBooleanSetting("Smooth Sneaking", this, true);
|
||||
this.addBooleanSetting("No Shaking", this, true);
|
||||
this.addBooleanSetting("Consume Animation", this, true);
|
||||
this.addBooleanSetting("Block-Hitting Animation", this, true);
|
||||
this.addBooleanSetting("Red Armor", this, true);
|
||||
this.addBooleanSetting("Punching During Usage", this, true);
|
||||
this.addBooleanSetting("Item Switching Animation", this, true);
|
||||
this.addBooleanSetting("Remove Health Bar Flashing", this, true);
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onTick(ClientTickEvent event) {
|
||||
AnimationHandler.getInstance().updateSwingProgress();
|
||||
SneakHandler.getInstance().onTick();
|
||||
}
|
||||
|
||||
public static boolean getSettingBoolean(String name) {
|
||||
return Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, name).getValBoolean();
|
||||
}
|
||||
}
|
||||
|
@ -8,26 +8,18 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemCloth;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.EventTarget;
|
||||
import net.silentclient.client.event.impl.ClientTickEvent;
|
||||
import net.silentclient.client.mixin.accessors.ItemFoodAccessor;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class AnimationHandler {
|
||||
|
||||
private static final AnimationHandler INSTANCE = new AnimationHandler();
|
||||
private static final AnimationHandler INSTANCE = new AnimationHandler();
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public static AnimationHandler getInstance() {
|
||||
@ -62,13 +54,13 @@ public class AnimationHandler {
|
||||
*/
|
||||
private int getArmSwingAnimationEnd(EntityPlayerSP player) {
|
||||
return player.isPotionActive(Potion.digSpeed) ? 5 - player.getActivePotionEffect(Potion.digSpeed).getAmplifier() :
|
||||
(player.isPotionActive(Potion.digSlowdown) ? 8 + player.getActivePotionEffect(Potion.digSlowdown).getAmplifier() * 2 : 6);
|
||||
(player.isPotionActive(Potion.digSlowdown) ? 8 + player.getActivePotionEffect(Potion.digSlowdown).getAmplifier() * 2 : 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the swing progress, also enables swing if hitting a block
|
||||
*/
|
||||
private void updateSwingProgress() {
|
||||
public void updateSwingProgress() {
|
||||
final EntityPlayerSP player = mc.thePlayer;
|
||||
if (player == null) {
|
||||
return;
|
||||
@ -78,9 +70,9 @@ public class AnimationHandler {
|
||||
|
||||
int max = getArmSwingAnimationEnd(player);
|
||||
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Punching Animation").getValBoolean() && mc.gameSettings.keyBindAttack.isKeyDown() &&
|
||||
mc.objectMouseOver != null &&
|
||||
mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (AnimationsMod.getSettingBoolean("Punching During Usage") && mc.gameSettings.keyBindAttack.isKeyDown() &&
|
||||
mc.objectMouseOver != null &&
|
||||
mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
if (!this.isSwingInProgress || this.swingProgressInt >= max >> 1 || this.swingProgressInt < 0) {
|
||||
isSwingInProgress = true;
|
||||
swingProgressInt = -1;
|
||||
@ -101,11 +93,6 @@ public class AnimationHandler {
|
||||
this.swingProgress = (float) this.swingProgressInt / (float) max;
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onClientTick(ClientTickEvent event) {
|
||||
updateSwingProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an item from the first person perspective
|
||||
* The following code has been taken from 1.7 and heavily modified to be readable
|
||||
@ -124,24 +111,13 @@ public class AnimationHandler {
|
||||
}
|
||||
|
||||
final EnumAction action = stack.getItemUseAction();
|
||||
if ((item == Items.fishing_rod && !(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Rod Position").getValBoolean()))
|
||||
|| (action == EnumAction.NONE && !(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Item Positions").getValBoolean()))
|
||||
|| (action == EnumAction.BLOCK && !(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block Animation").getValBoolean()))
|
||||
|| (action == EnumAction.BOW && !(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Bow Pullback").getValBoolean()))) {
|
||||
if ((item == Items.fishing_rod && !AnimationsMod.getSettingBoolean("1.7 Rod Position"))
|
||||
|| (action == EnumAction.NONE && !AnimationsMod.getSettingBoolean("1.7 Item Positions"))
|
||||
|| (action == EnumAction.BLOCK && !AnimationsMod.getSettingBoolean("1.7 Block Animation"))
|
||||
|| (action == EnumAction.BOW && !AnimationsMod.getSettingBoolean("1.7 Bow Pullback"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mc.thePlayer != null && Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Punching Animation").getValBoolean()
|
||||
&& mc.objectMouseOver != null
|
||||
&& mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK
|
||||
&& mc.thePlayer != null
|
||||
&& mc.gameSettings.keyBindAttack.isKeyDown() && mc.gameSettings.keyBindUseItem.isKeyDown()
|
||||
&& mc.thePlayer.getItemInUseCount() > 0 && (!mc.thePlayer.isSwingInProgress
|
||||
|| mc.thePlayer.swingProgressInt < 0)) {
|
||||
mc.thePlayer.swingProgressInt = -1;
|
||||
mc.thePlayer.isSwingInProgress = true;
|
||||
}
|
||||
|
||||
final EntityPlayerSP player = mc.thePlayer;
|
||||
|
||||
float var4 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
@ -180,7 +156,7 @@ public class AnimationHandler {
|
||||
final float swingProgress = getSwingProgress(partialTicks);
|
||||
|
||||
boolean blockHitOverride = false;
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Punching Animation").getValBoolean() && useCount <= 0 && mc.gameSettings.keyBindUseItem.isKeyDown()) {
|
||||
if (AnimationsMod.getSettingBoolean("Punching During Usage") && useCount <= 0 && mc.gameSettings.keyBindUseItem.isKeyDown()) {
|
||||
boolean block = action == EnumAction.BLOCK;
|
||||
boolean consume = false;
|
||||
if (item instanceof ItemFood) {
|
||||
@ -200,17 +176,15 @@ public class AnimationHandler {
|
||||
case EAT:
|
||||
case DRINK:
|
||||
doConsumeAnimation(stack, useCount, partialTicks);
|
||||
doEquipAndSwingTransform(equipProgress, Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block-Hitting Animation").getValBoolean() ? swingProgress : 0);
|
||||
doEquipAndSwingTransform(equipProgress, AnimationsMod.getSettingBoolean("Block-Hitting Animation") ? swingProgress : 0);
|
||||
break;
|
||||
case BLOCK:
|
||||
doEquipAndSwingTransform(equipProgress, Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block-Hitting Animation").getValBoolean() ? swingProgress : 0);
|
||||
doEquipAndSwingTransform(equipProgress, AnimationsMod.getSettingBoolean("Block-Hitting Animation") ? swingProgress : 0);
|
||||
doSwordBlockAnimation();
|
||||
break;
|
||||
case BOW:
|
||||
doEquipAndSwingTransform(equipProgress, Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block-Hitting Animation").getValBoolean() ? swingProgress : 0);
|
||||
doEquipAndSwingTransform(equipProgress, AnimationsMod.getSettingBoolean("Block-Hitting Animation") ? swingProgress : 0);
|
||||
doBowAnimation(stack, useCount, partialTicks);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
doSwingTranslation(swingProgress);
|
||||
@ -240,7 +214,7 @@ public class AnimationHandler {
|
||||
}
|
||||
|
||||
public void doSwordBlock3rdPersonTransform() {
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block Animation").getValBoolean()) {
|
||||
if (AnimationsMod.getSettingBoolean("1.7 3rd Person Block Animation")) {
|
||||
GlStateManager.translate(-0.15f, -0.2f, 0);
|
||||
GlStateManager.rotate(70, 1, 0, 0);
|
||||
GlStateManager.translate(0.119f, 0.2f, -0.024f);
|
||||
@ -257,17 +231,17 @@ public class AnimationHandler {
|
||||
private boolean doFirstPersonTransform(ItemStack stack) {
|
||||
switch (stack.getItemUseAction()) {
|
||||
case BOW:
|
||||
if (!(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Bow Pullback").getValBoolean())) return true;
|
||||
if (!AnimationsMod.getSettingBoolean("1.7 Bow Pullback")) return true;
|
||||
break;
|
||||
case EAT:
|
||||
case DRINK:
|
||||
if (!(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Eating & Drinking Animation").getValBoolean())) return true;
|
||||
if (!AnimationsMod.getSettingBoolean("Consume Animation")) return true;
|
||||
break;
|
||||
case BLOCK:
|
||||
if (!(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Block Animation").getValBoolean())) return true;
|
||||
if (!AnimationsMod.getSettingBoolean("1.7 Block Animation")) return true;
|
||||
break;
|
||||
case NONE:
|
||||
if (!(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Item Positions").getValBoolean())) return true;
|
||||
if (!AnimationsMod.getSettingBoolean("1.7 Item Positions")) return true;
|
||||
}
|
||||
|
||||
GlStateManager.translate(0.58800083f, 0.36999986f, -0.77000016f);
|
||||
@ -294,7 +268,7 @@ public class AnimationHandler {
|
||||
}
|
||||
|
||||
private void doConsumeAnimation(ItemStack stack, int useCount, float partialTicks) {
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Eating & Drinking Animation").getValBoolean()) {
|
||||
if (AnimationsMod.getSettingBoolean("Consume Animation")) {
|
||||
float useAmount = (float) useCount - partialTicks + 1.0F;
|
||||
float useAmountNorm = 1.0F - useAmount / (float) stack.getMaxItemUseDuration();
|
||||
float useAmountPow = 1.0F - useAmountNorm;
|
||||
@ -303,7 +277,7 @@ public class AnimationHandler {
|
||||
useAmountPow = useAmountPow * useAmountPow * useAmountPow;
|
||||
float useAmountFinal = 1.0F - useAmountPow;
|
||||
GlStateManager.translate(0.0F, MathHelper.abs(MathHelper.cos(useAmount / 4.0F *
|
||||
(float) Math.PI) * 0.1F) * (float) ((double) useAmountNorm > 0.2D ? 1 : 0), 0.0F);
|
||||
(float) Math.PI) * 0.1F) * (float) ((double) useAmountNorm > 0.2D ? 1 : 0), 0.0F);
|
||||
GlStateManager.translate(useAmountFinal * 0.6F, -useAmountFinal * 0.5F, 0.0F);
|
||||
GlStateManager.rotate(useAmountFinal * 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(useAmountFinal * 10.0F, 1.0F, 0.0F, 0.0F);
|
||||
@ -330,8 +304,8 @@ public class AnimationHandler {
|
||||
float swingProgress2 = MathHelper.sin(swingProgress * (float) Math.PI);
|
||||
float swingProgress3 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI);
|
||||
GlStateManager.translate(-swingProgress3 * 0.4F,
|
||||
MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI * 2.0F) * 0.2F,
|
||||
-swingProgress2 * 0.2F);
|
||||
MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI * 2.0F) * 0.2F,
|
||||
-swingProgress2 * 0.2F);
|
||||
}
|
||||
|
||||
private void doEquipAndSwingTransform(float equipProgress, float swingProgress) {
|
||||
@ -367,12 +341,12 @@ public class AnimationHandler {
|
||||
|
||||
if (pullbackNorm > 0.1F) {
|
||||
GlStateManager.translate(0.0F, MathHelper.sin((totalPullback - 0.1F) * 1.3F) * 0.01F
|
||||
* (pullbackNorm - 0.1F), 0.0F);
|
||||
* (pullbackNorm - 0.1F), 0.0F);
|
||||
}
|
||||
|
||||
GlStateManager.translate(0.0F, 0.0F, pullbackNorm * 0.1F);
|
||||
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Bow Pullback").getValBoolean()) {
|
||||
if (AnimationsMod.getSettingBoolean("1.7 Bow Pullback")) {
|
||||
GlStateManager.rotate(-335.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(-50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translate(0.0F, 0.5F, 0.0F);
|
||||
@ -381,7 +355,7 @@ public class AnimationHandler {
|
||||
float zScale = 1.0F + pullbackNorm * 0.2F;
|
||||
GlStateManager.scale(1.0F, 1.0F, zScale);
|
||||
|
||||
if (Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Bow Pullback").getValBoolean()) {
|
||||
if (AnimationsMod.getSettingBoolean("1.7 Bow Pullback")) {
|
||||
GlStateManager.translate(0.0F, -0.5F, 0.0F);
|
||||
GlStateManager.rotate(50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(335.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
@ -4,15 +4,15 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class FishingLineHandler {
|
||||
private static final FishingLineHandler INSTANCE = new FishingLineHandler();
|
||||
private static final FishingLineHandler INSTANCE = new FishingLineHandler();
|
||||
|
||||
public static FishingLineHandler getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
public static FishingLineHandler getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public Vec3 getOffset() {
|
||||
double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
|
||||
double decimalFov = fov / 110;
|
||||
return new Vec3(((-decimalFov + (decimalFov / 2.5)) - (decimalFov / 8)) + 0.16, 0, 0.4D);
|
||||
}
|
||||
public Vec3 getOffset() {
|
||||
double fov = Minecraft.getMinecraft().gameSettings.fovSetting;
|
||||
double decimalFov = fov / 110;
|
||||
return new Vec3(((-decimalFov + (decimalFov / 2.5)) - (decimalFov / 8)) + 0.16, 0, 0.4D);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
package net.silentclient.client.utils.animations;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class OldSneaking {
|
||||
private static long sneak = 0L;
|
||||
private static boolean is = false;
|
||||
|
||||
public static float getCustomEyeHeight(Entity entity)
|
||||
{
|
||||
if (is != entity.isSneaking() || sneak <= 0L)
|
||||
{
|
||||
sneak = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
is = entity.isSneaking();
|
||||
float f = 1.62F;
|
||||
|
||||
if (entity.isSneaking())
|
||||
{
|
||||
int i = (int) (sneak + 8L - System.currentTimeMillis());
|
||||
|
||||
if (i > -50)
|
||||
{
|
||||
f = (float) (f + i * 0.0017D);
|
||||
|
||||
if (f < 0.0F || f > 10.0F)
|
||||
{
|
||||
f = 1.54F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
f = (float) (f - 0.08D);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int j = (int) (sneak + 8L - System.currentTimeMillis());
|
||||
|
||||
if (j > -50)
|
||||
{
|
||||
f = (float) (f - j * 0.0017D);
|
||||
f = (float) (f - 0.08D);
|
||||
|
||||
if (f < 0.0F)
|
||||
{
|
||||
f = 1.62F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
f = f - 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package net.silentclient.client.utils.animations;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
|
||||
public class SneakHandler {
|
||||
private static final float START_HEIGHT = 1.62f;
|
||||
private static final float END_HEIGHT = 1.54f;
|
||||
|
||||
private static final SneakHandler INSTANCE = new SneakHandler();
|
||||
|
||||
private float eyeHeight;
|
||||
private float lastEyeHeight;
|
||||
|
||||
public static SneakHandler getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public float getEyeHeight(float partialTicks) {
|
||||
if (!AnimationsMod.getSettingBoolean("Smooth Sneaking")) {
|
||||
return eyeHeight;
|
||||
}
|
||||
|
||||
return lastEyeHeight + (eyeHeight - lastEyeHeight) * partialTicks;
|
||||
}
|
||||
|
||||
public void onTick() {
|
||||
lastEyeHeight = eyeHeight;
|
||||
|
||||
final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player == null) {
|
||||
eyeHeight = START_HEIGHT;
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isSneaking()) {
|
||||
eyeHeight = END_HEIGHT;
|
||||
} else if (!AnimationsMod.getSettingBoolean("Smooth Sneaking")) {
|
||||
eyeHeight = START_HEIGHT;
|
||||
} else if (eyeHeight < START_HEIGHT) {
|
||||
float delta = START_HEIGHT - eyeHeight;
|
||||
delta *= 0.4;
|
||||
eyeHeight = START_HEIGHT - delta;
|
||||
}
|
||||
}
|
||||
}
|
@ -117,6 +117,7 @@
|
||||
"accessors.NetworkPlayerInfoAccessor",
|
||||
"mixins.MathHelperMixin",
|
||||
"mixins.GuiLanguageMixin",
|
||||
"mixins.RenderArrowMixin"
|
||||
"mixins.RenderArrowMixin",
|
||||
"mixins.RenderFishMixin"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user