Skip to content

Commit

Permalink
Merge branch 'refs/heads/1.20.6' into 1.21
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/net/irisshaders/iris/mixin/vertices/MixinBufferBuilder.java
  • Loading branch information
IMS212 committed Jun 27, 2024
2 parents a3540b8 + 1b82097 commit 19f7ad5
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 14 deletions.
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ repositories {
includeGroup("maven.modrinth")
}
}
maven("https://maven.covers1624.net/")
}

plugins {
Expand All @@ -53,6 +54,21 @@ base {
}

loom {
runs {
create("clientWithQuickplay") {
client()
isIdeConfigGenerated = true
programArgs("--launch_target", "net.fabricmc.loader.impl.launch.knot.KnotClient")
mainClass.set("net.covers1624.devlogin.DevLogin")
projectDir.resolve("run").resolve("mods").resolve(Constants.MINECRAFT_VERSION).mkdirs()
vmArgs("-Dfabric.modsFolder=" + projectDir.resolve("run").resolve("mods").resolve(Constants.MINECRAFT_VERSION).absolutePath)
programArgs("--quickPlaySingleplayer", "World For " + Constants.MINECRAFT_VERSION)
if (Constants.ACTIVATE_RENDERDOC && DefaultNativePlatform.getCurrentOperatingSystem().isLinux) {
environmentVariable("LD_PRELOAD", "/usr/lib/librenderdoc.so")
}
}
}

mixin {
useLegacyMixinAp = false
}
Expand Down Expand Up @@ -134,6 +150,7 @@ dependencies {
minecraft(group = "com.mojang", name = "minecraft", version = Constants.MINECRAFT_VERSION)
mappings(loom.officialMojangMappings())
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = Constants.FABRIC_LOADER_VERSION)
localRuntime("net.covers1624:DevLogin:0.1.0.5")

include("org.antlr:antlr4-runtime:4.13.1")
modImplementation("org.antlr:antlr4-runtime:4.13.1")
Expand Down Expand Up @@ -174,6 +191,7 @@ tasks {
}
jvmArgs("-Dmixin.debug.export=true")
}

getByName<JavaCompile>("compileDesktopJava") {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.irisshaders.iris.mixin;

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.irisshaders.iris.Iris;
Expand Down Expand Up @@ -53,30 +55,30 @@ private boolean skipRenderChunks(LevelRenderer instance, RenderType renderType,
}
}

@Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;entitiesForRendering()Ljava/lang/Iterable;"))
private Iterable<Entity> skipRenderEntities(ClientLevel instance) {
@WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;entitiesForRendering()Ljava/lang/Iterable;"))
private Iterable<Entity> skipRenderEntities(ClientLevel instance, Operation<Iterable<Entity>> original) {
if (Iris.getPipelineManager().getPipelineNullable() instanceof IrisRenderingPipeline pipeline && pipeline.skipAllRendering()) {
return Collections.emptyList();
} else {
return instance.entitiesForRendering();
return original.call(instance);
}
}

@Redirect(method = "renderLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;visibleSections:Lit/unimi/dsi/fastutil/objects/ObjectArrayList;"))
private ObjectArrayList<SectionRenderDispatcher.RenderSection> skipLocalBlockEntities(LevelRenderer instance) {
@WrapOperation(method = "renderLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;visibleSections:Lit/unimi/dsi/fastutil/objects/ObjectArrayList;"))
private ObjectArrayList<SectionRenderDispatcher.RenderSection> skipLocalBlockEntities(LevelRenderer instance, Operation<ObjectArrayList<SectionRenderDispatcher.RenderSection>> original) {
if (Iris.getPipelineManager().getPipelineNullable() instanceof IrisRenderingPipeline pipeline && pipeline.skipAllRendering()) {
return EMPTY_LIST;
} else {
return this.visibleSections;
return original.call(instance);
}
}

@Redirect(method = "renderLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;globalBlockEntities:Ljava/util/Set;"))
private Set<BlockEntity> skipGlobalBlockEntities(LevelRenderer instance) {
@WrapOperation(method = "renderLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;globalBlockEntities:Ljava/util/Set;"))
private Set<BlockEntity> skipGlobalBlockEntities(LevelRenderer instance, Operation<Set<BlockEntity>> original) {
if (Iris.getPipelineManager().getPipelineNullable() instanceof IrisRenderingPipeline pipeline && pipeline.skipAllRendering()) {
return Collections.emptySet();
} else {
return this.globalBlockEntities;
return original.call(instance);
}
}
}
37 changes: 37 additions & 0 deletions src/main/java/net/irisshaders/iris/mixin/MixinQuickPlayDev.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.irisshaders.iris.mixin;

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.DisconnectedScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
import net.minecraft.client.quickplay.QuickPlay;
import net.minecraft.world.Difficulty;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.WorldDataConfiguration;
import net.minecraft.world.level.levelgen.WorldOptions;
import net.minecraft.world.level.levelgen.presets.WorldPresets;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(QuickPlay.class)
public class MixinQuickPlayDev {
@Inject(method = "joinSingleplayerWorld", at = @At("HEAD"), cancellable = true)
private static void iris$createWorldIfDev(Minecraft minecraft, String string, CallbackInfo ci) {
if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
ci.cancel();

if (!minecraft.getLevelSource().levelExists(string)) {
minecraft.createWorldOpenFlows().createFreshLevel(string, new LevelSettings(string, GameType.CREATIVE, false, Difficulty.HARD, true, new GameRules(), WorldDataConfiguration.DEFAULT),
WorldOptions.defaultWithRandomSeed(), WorldPresets::createNormalWorldDimensions, Minecraft.getInstance().screen);
} else {
minecraft.createWorldOpenFlows().openWorld(string, () -> minecraft.setScreen(new TitleScreen()));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public abstract class MixinBufferBuilder implements VertexConsumer, BlockSensiti
@Unique
private boolean injectNormalAndUV1;
@Unique
private int vertexCount;
private int iris$vertexCount;
@Unique
private short currentBlock = -1;
@Unique
Expand Down Expand Up @@ -172,10 +172,10 @@ private void injectMidBlock(float x, float y, float z, CallbackInfoReturnable<Ve
this.elementsToFill = this.elementsToFill & ~IrisVertexFormats.MID_TEXTURE_ELEMENT.mask();
this.elementsToFill = this.elementsToFill & ~IrisVertexFormats.TANGENT_ELEMENT.mask();

vertexCount++;
iris$vertexCount++;

if (mode == VertexFormat.Mode.QUADS && vertexCount == 4 || mode == VertexFormat.Mode.TRIANGLES && vertexCount == 3) {
fillExtendedData(vertexCount);
if (mode == VertexFormat.Mode.QUADS && iris$vertexCount == 4 || mode == VertexFormat.Mode.TRIANGLES && iris$vertexCount == 3) {
fillExtendedData(iris$vertexCount);
}
}

Expand All @@ -199,7 +199,7 @@ public void endBlock() {

@Unique
private void fillExtendedData(int vertexAmount) {
vertexCount = 0;
iris$vertexCount = 0;

int stride = format.getVertexSize();

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/mixins.iris.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"MixinProgram",
"MixinProgramManager",
"MixinProgramType",
"MixinQuickPlayDev",
"MixinRenderSystem",
"MixinRenderTarget",
"MixinScreenEffectRenderer",
Expand Down

0 comments on commit 19f7ad5

Please sign in to comment.