Skip to content

Commit

Permalink
mixin fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
HollowHorizon committed Feb 6, 2024
1 parent 7637e29 commit 675091e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ repositories {
configure<MixinExtension> {
add(sourceSets.main.get(), "hollowengine.refmap.json")
config("hollowengine.mixins.json")

debug = true
}

dependencies {
Expand Down
Binary file modified hc/kotlinscript-1.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import net.minecraft.world.entity.item.ItemEntity
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.trading.MerchantOffer
import net.minecraft.world.level.ClipContext
import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraftforge.common.util.ITeleporter
import net.minecraftforge.event.TickEvent.ServerTickEvent
import net.minecraftforge.network.PacketDistributor
import net.minecraftforge.registries.ForgeRegistries
import ru.hollowhorizon.hc.client.models.gltf.animations.PlayMode
import ru.hollowhorizon.hc.client.models.gltf.manager.AnimatedEntityCapability
import ru.hollowhorizon.hc.client.models.gltf.manager.AnimationLayer
Expand Down Expand Up @@ -216,6 +218,20 @@ interface IContextBuilder {
}

infix fun NPCProperty.lookAtPos(target: () -> Vec3) = +NpcLookToBlockNode(this, target)

fun NPCProperty.lookAtEntityType(entity: () -> String) {
val entityType = ForgeRegistries.ENTITY_TYPES.getValue(entity().rl)!!

lookAtEntity {
val npc = this()
val level = npc.level

level.getEntitiesOfClass(LivingEntity::class.java, AABB.ofSize(npc.position(), 25.0, 25.0, 25.0)) {
it.type == entityType
}.minByOrNull { it.distanceTo(npc) } ?: npc
}
}

infix fun NPCProperty.lookAtEntity(target: () -> Entity) = +NpcLookToEntityNode(this, target)

infix fun NPCProperty.lookAtTeam(target: () -> Team) = +NpcLookToTeamNode(this, target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@

@Mixin(LocateCommand.class)
public abstract class LocateCommandMixin {
@Shadow
@Shadow(aliases = "m_214474_")
public static int showLocateResult(CommandSourceStack pSource, ResourceOrTagLocationArgument.Result<?> pResult, BlockPos pSourcePosition, Pair<BlockPos, ? extends Holder<?>> pResultWithPosition, String pTranslationKey, boolean pAbsoluteY) {
return 0;
}

@Shadow
@Shadow(aliases = "m_214483_")
protected static Optional<? extends HolderSet.ListBacked<Structure>> getHolders(ResourceOrTagLocationArgument.Result<Structure> p_214484_, Registry<Structure> p_214485_) {
return null;
}

@Shadow
@Shadow(aliases = "f_214452_")
@Final
private static DynamicCommandExceptionType ERROR_STRUCTURE_INVALID;

Expand Down

0 comments on commit 675091e

Please sign in to comment.