Highlight synced with part block

This commit is contained in:
2025-08-15 18:35:37 +02:00
parent b7b977c944
commit 74a03f3583
4 changed files with 65 additions and 9 deletions

View File

@@ -58,6 +58,9 @@ minecraft {
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
jvmArgs += [
"-Dmixin.debug.export=true", "-Dmixin.debug.verbose=true","-Dmixin.dumpTargetOnFailure=true"
]
// arg "-mixin.config=${mod_id}.mixin.json"
@@ -90,6 +93,8 @@ minecraft {
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
maven { // JEI mirror, AE2
name = "ModMaven"
url = "https://modmaven.dev"
@@ -136,6 +141,10 @@ dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
testAnnotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0"))
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.5.0")) {
jarJar.ranged(it, "[0.5.0,)")
}
implementation fg.deobf("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false }
implementation fg.deobf("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtm_version}") {transitive = false}
@@ -147,8 +156,8 @@ dependencies {
}
mixin {
add sourceSets.main, "${mod_id}.refmap.json"
config "${mod_id}.mixin.json"
add sourceSets.main, "ibg.refmap.json"
config "ibg.mixin.json"
}
tasks.named('processResources', ProcessResources).configure {

View File

@@ -1,7 +1,6 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
## Environment Properties
minecraft_version=1.20.1
minecraft_version_range=[1.20.1,1.21)
@@ -23,7 +22,7 @@ mod_description=Example mod description.\nNewline characters can be used and wil
## Deps Properties
gtm_version=7.0.0
gtm_version=7.0.2
geckolib_version=4.7.3
ldlib_version=1.0.40.b

View File

@@ -0,0 +1,46 @@
package com.imbgt.ibg.mixin;
import javax.annotation.Nullable;
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 com.imbgt.ibg.block.entity.PartBE;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
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.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
@Mixin(LevelRenderer.class)
public abstract class LevelRendererMixin {
@Shadow
@Final
@Nullable
private ClientLevel level;
@WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderHitOutline(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/entity/Entity;DDDLnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V"))
private void ibg$wrapRenderHitOutline(LevelRenderer instance, PoseStack poseStack, VertexConsumer consumer,
Entity entity, double camX, double camY, double camZ,
BlockPos pos, BlockState state, Operation<Void> original) {
if (level != null && level.getBlockEntity(pos) instanceof PartBE part && part.getMasterPos() != null) {
BlockPos masterPos = part.getMasterPos();
BlockEntity master = level.getBlockEntity(masterPos);
if (master != null) {
pos = masterPos;
state = level.getBlockState(masterPos);
}
}
original.call(instance, poseStack, consumer, entity, camX, camY, camZ, pos, state);
}
}

View File

@@ -1,14 +1,16 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.imbgt.ibg.mixin",
"refmap": "ibg.refmap.json",
"compatibilityLevel": "JAVA_17",
"mixins":[],
"mixins": [],
"client": [
"MetaMachineBlockMixin",
"MetaMachineBlockEntityGeoMixin"
"MetaMachineBlockEntityGeoMixin",
"LevelRendererMixin"
],
"injectors": {
"defaultRequire": 1
},
"refmap": "ibg.refmap.json"
}
}