Skip to content

Commit

Permalink
Updated FTB Chunks Mixin to new API and cleaned it up (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechTastic authored Dec 29, 2024
1 parent 1f552f9 commit 63c80e4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ subprojects {
maven { url = "https://maven.cafeteria.dev/releases" } // Fake Player API
maven { url = "https://maven.jamieswhiteshirt.com/libs-release" } // Reach Entity Attributes
maven { url = "https://jitpack.io"}
maven { // FTB Stuffs
url "https://maven.saps.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}
maven { // FTB Stuffs
url "https://maven.saps.dev/snapshots"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}
}
maven {
name = "Valkyrien Skies Internal"
Expand Down
5 changes: 1 addition & 4 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

dependencies {
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0"))

Expand Down Expand Up @@ -30,9 +29,7 @@ dependencies {
}

// FTB Stuffs
modCompileOnly("curse.maven:ftb-util-404465:4210935")
modCompileOnly("curse.maven:ftb-teams-404468:4229138")
modCompileOnly("curse.maven:ftb-chunks-314906:4229120")
modCompileOnly("dev.ftb.mods:ftb-chunks:2001.3.4") { transitive = false }

// EMF compat
modCompileOnly("curse.maven:entity-model-features-844662:5696901")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.valkyrienskies.mod.mixin.mod_compat.ftb_chunks;

/*
import dev.ftb.mods.ftbchunks.data.ClaimedChunkManager;
import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
Expand All @@ -13,24 +13,24 @@
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)
public abstract class MixinClaimedChunkManager {
@Mixin(ClaimedChunkManagerImpl.class)
public abstract class MixinClaimedChunkManagerImpl {
@Unique
private Entity entity = null;

@ModifyVariable(method = "protect", at = @At("HEAD"), name = "entity", remap = false)
@ModifyVariable(method = "shouldPreventInteraction", at = @At("HEAD"), name = "entity", remap = false)
private Entity ValkyrienSkies$entity(final Entity entity) {
this.entity = entity;
return entity;
}

@ModifyArg(
method = "protect",
method = "shouldPreventInteraction",
at = @At(
value = "INVOKE",
target = "Ldev/ftb/mods/ftblibrary/math/ChunkDimPos;<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"
Expand All @@ -43,22 +43,19 @@ 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(new Vector3d(pos.getX(), pos.getY(), pos.getZ()));
final Vector3d vec = ship.getShipToWorld().transformPosition(VectorConversionsMCKt.toJOML(Vec3.atCenterOf(pos)));
final BlockPos newPos = BlockPos.containing(VectorConversionsMCKt.toMinecraft(vec));

if (
(newPos.getY() > level.getMaxBuildHeight() || newPos.getY() < level.getMinBuildHeight()) &&
!VSGameConfig.SERVER.getFTBChunks().getShipsProtectionOutOfBuildHeight()
) {
if ((newPos.getY() > level.getMaxBuildHeight() || newPos.getY() < level.getMinBuildHeight()) &&
!VSGameConfig.SERVER.getFTBChunks().getShipsProtectionOutOfBuildHeight()) {
return pos;
}

return newPos;
}
}
*/
3 changes: 2 additions & 1 deletion common/src/main/resources/valkyrienskies-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"mod_compat.create.pr.MixinSeatBlock",
"mod_compat.create_big_cannons.MixinPitchOrientedContraptionEntity",
"mod_compat.create_utilities.MixinVoidLinkBehaviour",
"mod_compat.ftb_chunks.MixinClaimedChunkManagerImpl",
"mod_compat.immersive_portals.MixinIpNewChunkTrackingGraph",
"mod_compat.reachentityattributes.MixinReachEntityAttributes",
"server.MinecraftServerAccessor",
Expand Down Expand Up @@ -127,7 +128,6 @@
"client.gui.screens.MixinConnectScreen",
"client.multiplayer.MixinClientPacketListener",
"client.player.MixinLocalPlayer",
"feature.huge_bounding_box_fix.MixinPlayer",
"client.renderer.MixinGameRenderer",
"client.renderer.MixinLevelRenderer",
"client.world.MixinClientChunkCache",
Expand All @@ -137,6 +137,7 @@
"feature.fix_render_chunk_sorting.MixinRenderChunk",
"feature.fluid_camera_fix.MixinCamera",
"feature.hit_outline.MixinLevelRenderer",
"feature.huge_bounding_box_fix.MixinPlayer",
"feature.render_blockentity_distance_check.MixinBlockEntityRenderDispatcher",
"feature.render_leashes.MixinMobRenderer",
"feature.render_pathfinding.MixinDebugRenderer",
Expand Down

0 comments on commit 63c80e4

Please sign in to comment.