-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/1.18.x/main' into 1.18.x/cleanup/ftb-chunks
Showing
94 changed files
with
3,276 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
common/src/main/java/org/valkyrienskies/mod/mixin/client/renderer/MixinEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...c/main/java/org/valkyrienskies/mod/mixin/feature/ai/goal/JitteredLinearRetryAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
common/src/main/java/org/valkyrienskies/mod/mixin/feature/ai/goal/MixinMoveToBlockGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
common/src/main/java/org/valkyrienskies/mod/mixin/feature/ai/goal/MixinMoveToTargetSink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...on/src/main/java/org/valkyrienskies/mod/mixin/feature/ai/goal/MixinValidateNearbyPoi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
common/src/main/java/org/valkyrienskies/mod/mixin/feature/ai/goal/bees/MixinBee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.valkyrienskies.mod.mixin.feature.ai.goal.bees; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Vec3i; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.animal.Bee; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.valkyrienskies.mod.common.VSGameUtilsKt; | ||
|
||
@Mixin(Bee.class) | ||
public abstract class MixinBee extends Entity { | ||
|
||
public MixinBee(EntityType<?> entityType, Level level) { | ||
super(entityType, level); | ||
} | ||
|
||
@WrapOperation(method = "closerThan", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/BlockPos;closerThan(Lnet/minecraft/core/Vec3i;D)Z")) | ||
private boolean onCloserThan(BlockPos instance, Vec3i vec3i, double v, Operation<Boolean> original) { | ||
return original.call(new BlockPos(VSGameUtilsKt.toWorldCoordinates(this.level, instance)), vec3i, v); | ||
} | ||
} |
Oops, something went wrong.