more stuff #1
@@ -6,9 +6,9 @@ import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
|
|||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
|
|
||||||
public class Tweaks implements ModInitializer {
|
public class Tweaks implements ModInitializer {
|
||||||
public static final GameRules.Key<GameRules.IntRule> Entity_Portal_Cooldown =
|
public static final GameRules.Key<GameRules.IntRule> ENTITY_PORTAL_COOLDOWN =
|
||||||
GameRuleRegistry.register("entityPortalCooldown", GameRules.Category.MOBS, GameRuleFactory.createIntRule(300));
|
GameRuleRegistry.register("entityPortalCooldown", GameRules.Category.MOBS, GameRuleFactory.createIntRule(300));
|
||||||
public static final GameRules.Key<GameRules.IntRule> Enderpearl_Damage =
|
public static final GameRules.Key<GameRules.IntRule> ENDER_PEARL_DAMAGE =
|
||||||
GameRuleRegistry.register("enderPearlDamage", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(5));
|
GameRuleRegistry.register("enderPearlDamage", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(5));
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
import static systems.brn.tweaks.Tweaks.Enderpearl_Damage;
|
import static systems.brn.tweaks.Tweaks.ENDER_PEARL_DAMAGE;
|
||||||
|
|
||||||
@Mixin(net.minecraft.entity.projectile.thrown.EnderPearlEntity.class)
|
@Mixin(net.minecraft.entity.projectile.thrown.EnderPearlEntity.class)
|
||||||
public class DontHurtMePearlMixin {
|
public class DontHurtMePearlMixin {
|
||||||
@@ -15,7 +15,7 @@ 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", target = "Lnet/minecraft/server/network/ServerPlayerEntity;damage(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/entity/damage/DamageSource;F)Z"))
|
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) {
|
private boolean redirectDamage(ServerPlayerEntity entity, ServerWorld world, DamageSource source, float amount) {
|
||||||
entity.damage(world, source, world.getGameRules().getInt(Enderpearl_Damage));
|
entity.damage(world, source, world.getGameRules().getInt(ENDER_PEARL_DAMAGE));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import static systems.brn.tweaks.Tweaks.Entity_Portal_Cooldown;
|
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 {
|
||||||
@@ -21,7 +21,7 @@ public class JustTeleportAlreadyMixin {
|
|||||||
cancellable = true)
|
cancellable = true)
|
||||||
private void getDefaultPortalCooldown(CallbackInfoReturnable<Integer> cir) {
|
private void getDefaultPortalCooldown(CallbackInfoReturnable<Integer> cir) {
|
||||||
if (world instanceof ServerWorld sWorld) {
|
if (world instanceof ServerWorld sWorld) {
|
||||||
cir.setReturnValue(sWorld.getGameRules().getInt(Entity_Portal_Cooldown));
|
cir.setReturnValue(sWorld.getGameRules().getInt(ENTITY_PORTAL_COOLDOWN));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class JustTeleportAlreadyMixin {
|
|||||||
@Inject(method = "tickPortalCooldown", at = @At(value = "RETURN"))
|
@Inject(method = "tickPortalCooldown", at = @At(value = "RETURN"))
|
||||||
private void tickPortalCooldown(CallbackInfo ci) {
|
private void tickPortalCooldown(CallbackInfo ci) {
|
||||||
if (world instanceof ServerWorld sWorld) {
|
if (world instanceof ServerWorld sWorld) {
|
||||||
int maxCooldown = sWorld.getGameRules().getInt(Entity_Portal_Cooldown);
|
int maxCooldown = sWorld.getGameRules().getInt(ENTITY_PORTAL_COOLDOWN);
|
||||||
if (portalCooldown > maxCooldown) {
|
if (portalCooldown > maxCooldown) {
|
||||||
portalCooldown = maxCooldown;
|
portalCooldown = maxCooldown;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user