diff --git a/build.gradle b/build.gradle index c9a2241..8a82fbd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index aa321c5..deabdd7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G -minecraft_version=1.21.1 -yarn_mappings=1.21.1+build.3 -loader_version=0.16.0 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.9 # Fabric API -fabric_version=0.102.1+1.21.1 +fabric_version=0.107.3+1.21.3 # Mod Properties -mod_version=1.2.1 +mod_version=1.2.2 maven_group=systems.brn archives_base_name=tweaks diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/systems/brn/tweaks/mixin/DontHurtMePearlMixin.java b/src/main/java/systems/brn/tweaks/mixin/DontHurtMePearlMixin.java index 7b4adb4..310916f 100644 --- a/src/main/java/systems/brn/tweaks/mixin/DontHurtMePearlMixin.java +++ b/src/main/java/systems/brn/tweaks/mixin/DontHurtMePearlMixin.java @@ -2,6 +2,8 @@ package systems.brn.tweaks.mixin; import net.minecraft.entity.Entity; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -13,11 +15,9 @@ import static systems.brn.tweaks.Tweaks.Enderpearl_Damage; public class DontHurtMePearlMixin { @Redirect(method = "onCollision(Lnet/minecraft/util/hit/HitResult;)V", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z")) - private boolean redirectDamage(Entity entity, DamageSource source, float amount) { - World world = entity.getWorld(); - entity.damage(source, world.getGameRules().getInt(Enderpearl_Damage)); + at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;damage(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/damage/DamageSource;F)Z")) + private boolean redirectDamage(ServerPlayerEntity entity, ServerWorld world, DamageSource source, float amount) { + entity.damage(world, source, world.getGameRules().getInt(Enderpearl_Damage)); return false; } } diff --git a/src/main/java/systems/brn/tweaks/mixin/JustTeleportAlreadyMixin.java b/src/main/java/systems/brn/tweaks/mixin/JustTeleportAlreadyMixin.java index a710e25..91ab814 100644 --- a/src/main/java/systems/brn/tweaks/mixin/JustTeleportAlreadyMixin.java +++ b/src/main/java/systems/brn/tweaks/mixin/JustTeleportAlreadyMixin.java @@ -1,5 +1,6 @@ package systems.brn.tweaks.mixin; +import net.minecraft.server.world.ServerWorld; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -12,22 +13,28 @@ import static systems.brn.tweaks.Tweaks.Entity_Portal_Cooldown; @Mixin(net.minecraft.entity.Entity.class) public class JustTeleportAlreadyMixin { - @Shadow private World world; + @Shadow + private World world; @Inject(method = "getDefaultPortalCooldown", at = @At(value = "RETURN"), cancellable = true) private void getDefaultPortalCooldown(CallbackInfoReturnable cir) { - cir.setReturnValue(world.getGameRules().getInt(Entity_Portal_Cooldown)); + if (world instanceof ServerWorld sWorld) { + cir.setReturnValue(sWorld.getGameRules().getInt(Entity_Portal_Cooldown)); + } } @Shadow private int portalCooldown; + @Inject(method = "tickPortalCooldown", at = @At(value = "RETURN")) private void tickPortalCooldown(CallbackInfo ci) { - int maxCooldown = world.getGameRules().getInt(Entity_Portal_Cooldown); - if (portalCooldown > maxCooldown) { - portalCooldown = maxCooldown; + if (world instanceof ServerWorld sWorld) { + int maxCooldown = sWorld.getGameRules().getInt(Entity_Portal_Cooldown); + if (portalCooldown > maxCooldown) { + portalCooldown = maxCooldown; + } } } } diff --git a/src/main/resources/assets/icon.png b/src/main/resources/assets/icon.png new file mode 100644 index 0000000..c2ae943 Binary files /dev/null and b/src/main/resources/assets/icon.png differ