From b572270dd677d3dcb0ed9f6ce3b6c2c7986e5cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sun, 10 Nov 2024 10:13:00 +0100 Subject: [PATCH] Update --- build.gradle | 2 +- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../brn/tweaks/mixin/DontHurtMePearlMixin.java | 10 +++++----- .../tweaks/mixin/JustTeleportAlreadyMixin.java | 17 ++++++++++++----- src/main/resources/assets/icon.png | Bin 0 -> 1057 bytes 6 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 src/main/resources/assets/icon.png 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 0000000000000000000000000000000000000000..c2ae943ea2fccd29f1ba8db67c43e72604a43dbc GIT binary patch literal 1057 zcmV++1m63JP)EX>4Tx04R}tkv&MmKpe$iQ>8^)MC>5qkfA!Yi;6gwDi*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RR0!X5l)%?&0C9%C|}66 zS>e3JS*_Mt=brq9fr7S@;X2K6B(Q`eQV=1djtZ)<5T#Wk#YCF+<1YR&$DbmXOs)zT zITlcZ3d!+<|H1EW&EoV_J1Gzc`d@7OV*>E)0jdyV16NwtUuyz$pQJas zTKEVU+6FGJyPCWQTMOB02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00H?)L_t(o!_`;4YQr!PJ{dzHLoqay7Sq|IpP+-^p^un% z@Q^3Sm^ozeltSnb=yYAA@acRf+aYb!gFr0l?z?}Ti2gZo_}xs!T%e||SOM4mQ#i|a zw^S&>O^)&W>$f~EYC0k`}Hbe8cr9f$cQiO zxmh0QT2Dko{ccFCLf{A**Ayi*ISFQIgoTkwT8&B}Ufv<&1G7`SyK|Y zK9N=A7>3gYy|84&VzgeiU-K?#>MACoGeW^jz-4Cy`HyoQTMBU3`q=}C1}q1az~iQp zFmZEalrfY*a!k`kGAo%McPLf%dC6Fw;dP6fiSgJ_A11~lX3@hW*Hlc87<-O>nC|`t b{B`;Us?kG*0y}KH00000NkvXXu0mjftZLjw literal 0 HcmV?d00001