Skip to content

Commit

Permalink
Updated FTB Chunks Mixin to new API
Browse files Browse the repository at this point in the history
  • Loading branch information
TechTastic committed Dec 28, 2024
1 parent 8c3b47c commit 2950f73
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import org.joml.Vector3d;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.valkyrienskies.core.api.ships.Ship;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import org.valkyrienskies.mod.api.ValkyrienSkies;
import org.valkyrienskies.mod.common.config.VSGameConfig;
import org.valkyrienskies.mod.common.util.VectorConversionsMCKt;

@Pseudo
@Mixin(ClaimedChunkManager.class)
Expand Down Expand Up @@ -42,13 +41,13 @@ public abstract class MixinClaimedChunkManager {

final Level level = entity.level;

final Ship ship = VSGameUtilsKt.getShipManagingPos(level, pos);
final Ship ship = ValkyrienSkies.getShipManagingBlock(level, pos);
if (ship == null) {
return pos;
}

final Vector3d vec = ship.getShipToWorld().transformPosition(VectorConversionsMCKt.toJOMLD(pos));
final BlockPos newPos = new BlockPos(VectorConversionsMCKt.toMinecraft(vec));
final Vec3 vec = ValkyrienSkies.positionToWorld(ship, Vec3.atCenterOf(pos));
final BlockPos newPos = new BlockPos(vec);

if ((newPos.getY() > level.getMaxBuildHeight() || newPos.getY() < level.getMinBuildHeight()) &&
!VSGameConfig.SERVER.getFTBChunks().getShipsProtectionOutOfBuildHeight()) {
Expand Down

0 comments on commit 2950f73

Please sign in to comment.