Skip to content

Commit

Permalink
Many buildscript fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Oct 8, 2024
1 parent 22bac81 commit b38c5c1
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 18 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ sourceSets {
loom {
mixin {
defaultRefmapName = "iris.refmap.json"
useLegacyMixinAp = false
useLegacyMixinAp = true
}

accessWidenerPath = file("src/main/resources/iris.accesswidener")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void onLoad(String mixinPackage) {

@Override
public String getRefMapperConfig() {
return "";
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package net.irisshaders.iris.mixin;

import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class IrisMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {

}

@Override
public String getRefMapperConfig() {
return "iris.refmap.json";
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

}

@Override
public List<String> getMixins() {
return List.of();
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.objects.Object2IntFunction;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.irisshaders.iris.layer.BufferSourceWrapper;
import net.irisshaders.iris.layer.EntityRenderStateShard;
import net.irisshaders.iris.layer.OuterWrappedRenderType;
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
import net.irisshaders.iris.uniforms.CapturedRenderingState;
import net.irisshaders.iris.vertices.ImmediateState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.monster.ZombieVillager;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
Expand All @@ -28,6 +35,15 @@
*/
@Mixin(EntityRenderDispatcher.class)
public class MixinEntityRenderDispatcher {
@Unique
private static final NamespacedId CURRENT_PLAYER = new NamespacedId("minecraft", "current_player");

@Unique
private static final NamespacedId CONVERTING_VILLAGER = new NamespacedId("minecraft", "zombie_villager_converting");

@Unique
private static final Object2ObjectMap<EntityType<?>, NamespacedId> ENTITY_IDS = new Object2ObjectOpenHashMap<>();

// Inject after MatrixStack#push since at this point we know that most cancellation checks have already passed.
@ModifyVariable(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V", shift = At.Shift.AFTER),
allow = 1, require = 1, argsOnly = true)
Expand All @@ -41,10 +57,21 @@ public class MixinEntityRenderDispatcher {
int intId;

if (entity instanceof ZombieVillager zombie && zombie.isConverting() && WorldRenderingSettings.INSTANCE.hasVillagerConversionId()) {
intId = entityIds.applyAsInt(new NamespacedId("minecraft", "zombie_villager_converting"));
intId = entityIds.applyAsInt(CONVERTING_VILLAGER);
} else if (entity instanceof Player && Minecraft.getInstance().getCameraEntity() == entity) {
if (entityIds.containsKey(CURRENT_PLAYER)) {
intId = entityIds.getInt(CURRENT_PLAYER);
} else {
intId = entityIds.applyAsInt(ENTITY_IDS.computeIfAbsent(entity.getType(), k -> {
ResourceLocation entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType());
return new NamespacedId(entityId.getNamespace(), entityId.getPath());
}));
}
} else {
ResourceLocation entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType());
intId = entityIds.applyAsInt(new NamespacedId(entityId.getNamespace(), entityId.getPath()));
intId = entityIds.applyAsInt(ENTITY_IDS.computeIfAbsent(entity.getType(), k -> {
ResourceLocation entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType());
return new NamespacedId(entityId.getNamespace(), entityId.getPath());
}));
}

CapturedRenderingState.INSTANCE.setCurrentEntity(intId);
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/mixins.iris.bettermipmaps.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"minVersion": "0.8",
"package": "net.irisshaders.iris.mixin.bettermipmaps",
"refmap": "iris.refmap.json",
"plugin": "net.irisshaders.iris.mixin.IrisMixinPlugin",
"compatibilityLevel": "JAVA_8",
"client": [
],
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/mixins.iris.compat.sodium.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"minVersion": "0.8",
"package": "net.irisshaders.iris.compat.sodium.mixin",
"refmap": "iris.refmap.json",
"plugin": "net.irisshaders.iris.mixin.IrisMixinPlugin",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinBlockRenderer",
Expand Down
3 changes: 1 addition & 2 deletions common/src/main/resources/mixins.iris.fantastic.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"minVersion": "0.8",
"package": "net.irisshaders.iris.mixin.fantastic",
"refmap": "iris.refmap.json",
"plugin": "net.irisshaders.iris.mixin.IrisMixinPlugin",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinFireworkSparkParticle",
"MixinLevelRenderer",
"MixinParticleEngine",
"MixinStationaryItemParticle",
"MixinTerrainParticle"
],
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/mixins.iris.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"minVersion": "0.8",
"package": "net.irisshaders.iris.mixin",
"refmap": "iris.refmap.json",
"plugin": "net.irisshaders.iris.mixin.IrisMixinPlugin",
"compatibilityLevel": "JAVA_8",
"client": [
"DimensionTypeAccessor",
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/mixins.iris.vertexformat.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"minVersion": "0.8",
"package": "net.irisshaders.iris.mixin.vertices",
"compatibilityLevel": "JAVA_8",
"plugin": "net.irisshaders.iris.mixin.IrisMixinPlugin",
"refmap": "iris.refmap.json",
"client": [
"MixinBufferBuilder",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.irisshaders.iris.mixin.fantastic;
package net.irisshaders.iris.mixin.fabric;

import com.mojang.blaze3d.vertex.PoseStack;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.fantastic.ParticleRenderingPhase;
import net.irisshaders.iris.fantastic.PhasedParticleEngine;
Expand All @@ -13,9 +12,7 @@
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderBuffers;
import net.minecraft.client.renderer.culling.Frustum;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package net.irisshaders.iris.mixin.fantastic;
package net.irisshaders.iris.mixin.fabric;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.mojang.blaze3d.systems.RenderSystem;
import net.irisshaders.iris.fantastic.ParticleRenderingPhase;
import net.irisshaders.iris.fantastic.PhasedParticleEngine;
import net.irisshaders.iris.pipeline.programs.ShaderAccess;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.client.particle.ParticleRenderType;
import net.minecraft.client.renderer.ShaderInstance;
Expand All @@ -19,9 +17,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.function.Supplier;

/**
Expand Down
3 changes: 3 additions & 0 deletions fabric/src/main/resources/mixins.iris.fabric.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"required": true,
"minVersion": "0.8",
"package": "net.irisshaders.iris.mixin.fabric",
"refmap": "iris-fabric.refmap.json",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinParticleEngine",
"MixinLevelRenderer"
],
"injectors": {
"defaultRequire": 1
Expand Down
1 change: 0 additions & 1 deletion neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ dependencies {
includeDep("org.sinytra.forgified-fabric-api:fabric-block-view-api-v2:1.0.10+9afaaf8c19")

implementation("maven.modrinth", "sodium", "mc1.21-0.6.0-beta.2-neoforge")
includeAdditional("org.antlr:antlr4-runtime:4.13.1")
includeAdditional("io.github.douira:glsl-transformer:2.0.1")
includeAdditional("org.anarres:jcpp:1.4.14")
}
Expand Down

0 comments on commit b38c5c1

Please sign in to comment.