diff --git a/build.gradle b/build.gradle index 7cf8350..4506b9f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,10 @@ plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.12-SNAPSHOT' + id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name group = project.maven_group @@ -20,13 +21,10 @@ dependencies { } processResources { - inputs.property "vars", project.version - from(sourceSets.main.resources.srcDirs) { - include '**/fabric.mod.json' - expand 'version':project.version - } - from(sourceSets.main.resources.srcDirs) { - exclude '**/fabric.mod.json' + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version } } diff --git a/gradle.properties b/gradle.properties index 28d7577..8501135 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=1.16.1 -yarn_mappings=1.16.1+build.1 -loader_version=0.8.8+build.202 +minecraft_version=1.18.2 +yarn_mappings=1.18.2+build.3 +loader_version=0.14.6 # Mod Properties maven_group = squeek.quakemovement @@ -13,4 +13,4 @@ archives_base_name = squake # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api -fabric_version=0.13.1+build.370-1.16 \ No newline at end of file +fabric_version=0.53.0+1.18.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 622ab64..856da69 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/java/squeek/quakemovement/ModQuakeMovement.java b/java/squeek/quakemovement/ModQuakeMovement.java index aeadd27..3a36b94 100644 --- a/java/squeek/quakemovement/ModQuakeMovement.java +++ b/java/squeek/quakemovement/ModQuakeMovement.java @@ -25,7 +25,7 @@ public class ModQuakeMovement implements ModInitializer PlayerEntity player = mc.player; double deltaX = player.getX() - player.prevX; double deltaZ = player.getZ() - player.prevZ; - double speed = MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ); + double speed = MathHelper.sqrt((float)(deltaX * deltaX + deltaZ * deltaZ)); String speedString = String.format("%.02f", speed); mc.textRenderer.drawWithShadow(matrixStack, speedString, 10, mc.getWindow().getScaledHeight() - mc.textRenderer.fontHeight - 10, 0xFFDDDDDD); } diff --git a/java/squeek/quakemovement/QuakeClientPlayer.java b/java/squeek/quakemovement/QuakeClientPlayer.java index 18652ae..ae89b0b 100644 --- a/java/squeek/quakemovement/QuakeClientPlayer.java +++ b/java/squeek/quakemovement/QuakeClientPlayer.java @@ -1,6 +1,5 @@ package squeek.quakemovement; -import com.sun.istack.internal.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; @@ -15,6 +14,7 @@ import net.minecraft.particle.BlockStateParticleEffect; import net.minecraft.particle.ParticleTypes; import net.minecraft.tag.FluidTags; import net.minecraft.tag.Tag; +import net.minecraft.tag.TagKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; @@ -43,7 +43,7 @@ public class QuakeClientPlayer double d1 = player.getY(); double d2 = player.getZ(); - if ((player.abilities.flying || player.isFallFlying()) && !player.hasVehicle()) + if ((player.getAbilities().flying || player.isFallFlying()) && !player.hasVehicle()) return false; else didQuakeMovement = quake_travel(player, movementInput); @@ -76,7 +76,7 @@ public class QuakeClientPlayer public static boolean isInWater(PlayerEntity player) { FluidState fluidState = player.world.getFluidState(player.getBlockPos()); - return player.isTouchingWater() && player.method_29920() && !player.canWalkOnFluid(fluidState.getFluid()); + return player.isTouchingWater() && player.shouldSwimInFluids() && !player.canWalkOnFluid(fluidState); } public static boolean updateVelocityPlayer(PlayerEntity player, Vec3d movementInput, float movementSpeed) @@ -87,7 +87,7 @@ public class QuakeClientPlayer if (!ModConfig.ENABLED) return false; - if ((player.abilities.flying && !player.hasVehicle()) || isInWater(player) || player.isInLava() || !player.abilities.flying) + if ((player.getAbilities().flying && !player.hasVehicle()) || isInWater(player) || player.isInLava() || !player.getAbilities().flying) { return false; } @@ -113,7 +113,7 @@ public class QuakeClientPlayer // undo this dumb thing if (player.isSprinting()) { - float f = player.yaw * 0.017453292F; + float f = player.getYaw() * 0.017453292F; Vec3d deltaVelocity = new Vec3d(MathHelper.sin(f) * 0.2F, 0, -(MathHelper.cos(f) * 0.2F)); player.setVelocity(player.getVelocity().add(deltaVelocity)); } @@ -129,7 +129,7 @@ public class QuakeClientPlayer private static double getSpeed(PlayerEntity player) { Vec3d velocity = player.getVelocity(); - return MathHelper.sqrt(velocity.x * velocity.x + velocity.z * velocity.z); + return MathHelper.sqrt((float) (velocity.x * velocity.x + velocity.z * velocity.z)); } /// Assumes the player is on the ground @@ -178,7 +178,7 @@ public class QuakeClientPlayer if (f3 >= 1.0E-4F) { - f3 = MathHelper.sqrt(f3); + f3 = MathHelper.sqrt((float) f3); if (f3 < 1.0F) { @@ -188,8 +188,8 @@ public class QuakeClientPlayer f3 = 1.0F / f3; sidemove *= f3; forwardmove *= f3; - double f4 = MathHelper.sin(player.yaw * (float) Math.PI / 180.0F); - double f5 = MathHelper.cos(player.yaw * (float) Math.PI / 180.0F); + double f4 = MathHelper.sin(player.getYaw() * (float) Math.PI / 180.0F); + double f5 = MathHelper.cos(player.getYaw() * (float) Math.PI / 180.0F); dir[0] = (sidemove * f5 - forwardmove * f4); dir[1] = (forwardmove * f5 + sidemove * f4); } @@ -287,7 +287,7 @@ public class QuakeClientPlayer private static void minecraft_SwingLimbsBasedOnMovement(PlayerEntity player) { // this got extracted out in the Minecraft code, so just use that - player.method_29242(player, false); + player.updateLimbs(player, false); } private static void minecraft_WaterMove(PlayerEntity player, Vec3d movementInput) @@ -361,7 +361,7 @@ public class QuakeClientPlayer return false; } // take care of lava movement using default code - else if ((player.isInLava() && !player.abilities.flying)) + else if ((player.isInLava() && !player.getAbilities().flying)) { return false; } @@ -446,7 +446,7 @@ public class QuakeClientPlayer } // copied from WorldView.containsFluid but with the ability to specify the fluid - static private boolean containsFluid(WorldView world, Box box, Tag tag) { + static private boolean containsFluid(WorldView world, Box box, TagKey tag) { int i = MathHelper.floor(box.minX); int j = MathHelper.ceil(box.maxX); int k = MathHelper.floor(box.minY); diff --git a/java/squeek/quakemovement/mixin/PlayerEntityMixin.java b/java/squeek/quakemovement/mixin/PlayerEntityMixin.java index f35c660..f5c52c9 100644 --- a/java/squeek/quakemovement/mixin/PlayerEntityMixin.java +++ b/java/squeek/quakemovement/mixin/PlayerEntityMixin.java @@ -1,5 +1,6 @@ package squeek.quakemovement.mixin; +import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; @@ -14,7 +15,7 @@ import squeek.quakemovement.QuakeServerPlayer; @Mixin(PlayerEntity.class) public abstract class PlayerEntityMixin { - @Inject(at = @At("HEAD"), method = "travel(Lnet/minecraft/util/math/Vec3d;)V", cancellable = true) + @Inject(at = @At("HEAD"), method = "travel", cancellable = true) private void travel(Vec3d movementInput, CallbackInfo info) { if (!ModConfig.ENABLED) @@ -37,13 +38,13 @@ public abstract class PlayerEntityMixin } @Inject(at = @At("HEAD"), method = "handleFallDamage") - private void beforeFall(float fallDistance, float damageMultiplier, CallbackInfoReturnable info) + private void beforeFall(float fallDistance, float damageMultiplier, DamageSource damageSource, CallbackInfoReturnable cir) { QuakeServerPlayer.beforeFall((PlayerEntity) (Object) this, fallDistance, damageMultiplier); } @Inject(at = @At("TAIL"), method = "handleFallDamage") - private void afterFall(float fallDistance, float damageMultiplier, CallbackInfoReturnable info) + private void afterFall(float fallDistance, float damageMultiplier, DamageSource damageSource, CallbackInfoReturnable cir) { QuakeServerPlayer.afterFall((PlayerEntity) (Object) this, fallDistance, damageMultiplier); } diff --git a/settings.gradle b/settings.gradle index 683b201..5b60df3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,7 +3,7 @@ pluginManagement { jcenter() maven { name = 'Fabric' - url = 'http://maven.fabricmc.net/' + url = 'https://maven.fabricmc.net/' } gradlePluginPortal() }