Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward-Porting 1.18.2 changes #1048

Draft
wants to merge 51 commits into
base: 1.20.1/api
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e3ba177
Fixed ValkyrienSkiesModForge.loadComplete()
StewStrong Oct 28, 2024
e25ee15
Update VSCore
ThePlasticPotato Nov 26, 2024
635678a
Update VSCore... again.
ThePlasticPotato Nov 28, 2024
9535492
Fixed assembly issue
ThePlasticPotato Dec 1, 2024
2521e60
return to pre-existing value
ThePlasticPotato Dec 1, 2024
5ba3fe5
Update to latest create and update mixinextras on fabric
ThePlasticPotato Dec 2, 2024
11206d9
Also update porting lib so that vs2 maven actually takes it
ThePlasticPotato Dec 2, 2024
e2495ca
...and on common
ThePlasticPotato Dec 2, 2024
f590481
porting lib please
ThePlasticPotato Dec 2, 2024
fef8fd9
Fixed create on fabric
ThePlasticPotato Dec 2, 2024
6ce173e
prefix -> this
ThePlasticPotato Dec 5, 2024
fdd5cdc
Fix contraption assembly occasionally causing unwanted splitting
ThePlasticPotato Dec 7, 2024
fad8c88
okay fine no logging then have it your way
ThePlasticPotato Dec 7, 2024
39ceca4
Update logo (#1016)
millennIumAMbiguity Dec 14, 2024
d4b7bcf
Update en_pt.json
millennIumAMbiguity Dec 14, 2024
e3044bc
Update mod icon
millennIumAMbiguity Dec 14, 2024
1307159
optimized texture
millennIumAMbiguity Dec 14, 2024
8113073
Added Russian translation
millennIumAMbiguity Dec 14, 2024
e55336a
Merge pull request #1023 from millennIumAMbiguity/pirate-lang-update
Rubydesic Dec 14, 2024
8bfc21d
Merge pull request #1024 from millennIumAMbiguity/update-mod-icon
Rubydesic Dec 14, 2024
ca097aa
Merge pull request #1025 from millennIumAMbiguity/optimize-texture
Rubydesic Dec 14, 2024
1c98bb0
Merge pull request #1026 from millennIumAMbiguity/russian-translation
Rubydesic Dec 14, 2024
c41d894
fix splitting on contraption assembly but like for real this time
ThePlasticPotato Dec 21, 2024
9ffc23a
FAST PHYSICS
StewStrong Dec 22, 2024
181b1fb
hotfix assembly to use dense set
ThePlasticPotato Dec 22, 2024
93cc755
assembly via structure block
ThePlasticPotato Dec 22, 2024
58c6bfb
Joints!
ThePlasticPotato Dec 27, 2024
949a69a
dont do that
ThePlasticPotato Dec 27, 2024
1a86920
Make splitting use old assembly for now
ThePlasticPotato Dec 27, 2024
a788163
Api, split queue, config, joints fix
ThePlasticPotato Dec 27, 2024
44ddbd5
Upgrade kotlin to 2.1.0
ThePlasticPotato Dec 27, 2024
83dfca2
Register shipsettings, that is somewhat important
ThePlasticPotato Dec 27, 2024
6958099
Merge pull request #1038 from ValkyrienSkies/1.18.x/feature/fast-physics
ThePlasticPotato Dec 27, 2024
8f853da
Improved Dragging & Entity Interactions on Ships [Pathfinding, POIs, …
ThePlasticPotato Dec 27, 2024
89fcb09
Extremely rudimentary backport of API changes
ThePlasticPotato Dec 27, 2024
e73a24f
fix mixin minecraft server
ThePlasticPotato Dec 27, 2024
ac586b1
remove parenthesis
ThePlasticPotato Dec 27, 2024
9b7bc54
-> 2.5.0
ThePlasticPotato Dec 28, 2024
cb0341b
update forge krunch version
ThePlasticPotato Dec 28, 2024
38dc79c
Set ice friction to 0
StewStrong Dec 28, 2024
fe7e250
Misc Fixes
ThePlasticPotato Dec 28, 2024
77bee91
Update VSCore
ThePlasticPotato Dec 28, 2024
d8e609b
Fixed lerping again, also fixed contraptions being dragged hopefully
ThePlasticPotato Dec 28, 2024
e613e38
Tiny Cleanup of FTB Chunks Mixin (#1039)
TechTastic Dec 29, 2024
33cfa94
Cleaning up Old Mixins (#1040)
TechTastic Dec 29, 2024
a0db30b
I fell victim to one of the classic blunders
TechTastic Dec 30, 2024
590ed87
Merge pull request #1047 from TechTastic/1.18.x/cleanup/cc-tweaked-bl…
ThePlasticPotato Dec 30, 2024
a798855
Entity dragging tweaks
ThePlasticPotato Dec 30, 2024
03def21
Updated core, fixed D6Joint motion axes null error
StewStrong Jan 5, 2025
3d9cedc
Use vscore kinematics
StewStrong Jan 6, 2025
e81c025
Fixed incorrect yaw transformation
ThePlasticPotato Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
id "dev.architectury.loom" version "1.3.355" apply false
id 'io.github.juuxel.loom-vineflower' version '1.11.0' apply false
// Kotlin
id "org.jetbrains.kotlin.jvm" version "1.9.10" apply false
id "org.jetbrains.kotlin.jvm" version "2.1.0" apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id "com.modrinth.minotaur" version "2.4.3" apply false
}
Expand Down Expand Up @@ -132,6 +132,20 @@ subprojects {
includeGroup "com.rbasamoyai"
}
}
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"
}
}
}
}

Expand Down
25 changes: 16 additions & 9 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

dependencies {
annotationProcessor(implementation("com.github.LlamaLad7:MixinExtras:0.1.1"))
annotationProcessor(implementation("io.github.llamalad7:mixinextras-common:0.3.5"))

compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
// We depend on fabric loader here to use the fabric @Environment annotations
Expand All @@ -11,31 +11,38 @@ dependencies {

modCompileOnly("curse.maven:sodium-394468:3669187")

implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0")

// vs-core
implementation("org.valkyrienskies.core:impl:${rootProject.vs_core_version}") {
exclude module: "netty-buffer"
exclude module: "fastutil"
exclude module: "kotlin-stdlib"
}

implementation("org.valkyrienskies.core:api:${rootProject.vs_core_version}")
implementation("org.valkyrienskies.core:api-game:${rootProject.vs_core_version}")
implementation("org.valkyrienskies.core:util:${rootProject.vs_core_version}")
implementation("org.valkyrienskies.core:api:${rootProject.vs_core_version}") {
exclude module: "kotlin-stdlib"
}
implementation("org.valkyrienskies.core:api-game:${rootProject.vs_core_version}") {
exclude module: "kotlin-stdlib"
}
implementation("org.valkyrienskies.core:util:${rootProject.vs_core_version}") {
exclude module: "kotlin-stdlib"
}

// 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:1802.3.19-build.362") { transitive = false }

// Weather2 1.18
modCompileOnly("curse.maven:weather-storms-tornadoes-237746:4426524")

//Common create compat,
//We just use a version from a platform and hope the classes exist on both versions and mixins apply correctly
modCompileOnly("com.simibubi.create:create-fabric-${minecraft_version}:${create_fabric_version}")
{ exclude group: 'com.github.AlphaMode', module: 'fakeconfigtoml' }
{ exclude group: 'com.github.AlphaMode', module: 'fakeconfigtoml'}
modCompileOnly("net.fabricmc.fabric-api:fabric-api:${fabric_api_version}")
modCompileOnly("com.jozufozu.flywheel:flywheel-fabric-${minecraft_version}:${flywheel_version_fabric}")
modCompileOnly("io.github.fabricators_of_create:Porting-Lib:${port_lib_version}+${minecraft_version}")
modCompileOnly("io.github.fabricators_of_create:Porting-Lib:1.2.1451-beta+1.18.2")
modCompileOnly("com.rbasamoyai:createbigcannons-fabric-${minecraft_version}:${createbigcannons_version}")

//Bluemap fabric 1.18
Expand Down
1 change: 0 additions & 1 deletion common/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
port_lib_version=1.2.677-beta
port_lib_hash=cca931b
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ public ClientShipWorldCore getShipObjectWorld() {
@Shadow
public abstract ClientPacketListener getConnection();

@Inject(
method = "tick",
at = @At("HEAD")
)
public void preTick(final CallbackInfo ci) {
// Tick the ship world and then drag entities
if (!pause && shipObjectWorld != null && level != null && getConnection() != null) {
//EntityDragger.INSTANCE.dragEntitiesWithShips(level.entitiesForRendering(), true);
}
}

@Inject(
method = "tick",
at = @At("TAIL")
Expand All @@ -112,7 +123,8 @@ public void postTick(final CallbackInfo ci) {
if (!pause && shipObjectWorld != null && level != null && getConnection() != null) {
shipObjectWorld.tickNetworking(getConnection().getConnection().getRemoteAddress());
shipObjectWorld.postTick();
EntityDragger.INSTANCE.dragEntitiesWithShips(level.entitiesForRendering());
//EntityDragger.INSTANCE.dragEntitiesWithShips(level.entitiesForRendering());
EntityDragger.INSTANCE.dragEntitiesWithShips(level.entitiesForRendering(), false);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.valkyrienskies.mod.mixin.client.renderer;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.AABB;
import org.joml.Vector3d;
import org.joml.Vector3dc;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.valkyrienskies.core.api.ships.ClientShip;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import org.valkyrienskies.mod.common.util.EntityDraggingInformation;
import org.valkyrienskies.mod.common.util.IEntityDraggingInformationProvider;

@Mixin(EntityRenderer.class)
public class MixinEntityRenderer {

/**
* This is necessary to avoid the vanilla flickering that occurs when entities are at high speeds.
* <p>
* Presumably, it is caused by the culling AABB only being updated on a subsequent tick, so we bypass that.
* @param instance
* @param original
* @return
*/
@WrapOperation(method = "shouldRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getBoundingBoxForCulling()Lnet/minecraft/world/phys/AABB;"))
private AABB redirectAABBConstructor(Entity instance, Operation<AABB> original) {
if (instance instanceof IEntityDraggingInformationProvider dragProvider && dragProvider.getDraggingInformation().isEntityBeingDraggedByAShip()) {
EntityDraggingInformation dragInfo = dragProvider.getDraggingInformation();
ClientShip ship = VSGameUtilsKt.getShipObjectWorld((ClientLevel) instance.level).getAllShips().getById(dragInfo.getLastShipStoodOn());
if (ship == null) {
return original.call(instance);
}
if (dragInfo.getLastShipStoodOn() != null && (dragInfo.getRelativePositionOnShip() != null || dragInfo.getServerRelativePlayerPosition() != null)) {
Vector3dc positionToTransform = dragInfo.bestRelativeEntityPosition();
if (positionToTransform != null) {
Vector3dc transformed = ship.getRenderTransform().getShipToWorld().transformPosition(positionToTransform,
new Vector3d());
return instance.getDimensions(instance.getPose()).makeBoundingBox(transformed.x(), transformed.y(), transformed.z()).inflate(0.5D);
}
}
}
return original.call(instance);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void preRender(final float tickDelta, final long startTime, final boolea
((IEntityDraggingInformationProvider) entity).getDraggingInformation();
final Long lastShipStoodOn = entityDraggingInformation.getLastShipStoodOn();
// Then try getting [entityShouldBeHere] from [entityDraggingInformation]
if (lastShipStoodOn != null && entityDraggingInformation.isEntityBeingDraggedByAShip()) {
if (lastShipStoodOn != null && entityDraggingInformation.isEntityBeingDraggedByAShip()) { //for testing
final ClientShip shipObject =
VSGameUtilsKt.getShipObjectWorld(clientWorld).getLoadedShips().getById(lastShipStoodOn);
if (shipObject != null) {
Expand Down Expand Up @@ -200,6 +200,10 @@ private void preRender(final float tickDelta, final long startTime, final boolea
entity.xo = (entityShouldBeHere.x() - (entity.getX() * tickDelta)) / (1.0 - tickDelta);
entity.yo = (entityShouldBeHere.y() - (entity.getY() * tickDelta)) / (1.0 - tickDelta);
entity.zo = (entityShouldBeHere.z() - (entity.getZ() * tickDelta)) / (1.0 - tickDelta);
//why the fuck do we do this

//what if i just...
//dont
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
Expand Down Expand Up @@ -33,6 +35,7 @@
import org.valkyrienskies.core.api.ships.properties.ShipTransform;
import org.valkyrienskies.mod.common.entity.ShipMountedToData;
import org.valkyrienskies.mod.common.VSGameUtilsKt;
import org.valkyrienskies.mod.common.util.EntityDragger;
import org.valkyrienskies.mod.common.util.EntityDraggingInformation;
import org.valkyrienskies.mod.common.util.IEntityDraggingInformationProvider;
import org.valkyrienskies.mod.common.util.VectorConversionsMCKt;
Expand Down Expand Up @@ -127,11 +130,67 @@ private void preGetEyePosition(final float partialTicks, final CallbackInfoRetur

/**
* @reason Needed for players to pick blocks correctly when mounted to a ship
*
* Needed, because before we only fixed the clientside one.
*/
@Inject(method = "getEyePosition()Lnet/minecraft/world/phys/Vec3;", at = @At("HEAD"), cancellable = true)
private void preGetEyePositionServer(final CallbackInfoReturnable<Vec3> cir) {
final ShipMountedToData shipMountedToData = VSGameUtilsKt.getShipMountedToData(Entity.class.cast(this), null);
if (shipMountedToData == null) {
return;
}
final LoadedShip shipMountedTo = shipMountedToData.getShipMountedTo();

final ShipTransform shipTransform;
if (shipMountedTo instanceof ClientShip) {
shipTransform = ((ClientShip) shipMountedTo).getRenderTransform();
} else {
shipTransform = shipMountedTo.getShipTransform();
}
final Vector3dc basePos = shipTransform.getShipToWorldMatrix()
.transformPosition(shipMountedToData.getMountPosInShip(), new Vector3d());
final Vector3dc eyeRelativePos = shipTransform.getShipCoordinatesToWorldCoordinatesRotation().transform(
new Vector3d(0.0, getEyeHeight(), 0.0)
);
final Vec3 newEyePos = VectorConversionsMCKt.toMinecraft(basePos.add(eyeRelativePos, new Vector3d()));
cir.setReturnValue(newEyePos);
}

/**
* @reason Needed for players to pick blocks correctly when mounted to a ship
*
* Additionally, this has to have dragging information included or it breaks. This is because of reasons that I literally
* do not know or understand, but minecraft's rendering pipeline is like that.
*/
@Inject(method = "calculateViewVector", at = @At("HEAD"), cancellable = true)
private void preCalculateViewVector(final float xRot, final float yRot, final CallbackInfoReturnable<Vec3> cir) {
final LoadedShip shipMountedTo = VSGameUtilsKt.getShipMountedTo(Entity.class.cast(this));
if (shipMountedTo == null) {
if (Entity.class.cast(this) instanceof final ServerPlayer sPlayer && sPlayer instanceof final IEntityDraggingInformationProvider dragProvider) {
if (dragProvider.getDraggingInformation().isEntityBeingDraggedByAShip() && dragProvider.getDraggingInformation().getServerRelativePlayerYaw() != null) {
final Ship shipDraggedBy = VSGameUtilsKt.getAllShips(level).getById(dragProvider.getDraggingInformation().getLastShipStoodOn());
if (shipDraggedBy != null) {
final float realYRot = (float) EntityDragger.INSTANCE.serversideWorldEyeRotationOrDefault(sPlayer, shipDraggedBy, yRot);
final float f = xRot * (float) (Math.PI / 180.0);
final float g = -realYRot * (float) (Math.PI / 180.0);
final float h = Mth.cos(g);
final float i = Mth.sin(g);
final float j = Mth.cos(f);
final float k = Mth.sin(f);
final Vector3dc originalViewVector = new Vector3d(i * j, -k, h * j);

final ShipTransform shipTransform;
if (shipDraggedBy instanceof ClientShip) {
shipTransform = ((ClientShip) shipDraggedBy).getRenderTransform();
} else {
shipTransform = shipDraggedBy.getShipTransform();
}
final Vec3 newViewVector = VectorConversionsMCKt.toMinecraft(
shipTransform.getShipCoordinatesToWorldCoordinatesRotation().transform(originalViewVector, new Vector3d()));
cir.setReturnValue(newViewVector);
}
}
}
return;
}
final float f = xRot * (float) (Math.PI / 180.0);
Expand All @@ -153,6 +212,28 @@ private void preCalculateViewVector(final float xRot, final float yRot, final Ca
cir.setReturnValue(newViewVector);
}

/**
* @reason Without this and that other mixin, things don't render correctly at high speeds.
* @see org.valkyrienskies.mod.mixin.client.renderer.MixinEntityRenderer
*/
@Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true)
private void onShouldRender(double d, double e, double f, CallbackInfoReturnable<Boolean> cir) {
if (this.draggingInformation.isEntityBeingDraggedByAShip() && this.level.isClientSide) {
final ClientShip ship = VSGameUtilsKt.getShipObjectWorld((ClientLevel) this.level).getAllShips().getById(this.draggingInformation.getLastShipStoodOn());
if (ship != null) {
final ShipTransform shipTransform = ship.getRenderTransform();
if (this.draggingInformation.getRelativePositionOnShip() != null) {
Vector3dc redir = shipTransform.getShipToWorld().transformPosition(this.draggingInformation.getRelativePositionOnShip(), new Vector3d());
double distX = redir.x() - d;
double distY = redir.y() - e;
double distZ = redir.z() - f;
double sqrDist = distX * distX + distY * distY + distZ * distZ;
cir.setReturnValue(shouldRenderAtSqrDistance(sqrDist));
}
}
}
}

// region shadow functions and fields
@Shadow
public Level level;
Expand Down Expand Up @@ -183,6 +264,12 @@ private void preCalculateViewVector(final float xRot, final float yRot, final Ca
@Shadow
public abstract EntityType<?> getType();

@Shadow
private float yRot;

@Shadow
public abstract boolean shouldRenderAtSqrDistance(double d);

@Override
@NotNull
public EntityDraggingInformation getDraggingInformation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.valkyrienskies.mod.mixin.feature.ai.goal;

import java.util.Random;
import net.minecraft.world.entity.ai.behavior.AcquirePoi.JitteredLinearRetry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(JitteredLinearRetry.class)
public interface JitteredLinearRetryAccessor {
@Invoker("<init>")
static JitteredLinearRetry create(Random random, long l) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.valkyrienskies.mod.mixin.feature.ai.goal;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Position;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ai.goal.MoveToBlockGoal;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.valkyrienskies.mod.common.VSGameUtilsKt;

@Mixin(MoveToBlockGoal.class)
public class MixinMoveToBlockGoal {
@Shadow
@Final
protected PathfinderMob mob;

@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;closerToCenterThan(Lnet/minecraft/core/Position;D)Z"))
private boolean onCloserToCenterThan(BlockPos instance, Position position, double v, Operation<Boolean> original) {
return original.call(new BlockPos(VSGameUtilsKt.toWorldCoordinates(this.mob.level, instance)), position, v);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.valkyrienskies.mod.mixin.feature.ai.goal;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.behavior.MoveToTargetSink;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.valkyrienskies.mod.common.VSGameUtilsKt;

@Mixin(MoveToTargetSink.class)
public class MixinMoveToTargetSink {
@WrapOperation(method = "reachedTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;distManhattan(Lnet/minecraft/core/Vec3i;)I"))
private int onDistManhattan(BlockPos instance, Vec3i vec3i, Operation<Integer> original, @Local(argsOnly = true) Mob mob) {
return original.call(new BlockPos(VSGameUtilsKt.toWorldCoordinates(mob.level, instance)), vec3i);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.valkyrienskies.mod.mixin.feature.ai.goal;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Position;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.behavior.ValidateNearbyPoi;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.valkyrienskies.mod.common.VSGameUtilsKt;

@Mixin(ValidateNearbyPoi.class)
public class MixinValidateNearbyPoi {
@WrapOperation(method = "checkExtraStartConditions", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;closerToCenterThan(Lnet/minecraft/core/Position;D)Z"))
private boolean onCloserToCenterThan(BlockPos instance, Position position, double v, Operation<Boolean> original, @Local
LivingEntity livingEntity) {
return original.call(new BlockPos(VSGameUtilsKt.toWorldCoordinates(livingEntity.level, instance)), position, v);
}
}
Loading
Loading