mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 13:37:58 +01:00
Added support for a glowing effect around glowing bracelets when canvas is installed
This commit is contained in:
parent
a566dd2075
commit
62ca1de596
4 changed files with 49 additions and 6 deletions
16
build.gradle
16
build.gradle
|
@ -22,6 +22,14 @@ minecraft {
|
|||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "dblsaiko"
|
||||
url = "https://maven.dblsaiko.net/"
|
||||
}
|
||||
maven {
|
||||
name = "Cotton"
|
||||
url = "http://server.bbkr.space:8081/artifactory/libs-release/"
|
||||
}
|
||||
maven {
|
||||
name = 'minelp'
|
||||
url = 'http://repo.minelittlepony-mod.com/maven/snapshot'
|
||||
|
@ -50,9 +58,9 @@ dependencies {
|
|||
//modApi "net.fabricmc.fabric-api:fabric-events-lifecycle-v0:0.1.0+"
|
||||
//modApi "net.fabricmc.fabric-api:fabric-resource-loader-v0:0.1.0+"
|
||||
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modApi "com.minelittlepony:MineLittlePony:${project.minelp_version}"
|
||||
modApi "com.minelittlepony:MineLittlePony:${project.minelp_version}"
|
||||
|
||||
modApi "com.minelittlepony:Kirin:${project.kirin_version}"
|
||||
include "com.minelittlepony:Kirin:${project.kirin_version}"
|
||||
|
@ -60,6 +68,10 @@ dependencies {
|
|||
modCompileOnly("io.github.prospector:modmenu:${project.modmenu_version}") {
|
||||
transitive = false
|
||||
}
|
||||
modCompileOnly("grondag:canvas-mc116:${project.canvas_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
exclude(module: "fabric-loader")
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -6,7 +6,7 @@ org.gradle.daemon=false
|
|||
minecraft_version=1.16.4
|
||||
yarn_mappings=1.16.4+build.6
|
||||
loader_version=0.10.6+build.214
|
||||
fabric_version=0.25.1+build.416-1.16
|
||||
fabric_version=0.30.0+1.16
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -18,5 +18,6 @@ org.gradle.daemon=false
|
|||
|
||||
# Dependencies
|
||||
modmenu_version=1.14.+
|
||||
canvas_version=1.0.+
|
||||
minelp_version=4.2.1-1.16.2-SNAPSHOT
|
||||
kirin_version=1.7.1-1.16.2-SNAPSHOT
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
|||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||
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;
|
||||
|
@ -59,10 +58,13 @@ public class BraceletFeatureRenderer<
|
|||
arm.render(stack, consumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE), false, false);
|
||||
boolean glowing = ((GlowableItem)item.getItem()).isGlowing(item);
|
||||
|
||||
VertexConsumer consumer = CanvasCompat.getGlowingConsumer(glowing, renderContext, RenderLayer.getArmorCutoutNoCull(TEXTURE));
|
||||
|
||||
model.setAngles(getContextModel());
|
||||
model.setVisible(entity.getMainArm());
|
||||
model.render(stack, consumer, ((GlowableItem)item.getItem()).isGlowing(item) ? 0x0F00F0 : lightUv, OverlayTexture.DEFAULT_UV, Color.r(j), Color.g(j), Color.b(j), 1);
|
||||
model.render(stack, consumer, glowing ? 0x0F00F0 : lightUv, OverlayTexture.DEFAULT_UV, Color.r(j), Color.g(j), Color.b(j), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
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.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;
|
||||
|
||||
final class CanvasCompat {
|
||||
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);
|
||||
}
|
||||
|
||||
if (!(renderContext instanceof FrexVertexConsumerProvider)) {
|
||||
return ItemRenderer.getArmorGlintConsumer(renderContext, layer, false, false);
|
||||
}
|
||||
|
||||
return ((FrexVertexConsumerProvider)renderContext).getConsumer(MaterialFinderImpl.threadLocal()
|
||||
.copyFrom(RenderLayerHelper.copyFromLayer(layer))
|
||||
.emissive(true)
|
||||
.find());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue