From 5fd6ba3f72ff4e8fa5c1cfa73c9f5290f97c060e Mon Sep 17 00:00:00 2001 From: LunaFox Date: Thu, 28 Aug 2025 17:07:49 -0300 Subject: [PATCH 1/3] feat: Aggressive world borders --- .../mixin/entity_ticking/MixinLivingEntity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java index 262556c..3369f05 100644 --- a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java +++ b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java @@ -43,4 +43,11 @@ public MixinLivingEntity(EntityType type, World world) { public void setNoMovement(boolean noMovement) { this.fireblanket$movementless = noMovement; } + + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/border/WorldBorder;getDamagePerBlock()D"), method = "baseTick") + private void doNotLeaveTheWorldBorderPlease(CallbackInfo ci, @Local ServerWorld serverWorld) { + this.kill(serverWorld); + this.setVelocity(Vec3d.ZERO); + this.scheduleVelocityUpdate(); + } } From c455a85d08a12d4354ef3594aa9b50b6e8305041 Mon Sep 17 00:00:00 2001 From: LunaFox Date: Thu, 28 Aug 2025 17:08:13 -0300 Subject: [PATCH 2/3] feat: Aggressive world borders --- .../entity_ticking/MixinLivingEntity.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java index 3369f05..b37623a 100644 --- a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java +++ b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java @@ -1,14 +1,19 @@ package net.modfest.fireblanket.mixin.entity_ticking; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.server.world.ServerWorld; import net.minecraft.storage.ReadView; import net.minecraft.storage.WriteView; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +import net.minecraft.world.border.WorldBorder; import net.modfest.fireblanket.mixinsupport.ImmmovableLivingEntity; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; @@ -16,6 +21,9 @@ @Mixin(LivingEntity.class) public abstract class MixinLivingEntity extends Entity implements ImmmovableLivingEntity { + @Shadow + public abstract void kill(ServerWorld world); + private boolean fireblanket$movementless = false; public MixinLivingEntity(EntityType type, World world) { @@ -50,4 +58,18 @@ private void doNotLeaveTheWorldBorderPlease(CallbackInfo ci, @Local ServerWorld this.setVelocity(Vec3d.ZERO); this.scheduleVelocityUpdate(); } + + @Inject(at = @At("RETURN"), method = "tick") + private void doNotGoTooFarPlease(CallbackInfo ci) { + WorldBorder border = getWorld().getWorldBorder(); + double maxOutOfBoundsDistance = 64; + + int topY = getWorld().getHeight() - getWorld().getBottomY(); + double x = MathHelper.clamp(this.getX(), border.getBoundWest() - maxOutOfBoundsDistance, border.getBoundEast() + maxOutOfBoundsDistance); + double y = MathHelper.clamp(this.getY(), getWorld().getBottomY() - maxOutOfBoundsDistance, topY + maxOutOfBoundsDistance * 2); + double z = MathHelper.clamp(this.getZ(), border.getBoundNorth() - maxOutOfBoundsDistance, border.getBoundSouth() + maxOutOfBoundsDistance); + if (x != this.getX() || y != this.getY() || z != this.getZ()) { + this.setPosition(x, y, z); + } + } } From 59c8c445049a5bb6281c91496521ef09cb3d7a17 Mon Sep 17 00:00:00 2001 From: LunaFox Date: Thu, 28 Aug 2025 17:09:05 -0300 Subject: [PATCH 3/3] chore: Increase max height --- .../fireblanket/mixin/entity_ticking/MixinLivingEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java index b37623a..da79961 100644 --- a/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java +++ b/src/main/java/net/modfest/fireblanket/mixin/entity_ticking/MixinLivingEntity.java @@ -66,7 +66,7 @@ private void doNotGoTooFarPlease(CallbackInfo ci) { int topY = getWorld().getHeight() - getWorld().getBottomY(); double x = MathHelper.clamp(this.getX(), border.getBoundWest() - maxOutOfBoundsDistance, border.getBoundEast() + maxOutOfBoundsDistance); - double y = MathHelper.clamp(this.getY(), getWorld().getBottomY() - maxOutOfBoundsDistance, topY + maxOutOfBoundsDistance * 2); + double y = MathHelper.clamp(this.getY(), getWorld().getBottomY() - maxOutOfBoundsDistance, topY + maxOutOfBoundsDistance * 100); double z = MathHelper.clamp(this.getZ(), border.getBoundNorth() - maxOutOfBoundsDistance, border.getBoundSouth() + maxOutOfBoundsDistance); if (x != this.getX() || y != this.getY() || z != this.getZ()) { this.setPosition(x, y, z);