-
-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # src/main/java/net/coderbot/iris/mixin/shadows/MixinLevelRenderer.java
- Loading branch information
Showing
34 changed files
with
198 additions
and
99 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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/coderbot/iris/compliance/ComplianceVersion.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,30 @@ | ||
package net.coderbot.iris.compliance; | ||
|
||
import net.coderbot.iris.Iris; | ||
|
||
public enum ComplianceVersion { | ||
NO_COMPLIANCE, | ||
v1; | ||
|
||
public int getInternalComplianceLevel() { | ||
switch (this) { | ||
case NO_COMPLIANCE -> { | ||
return 0; | ||
} | ||
case v1 -> { | ||
return 1; | ||
} | ||
default -> throw new IllegalStateException("Impossible, compliance is not existing? " + this.name()); | ||
} | ||
} | ||
|
||
public static ComplianceVersion getComplianceLevel(String compliance) { | ||
try { | ||
int complianceL = Integer.parseInt(compliance); | ||
return ComplianceVersion.valueOf("v" + complianceL); | ||
} catch (IllegalArgumentException e) { | ||
Iris.logger.warn("Unknown compliance: " + compliance + "; defaulting to NONCOMPLIANT."); | ||
return NO_COMPLIANCE; | ||
} | ||
} | ||
} |
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,5 @@ | ||
package net.coderbot.iris.gl; | ||
|
||
public interface BooleanStateExtended { | ||
void setUnknownState(); | ||
} |
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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/net/coderbot/iris/mixin/MixinBooleanState.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,42 @@ | ||
package net.coderbot.iris.mixin; | ||
|
||
import com.mojang.blaze3d.platform.GlStateManager; | ||
import net.coderbot.iris.gl.BooleanStateExtended; | ||
import org.lwjgl.opengl.GL11; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(GlStateManager.BooleanState.class) | ||
public class MixinBooleanState implements BooleanStateExtended { | ||
@Shadow | ||
@Final | ||
private int state; | ||
@Shadow | ||
public boolean enabled; | ||
@Unique | ||
private boolean stateUnknown; | ||
|
||
@Inject(method = "setEnabled", at = @At("HEAD"), cancellable = true) | ||
private void iris$setUnknownState(boolean enable, CallbackInfo ci) { | ||
if (stateUnknown) { | ||
ci.cancel(); | ||
this.enabled = enable; | ||
stateUnknown = false; | ||
if (enable) { | ||
GL11.glEnable(this.state); | ||
} else { | ||
GL11.glDisable(this.state); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void setUnknownState() { | ||
stateUnknown = true; | ||
} | ||
} |
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
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
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
Oops, something went wrong.