Skip to content

Commit

Permalink
Merge branch 'master' into gtmega
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Jun 8, 2022
2 parents 90fb51b + bc82df2 commit bcb8571
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
35 changes: 23 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1641429628falsepattern12
//version: 1641429628falsepattern18
/*
DO NOT CHANGE THIS FILE!
Expand Down Expand Up @@ -95,6 +95,7 @@ checkPropertyExists("repositoryName")
checkPropertyExists("mavenGroupId")
checkPropertyExists("mavenArtifactId")
checkPropertyExists("hasMixinDeps")
checkPropertyExists("mixinPreinitConfig")


String javaSourceDir = "src/main/java/"
Expand Down Expand Up @@ -441,7 +442,7 @@ def getManifestAttributes() {
if(usesMixins.toBoolean()) {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json",
"MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""),
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
]
}
Expand Down Expand Up @@ -545,18 +546,26 @@ def getCredentials = {
return [username: entry.username.text(), password: entry.password.text()]
}
}
throw new Exception();
} catch (Exception ignored) {
return [username: "none", password: "none"]
//Try from environment variables if file does not exist
String username = System.getenv("MAVEN_DEPLOY_USER")
String password = System.getenv("MAVEN_DEPLOY_PASSWORD")
if (username == null || password == null) {
return [username: null, password: null]
} else {
return [username: username, password: password]
}
}
}

//Publishing
publishing {
publications {
maven(MavenPublication) {
artifact source: jar
artifact source: (jar.enabled ? jar : shadowJar)
artifact source: sourcesJar, classifier: "src"
artifact source: devJar, classifier: "dev"
artifact source: (devJar.enabled ? devJar : shadowDevJar), classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
Expand All @@ -568,13 +577,15 @@ publishing {
}

repositories {
maven {
name = repositoryName
url = repositoryURL
def creds = getCredentials()
credentials {
username = creds == null ? "none" : creds.username
password = creds == null ? "none" : creds.password
if (repositoryURL.trim() != "") {
maven {
name = repositoryName
url = repositoryURL
def creds = getCredentials()
credentials {
username = creds == null ? "none" : creds.username
password = creds == null ? "none" : creds.password
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ hasMixinDeps = false
mixinPlugin = mixin.plugin.MixinPlugin
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage = mixin.mixins
# Specify a preinit mixin here. Preinit mixins should be used very rarely, if at all, so this mixin config will not be managed by the buildscript, only included.
mixinPreinitConfig =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.falsepattern.triangulator.mixin.helper.ITessellatorMixin;
import lombok.Getter;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.shader.TesselatorVertexState;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -14,6 +15,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Comparator;

Expand Down Expand Up @@ -66,6 +68,19 @@ private void forceDrawingTris(Tessellator instance, int value) {
drawMode = value;
}

/**
* @author SirFell
* <p>
* Fixes <a href="https://github.com/MinecraftForge/MinecraftForge/issues/981">MinecraftForge#981</a> . Crash on <a href="https://github.com/MinecraftForge/MinecraftForge/issues/981#issuecomment-57375939">bad moder rendering"(©LexManos)</a> of transparent/translucent blocks when they draw nothing.
*/
@Inject(method = "getVertexState", at = @At("HEAD"), cancellable = true)
public void getVertexStateNatural0Safe(float x, float y, float z, CallbackInfoReturnable<TesselatorVertexState> cir){
if(this.rawBufferIndex <= 0) {
cir.setReturnValue(null);
cir.cancel();
}
}

@Override
public boolean hackedQuadRendering() {
return hackedQuadRendering;
Expand Down

0 comments on commit bcb8571

Please sign in to comment.