This commit is contained in:
Bruno Rybársky 2024-11-10 10:13:00 +01:00
parent 266fc99632
commit b572270dd6
No known key found for this signature in database
GPG Key ID: 6C9206A821C70598
6 changed files with 24 additions and 17 deletions

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.6-SNAPSHOT' id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

@ -1,12 +1,12 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
minecraft_version=1.21.1 minecraft_version=1.21.3
yarn_mappings=1.21.1+build.3 yarn_mappings=1.21.3+build.2
loader_version=0.16.0 loader_version=0.16.9
# Fabric API # Fabric API
fabric_version=0.102.1+1.21.1 fabric_version=0.107.3+1.21.3
# Mod Properties # Mod Properties
mod_version=1.2.1 mod_version=1.2.2
maven_group=systems.brn maven_group=systems.brn
archives_base_name=tweaks archives_base_name=tweaks

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

@ -2,6 +2,8 @@ package systems.brn.tweaks.mixin;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@ -13,11 +15,9 @@ import static systems.brn.tweaks.Tweaks.Enderpearl_Damage;
public class DontHurtMePearlMixin { public class DontHurtMePearlMixin {
@Redirect(method = "onCollision(Lnet/minecraft/util/hit/HitResult;)V", @Redirect(method = "onCollision(Lnet/minecraft/util/hit/HitResult;)V",
at = @At(value = "INVOKE", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;damage(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/damage/DamageSource;F)Z"))
target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z")) private boolean redirectDamage(ServerPlayerEntity entity, ServerWorld world, DamageSource source, float amount) {
private boolean redirectDamage(Entity entity, DamageSource source, float amount) { entity.damage(world, source, world.getGameRules().getInt(Enderpearl_Damage));
World world = entity.getWorld();
entity.damage(source, world.getGameRules().getInt(Enderpearl_Damage));
return false; return false;
} }
} }

@ -1,5 +1,6 @@
package systems.brn.tweaks.mixin; package systems.brn.tweaks.mixin;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; 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) @Mixin(net.minecraft.entity.Entity.class)
public class JustTeleportAlreadyMixin { public class JustTeleportAlreadyMixin {
@Shadow private World world; @Shadow
private World world;
@Inject(method = "getDefaultPortalCooldown", @Inject(method = "getDefaultPortalCooldown",
at = @At(value = "RETURN"), at = @At(value = "RETURN"),
cancellable = true) cancellable = true)
private void getDefaultPortalCooldown(CallbackInfoReturnable<Integer> cir) { private void getDefaultPortalCooldown(CallbackInfoReturnable<Integer> cir) {
cir.setReturnValue(world.getGameRules().getInt(Entity_Portal_Cooldown)); if (world instanceof ServerWorld sWorld) {
cir.setReturnValue(sWorld.getGameRules().getInt(Entity_Portal_Cooldown));
}
} }
@Shadow @Shadow
private int portalCooldown; private int portalCooldown;
@Inject(method = "tickPortalCooldown", at = @At(value = "RETURN")) @Inject(method = "tickPortalCooldown", at = @At(value = "RETURN"))
private void tickPortalCooldown(CallbackInfo ci) { private void tickPortalCooldown(CallbackInfo ci) {
int maxCooldown = world.getGameRules().getInt(Entity_Portal_Cooldown); if (world instanceof ServerWorld sWorld) {
int maxCooldown = sWorld.getGameRules().getInt(Entity_Portal_Cooldown);
if (portalCooldown > maxCooldown) { if (portalCooldown > maxCooldown) {
portalCooldown = maxCooldown; portalCooldown = maxCooldown;
} }
} }
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB