Removed canvas interop. Not worth it.

This commit is contained in:
Sollace 2021-06-26 13:15:42 +02:00
parent 441b01f8d3
commit 64c5f2f3f1
8 changed files with 51 additions and 175 deletions

View file

@ -1,54 +1,27 @@
plugins {
id 'java-library'
id 'fabric-loom' version '0.8-SNAPSHOT' apply false
id 'fabric-loom' version '0.8-SNAPSHOT'
}
allprojects {
apply plugin: 'fabric-loom'
apply plugin: 'fabric-loom'
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
version = "${project.minecraft_version}-${project.version}"
version = "${project.minecraft_version}-${project.version}"
if (project.release != 'RELEASE') {
version += "-${project.release}"
}
if (project.release != 'RELEASE') {
version += "-${project.release}"
}
group = project.group
description = project.displayname
archivesBaseName = project.name
group = project.group
description = project.displayname
archivesBaseName = project.name
// check for updates every build when on CI
if (System.env.CI) {
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modApi "net.fabricmc:fabric-loader:${project.loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
// check for updates every build when on CI
if (System.env.CI) {
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
@ -56,6 +29,40 @@ minecraft {
refmapName = 'unicopia.mixin.refmap.json'
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modApi "net.fabricmc:fabric-loader:${project.loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
modApi "com.minelittlepony:MineLittlePony:${project.minelp_version}"
modApi "com.minelittlepony:Kirin:${project.kirin_version}"
include "com.minelittlepony:Kirin:${project.kirin_version}"
modCompileOnly("io.github.prospector:modmenu:${project.modmenu_version}") {
transitive = false
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
repositories {
maven {
name = 'minelp'
@ -67,26 +74,4 @@ repositories {
}
}
dependencies {
modApi "com.minelittlepony:MineLittlePony:${project.minelp_version}"
modApi "com.minelittlepony:Kirin:${project.kirin_version}"
include "com.minelittlepony:Kirin:${project.kirin_version}"
modCompileOnly("io.github.prospector:modmenu:${project.modmenu_version}") {
transitive = false
}
// Fix circular error when gradle tries to build this project as a pre-requisite to :canvas-compat
// Build will fail if the sub-project isn't built first though,
// so make sure to run gradlew :canvas-compat:build before doing gradlew build
if (file("./canvas-compat/build/libs/${project(':canvas-compat').jar.archiveName}").exists()) {
modCompileOnly(project(":canvas-compat")) {
transitive = false
}
}
afterEvaluate {
include project(":canvas-compat")
}
}

View file

@ -1,27 +0,0 @@
plugins {
id 'java-library'
}
repositories {
maven {
name = "dblsaiko"
url = "https://maven.dblsaiko.net/"
}
maven {
name = "Cotton"
allowInsecureProtocol = true
url = "http://server.bbkr.space:8081/artifactory/libs-release/"
}
maven {
name = "Shedanial"
url = "https://maven.shedaniel.me/"
}
}
dependencies {
modCompileOnly("grondag:canvas-mc116:${project.canvas_version}") {
exclude(module: "fabric-api")
exclude(module: "fabric-loader")
transitive = false
}
}

View file

@ -1,20 +0,0 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.6
loader_version=0.10.6+build.214
fabric_version=0.30.0+1.16
# Mod Properties
group=com.minelittlepony
displayname=Unicopia-CanvasCompat
authors=Sollace
description=Magical Abilities for Mine Little Pony!
version=1
release=RELEASE
# Dependencies
canvas_version=1.0.+

View file

@ -1,19 +0,0 @@
package com.minelittlepony.unicopia.client.render;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
public final class CanvasCompat {
private CanvasCompat() {}
public static VertexConsumer getGlowingConsumer(boolean glowing, VertexConsumerProvider renderContext, RenderLayer layer) {
if (!glowing || !RendererAccess.INSTANCE.hasRenderer() || !FabricLoader.getInstance().isModLoaded("canvas")) {
return ItemRenderer.getArmorGlintConsumer(renderContext, layer, false, false);
}
return CanvasCompatImpl.getGlowingConsumer(glowing, renderContext, layer);
}
}

View file

@ -1,23 +0,0 @@
package com.minelittlepony.unicopia.client.render;
import grondag.canvas.material.state.MaterialFinderImpl;
import grondag.canvas.material.state.RenderLayerHelper;
import grondag.frex.api.material.FrexVertexConsumerProvider;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer;
final class CanvasCompatImpl {
private CanvasCompatImpl() {}
public static VertexConsumer getGlowingConsumer(boolean glowing, VertexConsumerProvider renderContext, RenderLayer layer) {
if (!(renderContext instanceof FrexVertexConsumerProvider)) {
return ItemRenderer.getArmorGlintConsumer(renderContext, layer, false, false);
}
return ((FrexVertexConsumerProvider)renderContext).getConsumer(MaterialFinderImpl.threadLocal()
.copyFrom(RenderLayerHelper.copyFromLayer(layer))
.emissive(true)
.find());
}
}

View file

@ -1,19 +0,0 @@
{
"schemaVersion": 1,
"id": "unicopia_canvas_compat",
"version": "${version}",
"name": "Unicopia-Canvas_compat",
"description": "Magical Abilities for Mine Little Pony!",
"authors": [ "Sollace" ],
"contact": {
"sources": "https://github.com/Sollace/Unicopia",
"issues": "https://github.com/Sollace/Unicopia/issues"
},
"mixins": [ ],
"license": "MIT",
"environment": "*",
"custom": {
"modmenu:clientsideOnly": true,
"modmenu:api": true
}
}

View file

@ -9,5 +9,3 @@ pluginManagement {
}
}
rootProject.name = 'Unicopia'
include 'canvas-compat'

View file

@ -13,6 +13,7 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
@ -58,7 +59,7 @@ public class BraceletFeatureRenderer<E extends LivingEntity> implements Accessor
boolean glowing = ((GlowableItem)item.getItem()).isGlowing(item);
VertexConsumer consumer = CanvasCompat.getGlowingConsumer(glowing, renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE));
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false, false);
model.setAngles(context.getModel());
model.setVisible(entity.getMainArm());