diff --git a/src/main/java/ru/bclib/api/ModIntegrationAPI.java b/src/main/java/ru/bclib/api/ModIntegrationAPI.java index 5c6b186c..b36eec68 100644 --- a/src/main/java/ru/bclib/api/ModIntegrationAPI.java +++ b/src/main/java/ru/bclib/api/ModIntegrationAPI.java @@ -1,12 +1,14 @@ package ru.bclib.api; import com.google.common.collect.Lists; +import net.fabricmc.loader.api.FabricLoader; import ru.bclib.integration.ModIntegration; import java.util.List; public class ModIntegrationAPI { private static final List INTEGRATIONS = Lists.newArrayList(); + private static final boolean HAS_CANVAS = FabricLoader.getInstance().isModLoaded("canvas"); /** * Registers mod integration @@ -38,4 +40,8 @@ public class ModIntegrationAPI { } }); } + + public static boolean hasCanvas() { + return HAS_CANVAS; + } } diff --git a/src/main/java/ru/bclib/api/dataexchange/handler/HelloServer.java b/src/main/java/ru/bclib/api/dataexchange/handler/HelloServer.java index 481139d5..9fd59839 100644 --- a/src/main/java/ru/bclib/api/dataexchange/handler/HelloServer.java +++ b/src/main/java/ru/bclib/api/dataexchange/handler/HelloServer.java @@ -1,11 +1,13 @@ package ru.bclib.api.dataexchange.handler; import net.fabricmc.fabric.api.networking.v1.PacketSender; -import net.minecraft.client.Minecraft; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.ModContainer; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import ru.bclib.BCLib; +import ru.bclib.api.dataexchange.DataExchangeAPI; import ru.bclib.api.dataexchange.DataHandler; import ru.bclib.api.dataexchange.DataHandlerDescriptor; import ru.bclib.api.datafixer.DataFixerAPI; diff --git a/src/main/java/ru/bclib/client/BCLibClient.java b/src/main/java/ru/bclib/client/BCLibClient.java index ff803130..55f7c945 100644 --- a/src/main/java/ru/bclib/client/BCLibClient.java +++ b/src/main/java/ru/bclib/client/BCLibClient.java @@ -12,7 +12,6 @@ public class BCLibClient implements ClientModInitializer { ModIntegrationAPI.registerAll(); BaseBlockEntityRenders.register(); DataExchangeAPI.prepareClientside(); - PostInitAPI.postInit(true); } } diff --git a/src/main/java/ru/bclib/client/models/CustomModelData.java b/src/main/java/ru/bclib/client/models/CustomModelData.java new file mode 100644 index 00000000..0fcf50f9 --- /dev/null +++ b/src/main/java/ru/bclib/client/models/CustomModelData.java @@ -0,0 +1,23 @@ +package ru.bclib.client.models; + +import com.google.common.collect.Sets; +import net.minecraft.resources.ResourceLocation; + +import java.util.Set; + +public class CustomModelData { + private static final Set TRANSPARENT_EMISSION = Sets.newConcurrentHashSet(); + + public static void clear() { + TRANSPARENT_EMISSION.clear(); + } + + public static void addTransparent(ResourceLocation blockID) { + TRANSPARENT_EMISSION.add(blockID); + } + + public static boolean isTransparentEmissive(ResourceLocation rawLocation) { + String name = rawLocation.getPath().replace("materialmaps/block/", "").replace(".json", ""); + return TRANSPARENT_EMISSION.contains(new ResourceLocation(rawLocation.getNamespace(), name)); + } +} diff --git a/src/main/java/ru/bclib/client/models/PatternsHelper.java b/src/main/java/ru/bclib/client/models/PatternsHelper.java index ace06642..c6e7348d 100644 --- a/src/main/java/ru/bclib/client/models/PatternsHelper.java +++ b/src/main/java/ru/bclib/client/models/PatternsHelper.java @@ -14,6 +14,8 @@ import java.util.Optional; import java.util.stream.Collectors; public class PatternsHelper { + private static final Map JSON_CACHE = Maps.newConcurrentMap(); + public static Optional createItemGenerated(ResourceLocation itemId) { return createJson(BasePatterns.ITEM_GENERATED, itemId); } @@ -52,8 +54,11 @@ public class PatternsHelper { public static Optional createJson(ResourceLocation patternId, Map textures) { ResourceManager resourceManager = Minecraft.getInstance().getResourceManager(); try (InputStream input = resourceManager.getResource(patternId).getInputStream()) { - String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines() - .collect(Collectors.joining()); + String json = JSON_CACHE.get(patternId); + if (json == null) { + json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining()); + JSON_CACHE.put(patternId, json); + } for (Map.Entry texture : textures.entrySet()) { json = json.replace(texture.getKey(), texture.getValue()); } diff --git a/src/main/java/ru/bclib/client/render/EmissiveTextureInfo.java b/src/main/java/ru/bclib/client/render/EmissiveTextureInfo.java new file mode 100644 index 00000000..0623a9df --- /dev/null +++ b/src/main/java/ru/bclib/client/render/EmissiveTextureInfo.java @@ -0,0 +1,32 @@ +package ru.bclib.client.render; + +import com.google.common.collect.Sets; +import net.minecraft.resources.ResourceLocation; + +import java.util.Set; + +public class EmissiveTextureInfo { + private static final Set EMISSIVE_TEXTURES = Sets.newHashSet(); + private static final Set EMISSIVE_BLOCKS = Sets.newHashSet(); + + public static void clear() { + EMISSIVE_TEXTURES.clear(); + EMISSIVE_BLOCKS.clear(); + } + + public static void addTexture(ResourceLocation texture) { + EMISSIVE_TEXTURES.add(texture); + } + + public static void addBlock(ResourceLocation blockID) { + EMISSIVE_BLOCKS.add(blockID); + } + + public static boolean isEmissiveTexture(ResourceLocation texture) { + return EMISSIVE_TEXTURES.contains(texture); + } + + public static boolean isEmissiveBlock(ResourceLocation blockID) { + return EMISSIVE_BLOCKS.contains(blockID); + } +} diff --git a/src/main/java/ru/bclib/interfaces/BlockModelProvider.java b/src/main/java/ru/bclib/interfaces/BlockModelProvider.java index 3b6f0f71..fda0f101 100644 --- a/src/main/java/ru/bclib/interfaces/BlockModelProvider.java +++ b/src/main/java/ru/bclib/interfaces/BlockModelProvider.java @@ -1,6 +1,5 @@ package ru.bclib.interfaces; -import com.google.common.collect.Maps; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.model.BlockModel; @@ -15,8 +14,6 @@ import ru.bclib.client.models.PatternsHelper; import java.util.Map; import java.util.Optional; -import static net.minecraft.client.resources.model.ModelBakery.MISSING_MODEL_LOCATION; - public interface BlockModelProvider extends ItemModelProvider { @Environment(EnvType.CLIENT) default @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) { diff --git a/src/main/java/ru/bclib/mixin/client/ModelBakeryMixin.java b/src/main/java/ru/bclib/mixin/client/ModelBakeryMixin.java index 70b6f824..6b97d8ff 100644 --- a/src/main/java/ru/bclib/mixin/client/ModelBakeryMixin.java +++ b/src/main/java/ru/bclib/mixin/client/ModelBakeryMixin.java @@ -2,9 +2,13 @@ package ru.bclib.mixin.client; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.mojang.datafixers.util.Pair; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.renderer.block.BlockModelShaper; import net.minecraft.client.renderer.block.model.BlockModel; +import net.minecraft.client.renderer.block.model.multipart.MultiPart; +import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.UnbakedModel; @@ -13,6 +17,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -21,9 +26,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import ru.bclib.api.ModIntegrationAPI; +import ru.bclib.client.render.EmissiveTextureInfo; import ru.bclib.interfaces.BlockModelProvider; import ru.bclib.interfaces.ItemModelProvider; +import java.util.Collection; +import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -58,24 +67,25 @@ public abstract class ModelBakeryMixin { BlockModelProvider provider = (BlockModelProvider) block; if (!resourceManager.hasResource(storageID)) { - BlockState defaultState = block.defaultBlockState(); - ResourceLocation defaultStateID = BlockModelShaper.stateToModelLocation(blockID, defaultState); - - UnbakedModel defaultModel = provider.getModelVariant(defaultStateID, defaultState, cache); - cache.put(blockID, defaultModel); - topLevel.put(blockID, defaultModel); - ImmutableList states = block.getStateDefinition().getPossibleStates(); - if (states.size() == 1) { - ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, block.defaultBlockState()); - cache.put(stateID, defaultModel); - topLevel.put(stateID, defaultModel); + BlockState defaultState = block.defaultBlockState(); + + ResourceLocation defaultStateID = BlockModelShaper.stateToModelLocation(blockID, defaultState); + UnbakedModel defaultModel = provider.getModelVariant(defaultStateID, defaultState, cache); + + if (defaultModel instanceof MultiPart) { + states.forEach(blockState -> { + ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, blockState); + topLevel.put(stateID, defaultModel); + cache.put(stateID, defaultModel); + }); } else { states.forEach(blockState -> { ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, blockState); - BlockModel model = provider.getBlockModel(stateID, blockState); - cache.put(stateID, model != null ? model : defaultModel); + UnbakedModel model = stateID.equals(defaultStateID) ? defaultModel : provider.getModelVariant(stateID, blockState, cache); + topLevel.put(stateID, model); + cache.put(stateID, model); }); } } @@ -85,8 +95,8 @@ public abstract class ModelBakeryMixin { if (!resourceManager.hasResource(storageID)) { ResourceLocation itemID = new ModelResourceLocation(blockID.getNamespace(), blockID.getPath(), "inventory"); BlockModel model = provider.getItemModel(itemID); - cache.put(itemID, model); topLevel.put(itemID, model); + cache.put(itemID, model); } } }); @@ -98,8 +108,8 @@ public abstract class ModelBakeryMixin { ResourceLocation itemID = new ModelResourceLocation(registryID.getNamespace(), registryID.getPath(), "inventory"); ItemModelProvider provider = (ItemModelProvider) item; BlockModel model = provider.getItemModel(registryID); - cache.put(itemID, model); topLevel.put(itemID, model); + cache.put(itemID, model); } }); @@ -110,4 +120,44 @@ public abstract class ModelBakeryMixin { topLevelModels.putAll(topLevel); unbakedCache.putAll(cache); } + + @Inject(method = "*", at = @At("TAIL")) + private void bclib_findEmissiveModels(ResourceManager resourceManager, BlockColors blockColors, ProfilerFiller profiler, int mipmap, CallbackInfo info) { + if (!ModIntegrationAPI.hasCanvas()) { + return; + } + + Map cacheCopy = new HashMap<>(unbakedCache); + Set> strings = Sets.newConcurrentHashSet(); + Registry.BLOCK.keySet().forEach(blockID -> { + Block block = Registry.BLOCK.get(blockID); + ImmutableList states = block.getStateDefinition().getPossibleStates(); + boolean addBlock = false; + + for (BlockState state: states) { + ResourceLocation stateID = BlockModelShaper.stateToModelLocation(blockID, state); + UnbakedModel model = cacheCopy.get(stateID); + if (model == null) { + continue; + } + Collection materials = model.getMaterials(cacheCopy::get, strings); + if (materials == null) { + continue; + } + for (Material material: materials) { + if (EmissiveTextureInfo.isEmissiveTexture(material.texture())) { + addBlock = true; + break; + } + } + if (addBlock) { + break; + } + } + + if (addBlock) { + EmissiveTextureInfo.addBlock(blockID); + } + }); + } } diff --git a/src/main/java/ru/bclib/mixin/client/SimpleReloadableResourceManagerMixin.java b/src/main/java/ru/bclib/mixin/client/SimpleReloadableResourceManagerMixin.java new file mode 100644 index 00000000..c661a6c7 --- /dev/null +++ b/src/main/java/ru/bclib/mixin/client/SimpleReloadableResourceManagerMixin.java @@ -0,0 +1,58 @@ +package ru.bclib.mixin.client; + +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.resources.FallbackResourceManager; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.SimpleReloadableResourceManager; +import net.minecraft.server.packs.resources.SimpleResource; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import ru.bclib.BCLib; +import ru.bclib.api.ModIntegrationAPI; +import ru.bclib.client.render.EmissiveTextureInfo; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +@Mixin(SimpleReloadableResourceManager.class) +public class SimpleReloadableResourceManagerMixin { + @Final + @Shadow + private Map namespacedPacks; + + private ResourceLocation bclib_alphaEmissionMaterial = BCLib.makeID("materialmaps/block/alpha_emission.json"); + + @Inject(method = "getResource", at = @At("HEAD"), cancellable = true) + private void bclib_getResource(ResourceLocation resourceLocation, CallbackInfoReturnable info) throws IOException { + if (!ModIntegrationAPI.hasCanvas()) { + return; + } + if (!resourceLocation.getPath().startsWith("materialmaps")) { + return; + } + if (!resourceLocation.getPath().contains("/block/")) { + return; + } + + String name = resourceLocation.getPath().replace("materialmaps/block/", "").replace(".json", ""); + ResourceLocation blockID = new ResourceLocation(resourceLocation.getNamespace(), name); + + if (!EmissiveTextureInfo.isEmissiveBlock(blockID)) { + return; + } + + ResourceManager resourceManager = this.namespacedPacks.get(resourceLocation.getNamespace()); + if (resourceManager != null && !resourceManager.hasResource(resourceLocation)) { + info.setReturnValue(resourceManager.getResource(bclib_alphaEmissionMaterial)); + } + } +} diff --git a/src/main/java/ru/bclib/mixin/client/TextureAtlasMixin.java b/src/main/java/ru/bclib/mixin/client/TextureAtlasMixin.java index bdf3204a..2b2bbff2 100644 --- a/src/main/java/ru/bclib/mixin/client/TextureAtlasMixin.java +++ b/src/main/java/ru/bclib/mixin/client/TextureAtlasMixin.java @@ -14,18 +14,22 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import ru.bclib.BCLib; +import ru.bclib.client.render.EmissiveTextureInfo; import java.io.IOException; @Mixin(TextureAtlas.class) public class TextureAtlasMixin { - private static final int EMISSIVE_ALPHA = 253 << 24; + private static final int EMISSIVE_ALPHA = 254 << 24; private boolean bclib_modifyAtlas; @Inject(method = "*", at = @At("TAIL")) private void bclib_onAtlasInit(ResourceLocation resourceLocation, CallbackInfo info) { boolean hasOptifine = FabricLoader.getInstance().isModLoaded("optifabric"); bclib_modifyAtlas = !hasOptifine && resourceLocation.toString().equals("minecraft:textures/atlas/blocks.png"); + if (bclib_modifyAtlas) { + EmissiveTextureInfo.clear(); + } } @Inject(method = "load(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$Info;IIIII)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;", at = @At("HEAD"), cancellable = true) @@ -91,6 +95,7 @@ public class TextureAtlasMixin { posY, sprite ); + EmissiveTextureInfo.addTexture(location); info.setReturnValue(result); } } diff --git a/src/main/java/ru/bclib/registry/BaseBlockEntities.java b/src/main/java/ru/bclib/registry/BaseBlockEntities.java index b369eda1..4c90e226 100644 --- a/src/main/java/ru/bclib/registry/BaseBlockEntities.java +++ b/src/main/java/ru/bclib/registry/BaseBlockEntities.java @@ -2,7 +2,6 @@ package ru.bclib.registry; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import ru.bclib.BCLib; diff --git a/src/main/java/ru/bclib/server/BCLibServer.java b/src/main/java/ru/bclib/server/BCLibServer.java index d4011c97..e76b1147 100644 --- a/src/main/java/ru/bclib/server/BCLibServer.java +++ b/src/main/java/ru/bclib/server/BCLibServer.java @@ -3,7 +3,7 @@ package ru.bclib.server; import net.fabricmc.api.DedicatedServerModInitializer; import ru.bclib.api.ModIntegrationAPI; import ru.bclib.api.PostInitAPI; -import ru.bclib.api.dataexchange.*; +import ru.bclib.api.dataexchange.DataExchangeAPI; public class BCLibServer implements DedicatedServerModInitializer { @Override diff --git a/src/main/resources/assets/bclib/materialmaps/block/alpha_emission.json b/src/main/resources/assets/bclib/materialmaps/block/alpha_emission.json new file mode 100644 index 00000000..ae85105c --- /dev/null +++ b/src/main/resources/assets/bclib/materialmaps/block/alpha_emission.json @@ -0,0 +1,3 @@ +{ + "defaultMaterial": "bclib:alpha_emission" +} diff --git a/src/main/resources/assets/bclib/materials/alpha_emission.json b/src/main/resources/assets/bclib/materials/alpha_emission.json new file mode 100644 index 00000000..914848b1 --- /dev/null +++ b/src/main/resources/assets/bclib/materials/alpha_emission.json @@ -0,0 +1,8 @@ +{ + "layers": [ + { + "vertexSource": "canvas:shaders/material/default.vert", + "fragmentSource": "bclib:shaders/material/alpha_emission.frag" + } + ] +} diff --git a/src/main/resources/assets/bclib/shaders/material/alpha_emission.frag b/src/main/resources/assets/bclib/shaders/material/alpha_emission.frag new file mode 100644 index 00000000..32ae9482 --- /dev/null +++ b/src/main/resources/assets/bclib/shaders/material/alpha_emission.frag @@ -0,0 +1,14 @@ +#include frex:shaders/api/fragment.glsl +#include frex:shaders/lib/math.glsl + +// Value near 254 +bool isEmissive(float alpha) { + return 0.9960 < alpha && alpha < 0.9962; +} + +void frx_startFragment(inout frx_FragmentData fragData) { + if (isEmissive(fragData.spriteColor.a)) { + fragData.emissivity = 1.0; + fragData.spriteColor.a = 1.0; + } +} diff --git a/src/main/resources/assets/minecraft/shaders/core/rendertype_cutout.fsh b/src/main/resources/assets/minecraft/shaders/core/rendertype_cutout.fsh index 46538f7e..c14819e8 100644 --- a/src/main/resources/assets/minecraft/shaders/core/rendertype_cutout.fsh +++ b/src/main/resources/assets/minecraft/shaders/core/rendertype_cutout.fsh @@ -11,6 +11,7 @@ uniform vec4 FogColor; in float vertexDistance; in vec4 vertexColor; in vec2 texCoord0; +in vec4 normal; out vec4 fragColor; @@ -29,9 +30,9 @@ vec3 hsvToRGB(vec3 color) { return color.z * mix(k.xxx, clamp(p - k.xxx, 0.0, 1.0), color.y); } -// Value between 252 and 254 +// Value near 254 bool isEmissive(float alpha) { - return 0.9883 < alpha && alpha < 0.9961; + return 0.9960 < alpha && alpha < 0.9962; } void main() { diff --git a/src/main/resources/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh b/src/main/resources/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh index 7fe88bc4..3e3e352f 100644 --- a/src/main/resources/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh +++ b/src/main/resources/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh @@ -9,10 +9,11 @@ uniform float FogEnd; uniform vec4 FogColor; in float vertexDistance; +in vec4 vertexColor; in vec4 lightMapColor; in vec4 overlayColor; -in vec4 vertexColor; in vec2 texCoord0; +in vec4 normal; out vec4 fragColor; @@ -31,9 +32,9 @@ vec3 hsvToRGB(vec3 color) { return color.z * mix(k.xxx, clamp(p - k.xxx, 0.0, 1.0), color.y); } -// Value between 252 and 254 +// Value near 254 bool isEmissive(float alpha) { - return 0.9883 < alpha && alpha < 0.9961; + return 0.9960 < alpha && alpha < 0.9962; } void main() { diff --git a/src/main/resources/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh b/src/main/resources/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh index 0897b74f..453e467f 100644 --- a/src/main/resources/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh +++ b/src/main/resources/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh @@ -11,7 +11,8 @@ uniform vec4 FogColor; in float vertexDistance; in vec4 vertexColor; in vec2 texCoord0; -in vec4 overlayColor; +in vec2 texCoord1; +in vec4 normal; out vec4 fragColor; @@ -30,9 +31,9 @@ vec3 hsvToRGB(vec3 color) { return color.z * mix(k.xxx, clamp(p - k.xxx, 0.0, 1.0), color.y); } -// Value between 252 and 254 +// Value near 254 bool isEmissive(float alpha) { - return 0.9883 < alpha && alpha < 0.9961; + return 0.9960 < alpha && alpha < 0.9962; } void main() { @@ -41,7 +42,6 @@ void main() { discard; } vec4 color = tex * ColorModulator; - color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a); vec4 vertex = vertexColor; if (isEmissive(tex.a)) { vec3 hsv = rgbToHSV(vertex.rgb); diff --git a/src/main/resources/assets/minecraft/shaders/core/rendertype_solid.fsh b/src/main/resources/assets/minecraft/shaders/core/rendertype_solid.fsh index cbe64a51..95c1a52f 100644 --- a/src/main/resources/assets/minecraft/shaders/core/rendertype_solid.fsh +++ b/src/main/resources/assets/minecraft/shaders/core/rendertype_solid.fsh @@ -11,6 +11,7 @@ uniform vec4 FogColor; in float vertexDistance; in vec4 vertexColor; in vec2 texCoord0; +in vec4 normal; out vec4 fragColor; @@ -29,9 +30,9 @@ vec3 hsvToRGB(vec3 color) { return color.z * mix(k.xxx, clamp(p - k.xxx, 0.0, 1.0), color.y); } -// Value between 252 and 254 +// Value near 254 bool isEmissive(float alpha) { - return 0.9883 < alpha && alpha < 0.9961; + return 0.9960 < alpha && alpha < 0.9962; } void main() { diff --git a/src/main/resources/bclib.mixins.client.json b/src/main/resources/bclib.mixins.client.json index 037950d3..0dd5cef2 100644 --- a/src/main/resources/bclib.mixins.client.json +++ b/src/main/resources/bclib.mixins.client.json @@ -4,6 +4,7 @@ "package": "ru.bclib.mixin.client", "compatibilityLevel": "JAVA_16", "client": [ + "SimpleReloadableResourceManagerMixin", "EnchantingTableBlockMixin", "BackgroundRendererMixin", "GameMixin",