Skip to content

Commit

Permalink
back to the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
Poopooracoocoo committed Feb 6, 2024
1 parent 74e4298 commit 7aab303
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
public abstract class LivingEntityMixin extends Entity implements LichRollAccessor, LichAccessor {
private int bsm_lastRevive = 0;
private int bsm_cachedSouls = 0;
@Environment(EnvType.CLIENT)
private int bsm_lastRoll = 100;


Expand Down Expand Up @@ -230,6 +231,28 @@ private void isInSwimmingPose(CallbackInfoReturnable<Boolean> cir) {
}
}

@Inject(method = "swingHand(Lnet/minecraft/util/Hand;)V", at = @At("HEAD"), cancellable = true)
private void swingHand(Hand hand, CallbackInfo ci) {
if (BSMTransformations.isLich(this, true)) {
ci.cancel();
if (getWorld().isClient && bsm_lastRoll >= 20) {
bsm_lastRoll = 0;
}
}
}

@Inject(method = "tickMovement", at = @At("TAIL"))
private void tickMovement(CallbackInfo ci) {
if (getWorld().isClient) {
bsm_lastRoll++;
}
}

@Override
public int getLastRollTicks() {
return bsm_lastRoll;
}

@Override
public int getCachedSouls() {
return bsm_cachedSouls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,19 @@
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3d;
import org.joml.Vector3f;
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.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@SuppressWarnings("ConstantConditions")
@Mixin(value = LivingEntity.class, priority = 999)
public abstract class LivingEntityMixin extends Entity implements LichRollAccessor, LichAccessor {
private int bsm_lastRevive = 0;
private int bsm_cachedSouls = 0;
private int bsm_lastRoll = 100;
}
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

@Mixin(LivingEntityRenderer.class)
public abstract class LivingEntityRendererMixin extends EntityRenderer {
Expand Down Expand Up @@ -60,25 +54,3 @@ private void ghostify(Args args, LivingEntity entity, float f, float g, MatrixSt
}
}
}

@Inject(method = "swingHand(Lnet/minecraft/util/Hand;)V", at = @At("HEAD"), cancellable = true)
private void swingHand(Hand hand, CallbackInfo ci) {
if (BSMTransformations.isLich(this, true)) {
ci.cancel();
if (getWorld().isClient && bsm_lastRoll >= 20) {
bsm_lastRoll = 0;
}
}
}

@Inject(method = "tickMovement", at = @At("TAIL"))
private void tickMovement(CallbackInfo ci) {
if (getWorld().isClient) {
bsm_lastRoll++;
}
}

@Override
public int getLastRollTicks() {
return bsm_lastRoll;
}

0 comments on commit 7aab303

Please sign in to comment.