Skip to content

Commit

Permalink
Update dependencies (#34)
Browse files Browse the repository at this point in the history
* Update dependencies

* update loom

* resolve changes in mappings and related vanilla code

* update workflow file for java 21
  • Loading branch information
LucunJi authored Jun 15, 2024
1 parent 66fc92b commit 02a0c43
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'automated/**'

env:
JAVA_VERSION: 17 # must be the same as the version used in build.gradle
JAVA_VERSION: 21 # must be the same as the version used in build.gradle
jobs:
build-release:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import groovy.json.JsonSlurper

plugins {
id('fabric-loom').version('1.5-SNAPSHOT')
id('fabric-loom').version('1.6-SNAPSHOT')
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

ext.configFile = file "build.properties"

Expand Down Expand Up @@ -45,7 +45,7 @@ tasks.withType(JavaCompile) {
options.encoding = "UTF-8"

// Minecraft 1.18 upwards uses Java 17.
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.7
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.3
loader_version=0.15.11
# Mod Properties
maven_group=github.io.lucunji
# Dependencies
# Fabric api
fabric_version=0.96.11+1.20.4
fabric_version=0.100.0+1.20.6
# malilib
malilib_minecraft_version=1.20.4
malilib_version=0.18.1
malilib_minecraft_version=1.20.6
malilib_version=0.19.0
# mod menu
mod_menu_version=9.0.0
mod_menu_version=9.2.0-beta.2
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class PlayerHUDRenderer implements IRenderer {
new DataBackupEntry<LivingEntity, Float>(e -> ((LivingEntityMixin) e).getLeaningPitch(), (e, pitch) -> ((LivingEntityMixin) e).setLeaningPitch(pitch)),
new DataBackupEntry<LivingEntity, Float>(e -> ((LivingEntityMixin) e).getLastLeaningPitch(), (e, pitch) -> ((LivingEntityMixin) e).setLastLeaningPitch(pitch)),
new DataBackupEntry<LivingEntity, Boolean>(LivingEntity::isFallFlying, (e, flag) -> ((EntityMixin) e).callSetFlag(7, flag)),
new DataBackupEntry<LivingEntity, Integer>(LivingEntity::getRoll, (e, roll) -> ((LivingEntityMixin) e).setRoll(roll)),
new DataBackupEntry<LivingEntity, Integer>(LivingEntity::getFallFlyingTicks, (e, ticks) -> ((LivingEntityMixin) e).setFallFlyingTicks(ticks)),
new DataBackupEntry<LivingEntity, Entity>(LivingEntity::getVehicle, (e, vehicle) -> ((EntityMixin) e).setVehicle(vehicle)),

new DataBackupEntry<LivingEntity, Float>(e -> e.prevBodyYaw, (e, yaw) -> e.prevBodyYaw = yaw),
Expand Down Expand Up @@ -196,7 +196,7 @@ private void transformEntity(LivingEntity targetEntity, float partialTicks, bool
((LivingEntityMixin) targetEntity).setLastLeaningPitch(0);

((EntityMixin) targetEntity).callSetFlag(7, false);
((LivingEntityMixin) targetEntity).setRoll(0);
((LivingEntityMixin) targetEntity).setFallFlyingTicks(0);
}

float headLerp = MathHelper.lerp(partialTicks, targetEntity.prevHeadYaw, targetEntity.headYaw);
Expand Down Expand Up @@ -238,11 +238,12 @@ private void performRendering(Entity targetEntity, double posX, double posY, dou

EntityRenderDispatcher entityRenderDispatcher = client.getEntityRenderDispatcher();

MatrixStack matrixStack1 = RenderSystem.getModelViewStack();
matrixStack1.push();
matrixStack1.translate(0, 0, 550.0D);

Matrix4fStack matrixStack1 = RenderSystem.getModelViewStack();
matrixStack1.pushMatrix();
matrixStack1.translate(0, 0, 550.0f);
matrixStack1.scale(mirror ? -1 : 1, 1, -1);
matrixStack1.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) lightDegree));
matrixStack1.rotate(RotationAxis.POSITIVE_Y.rotationDegrees((float) lightDegree));

RenderSystem.applyModelViewMatrix();

Expand Down Expand Up @@ -290,7 +291,7 @@ else if (targetEntity instanceof MinecartEntity)
entityRenderDispatcher.setRenderShadows(true);
entityRenderDispatcher.setRenderHitboxes(renderHitbox);

matrixStack1.pop();
matrixStack1.popMatrix();
RenderSystem.applyModelViewMatrix();
DiffuseLighting.enableGuiDepthLighting();
}
Expand All @@ -309,7 +310,7 @@ private static int getLight(Entity entity, float tickDelta) {
}

private static float getFallFlyingLeaning(LivingEntity entity, float partialTicks) {
float ticks = partialTicks + entity.getRoll();
float ticks = partialTicks + entity.getFallFlyingTicks();
return MathHelper.clamp(ticks * ticks / 100f, 0f, 1f);
}

Expand All @@ -326,13 +327,14 @@ private static float wrapDegree180(float x) {
* Compute offset of vehicle relative to rider.
*/
private static Vector3f getVehicleOffset(Entity rider, Entity vehicle) {
Vector3f ret;
if (vehicle instanceof LivingEntity) {
// FIXME: glitches when the vehicle is a horse
ret = ((EntityMixin) vehicle).callGetPassengerAttachmentPos(rider, vehicle.getDimensions(vehicle.getPose()), ((LivingEntityMixin) vehicle).callGetScaleFactor());
} else {
ret = ((EntityMixin) vehicle).callGetPassengerAttachmentPos(rider, ((EntityMixin) vehicle).getDimensions(), 1f);
}
return ret.add(0, rider.getRidingOffset(vehicle), 0).mul(1, -1, 1);
return vehicle.getPassengerRidingPos(rider).subtract(vehicle.getPos()).toVector3f();
// Vector3f ret;
// if (vehicle instanceof LivingEntity) {
// // FIXME: glitches when the vehicle is a horse
// ret = ((EntityMixin) vehicle).callGetPassengerAttachmentPos(rider, vehicle.getDimensions(vehicle.getPose()), ((LivingEntityMixin) vehicle).callGetScaleFactor());
// } else {
// ret = ((EntityMixin) vehicle).callGetPassengerAttachmentPos(rider, ((EntityMixin) vehicle).getDimensions(), 1f);
// }
// return ret.add(0, rider.getRidingOffset(vehicle), 0).mul(1, -1, 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public interface EntityMixin {
@Accessor
void setVehicle(Entity vehicle);

@Invoker
Vector3f callGetPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor);
// @Invoker
// Vector3f callGetPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor);

@Accessor
EntityDimensions getDimensions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface LivingEntityMixin {
void setLastLeaningPitch(float lastLeaningPitch);

@Accessor
void setRoll(int roll);
void setFallFlyingTicks(int fallFlyingTicks);

@Invoker
float callGetScaleFactor();
Expand Down

0 comments on commit 02a0c43

Please sign in to comment.