Merge branch 'main' into feature/networking
This commit is contained in:
commit
433aa7a1c7
20 changed files with 241 additions and 36 deletions
|
@ -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<ModIntegration> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -12,7 +12,6 @@ public class BCLibClient implements ClientModInitializer {
|
|||
ModIntegrationAPI.registerAll();
|
||||
BaseBlockEntityRenders.register();
|
||||
DataExchangeAPI.prepareClientside();
|
||||
|
||||
PostInitAPI.postInit(true);
|
||||
}
|
||||
}
|
||||
|
|
23
src/main/java/ru/bclib/client/models/CustomModelData.java
Normal file
23
src/main/java/ru/bclib/client/models/CustomModelData.java
Normal file
|
@ -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<ResourceLocation> 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));
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@ import java.util.Optional;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
public class PatternsHelper {
|
||||
private static final Map<ResourceLocation, String> JSON_CACHE = Maps.newConcurrentMap();
|
||||
|
||||
public static Optional<String> createItemGenerated(ResourceLocation itemId) {
|
||||
return createJson(BasePatterns.ITEM_GENERATED, itemId);
|
||||
}
|
||||
|
@ -52,8 +54,11 @@ public class PatternsHelper {
|
|||
public static Optional<String> createJson(ResourceLocation patternId, Map<String, String> 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<String, String> texture : textures.entrySet()) {
|
||||
json = json.replace(texture.getKey(), texture.getValue());
|
||||
}
|
||||
|
|
|
@ -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<ResourceLocation> EMISSIVE_TEXTURES = Sets.newHashSet();
|
||||
private static final Set<ResourceLocation> 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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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<BlockState> 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 = "<init>*", at = @At("TAIL"))
|
||||
private void bclib_findEmissiveModels(ResourceManager resourceManager, BlockColors blockColors, ProfilerFiller profiler, int mipmap, CallbackInfo info) {
|
||||
if (!ModIntegrationAPI.hasCanvas()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<ResourceLocation, UnbakedModel> cacheCopy = new HashMap<>(unbakedCache);
|
||||
Set<Pair<String, String>> strings = Sets.newConcurrentHashSet();
|
||||
Registry.BLOCK.keySet().forEach(blockID -> {
|
||||
Block block = Registry.BLOCK.get(blockID);
|
||||
ImmutableList<BlockState> 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<Material> 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, FallbackResourceManager> 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<Resource> 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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 = "<init>*", 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"defaultMaterial": "bclib:alpha_emission"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"layers": [
|
||||
{
|
||||
"vertexSource": "canvas:shaders/material/default.vert",
|
||||
"fragmentSource": "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;
|
||||
}
|
||||
}
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"package": "ru.bclib.mixin.client",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"SimpleReloadableResourceManagerMixin",
|
||||
"EnchantingTableBlockMixin",
|
||||
"BackgroundRendererMixin",
|
||||
"GameMixin",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue