mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-16 05:55:09 +01:00
VisualOverhaul 5.0.0 - The Iconic Update
- Port to 1.19.4 - Use Architectury -> Forge & native Quilt support! - New Feature: Icon Buttons! - Makes buttons look less bland by adding icons to them - Loaded from resourcepacks - Currently uses vanilla items as icons - Organize config screen in tabs
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
architectury {
|
||||
injectInjectables = false
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import eu.midnightdust.visualoverhaul.mixin.TextureManagerAccessor;
|
||||
import eu.midnightdust.visualoverhaul.util.ModIconUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.texture.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class IconicButtons extends DrawableHelper {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
private String buttonId;
|
||||
private Text prevText;
|
||||
private Identifier iconId;
|
||||
public IconicButtons(ClickableWidget widget) {
|
||||
init(widget);
|
||||
}
|
||||
public void init(ClickableWidget widget) {
|
||||
prevText = widget.getMessage();
|
||||
buttonId = (widget.getMessage().getContent() instanceof TranslatableTextContent translatableTextContent) ? translatableTextContent.getKey().toLowerCase() : "";
|
||||
if (VOConfig.buttonIcons && !buttonId.equals("")) {
|
||||
if (VOConfig.debug) System.out.println(buttonId);
|
||||
iconId = new Identifier("iconic", "textures/gui/icons/" + buttonId.toLowerCase()+".png");
|
||||
if (buttonId.endsWith(".midnightconfig.title"))
|
||||
{
|
||||
iconId = new Identifier("modid", buttonId.replace(".midnightconfig.title", "") + "_icon");
|
||||
NativeImageBackedTexture icon = new ModIconUtil(buttonId.replace(".midnightconfig.title", "")).createModIcon();
|
||||
if (icon != null) {
|
||||
client.getTextureManager().registerTexture(iconId, icon);
|
||||
} else {
|
||||
iconId = null;
|
||||
}
|
||||
}
|
||||
if (iconId == null) return;
|
||||
TextureManager textureManager = client.getTextureManager();
|
||||
AbstractTexture abstractTexture = textureManager.getOrDefault(iconId, null);
|
||||
if (abstractTexture == null) {
|
||||
abstractTexture = new ResourceTexture(iconId);
|
||||
try { abstractTexture.load(((TextureManagerAccessor)textureManager).getResourceContainer());
|
||||
} catch (Exception e) {iconId = null; return;}
|
||||
textureManager.registerTexture(iconId, abstractTexture);
|
||||
}
|
||||
if (abstractTexture == MissingSprite.getMissingSpriteTexture()) iconId = null;
|
||||
}
|
||||
}
|
||||
public void renderIcons(MatrixStack matrices, ClickableWidget widget, float alpha) {
|
||||
if (widget.getMessage() == null) return;
|
||||
if (prevText != widget.getMessage()) init(widget);
|
||||
if (VOConfig.buttonIcons && !buttonId.equals("") && iconId != null) {
|
||||
int scaledWidth = client.getWindow().getScaledWidth();
|
||||
|
||||
boolean limitedSpace = client.textRenderer.getWidth(widget.getMessage()) > (widget.getWidth() * 0.75f);
|
||||
boolean showLeftWhenBoth = (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.BOTH) && !limitedSpace) || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.BOTH) && widget.getX() < scaledWidth/2);
|
||||
boolean showRightWhenBoth = (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.BOTH) && !limitedSpace) || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.BOTH) && widget.getX() > scaledWidth/2);
|
||||
|
||||
RenderSystem.setShaderTexture(0, iconId);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, alpha);
|
||||
if (!widget.active) RenderSystem.setShaderColor(0.3F, 0.3F, 0.3F, alpha);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
int inset = 2;
|
||||
if (VOConfig.zoomIconOnHover && widget.isSelected()) inset = 1;
|
||||
int size = 20-inset*2;
|
||||
|
||||
if (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LEFT) || showLeftWhenBoth || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LOCATION) && widget.getX() < scaledWidth/2))
|
||||
drawTexture(matrices, widget.getX()+inset, widget.getY()+inset, 0, 0, size, size, size, size);
|
||||
|
||||
if (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.RIGHT) || showRightWhenBoth || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LOCATION) && widget.getX()+widget.getWidth() > scaledWidth/2))
|
||||
drawTexture(matrices, widget.getX()+widget.getWidth()-20+inset, widget.getY()+inset, 0, 0, size, size, size, size);
|
||||
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
public static void reload(ResourceManager manager) {
|
||||
manager.findResources("textures", path -> path.getPath().contains(".properties")).forEach((id, resource) -> {
|
||||
if (manager.getResource(id).isEmpty()) return;
|
||||
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
|
||||
Identifier iconId = new Identifier(id.getNamespace(), id.getPath().replace(".properties", ".png"));
|
||||
if (manager.getResource(iconId).isPresent()) return;
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.load(stream);
|
||||
while (properties.get("properties") != null) {
|
||||
Identifier propertiesId = new Identifier(properties.getProperty("properties"));
|
||||
String textureId = propertiesId.toString().replace(".properties", ".png");
|
||||
|
||||
properties.clear();
|
||||
if (manager.getResource(Identifier.tryParse(textureId)).isPresent()) { // If a texture is present at the location of the referenced properties file, use that instead
|
||||
properties.put("texture", textureId);
|
||||
}
|
||||
else if (manager.getResource(propertiesId).isPresent()) {
|
||||
properties.load(manager.getResource(propertiesId).get().getInputStream()); // Else load the referenced properties file, if present
|
||||
} else return;
|
||||
}
|
||||
|
||||
if (properties.get("texture") != null) {
|
||||
Identifier textureId = new Identifier(properties.getProperty("texture"));
|
||||
TextureManager textureManager = MinecraftClient.getInstance().getTextureManager();
|
||||
AbstractTexture abstractTexture = textureManager.getOrDefault(iconId, null);
|
||||
if (abstractTexture == null) {
|
||||
abstractTexture = new ResourceTexture(textureId);
|
||||
textureManager.registerTexture(iconId, abstractTexture);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogManager.getLogger("Iconic").error("Error occurred while loading texture.properties " + id.toString(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.color.world.BiomeColors;
|
||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||
import net.minecraft.item.MusicDiscItem;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaul.MOD_ID;
|
||||
|
||||
|
||||
@@ -9,15 +9,20 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import org.joml.AxisAngle4f;
|
||||
import org.joml.Math;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class BrewingStandBlockEntityRenderer implements BlockEntityRenderer<BrewingStandBlockEntity> {
|
||||
private static final Quaternionf degrees45 = new Quaternionf(new AxisAngle4f(Math.toRadians(45), 0, 1, 0));
|
||||
private static final Quaternionf degrees180 = new Quaternionf(new AxisAngle4f(Math.toRadians(180), 0, 1, 0));
|
||||
private static final Quaternionf degrees315 = new Quaternionf(new AxisAngle4f(Math.toRadians(315), 0, 1, 0));
|
||||
|
||||
public BrewingStandBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
}
|
||||
@@ -37,28 +42,28 @@ public class BrewingStandBlockEntityRenderer implements BlockEntityRenderer<Brew
|
||||
|
||||
matrices.translate(0.86f, 0.23f, 0.5f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
matrices.multiply(degrees180);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (!item2.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(315));
|
||||
matrices.multiply(degrees315);
|
||||
matrices.translate(0.32f, 0.23f, 0f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (!item3.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(45));
|
||||
matrices.multiply(degrees45);
|
||||
matrices.translate(-0.39f, 0.23f, 0.705f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item3, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item3, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
@@ -13,18 +13,21 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.registry.tag.ItemTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import org.joml.AxisAngle4f;
|
||||
import org.joml.Math;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> implements BlockEntityRenderer<E> {
|
||||
private static final Quaternionf degrees90x = new Quaternionf(new AxisAngle4f(Math.toRadians(90), 1, 0, 0));
|
||||
private final FurnaceWoodenPlanksModel planks;
|
||||
|
||||
public FurnaceBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
@@ -46,10 +49,10 @@ public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> im
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.SMOKER)) matrices.translate(0f, -0.06f, 0f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.BLAST_FURNACE)) matrices.translate(0f, -0.25f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, 0);
|
||||
matrices.multiply(degrees90x);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item1, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
|
||||
matrices.pop();
|
||||
@@ -61,10 +64,10 @@ public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> im
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.SMOKER)) matrices.translate(0f, 0.06f, 0f);
|
||||
if (blockEntity.getCachedState().getBlock().equals(Blocks.BLAST_FURNACE)) matrices.translate(0f, 0.24f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformation.Mode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers,0);
|
||||
matrices.multiply(degrees90x);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
@@ -80,7 +83,7 @@ public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> im
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
|
||||
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * 3 + 180));
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
planks.getPart().render(matrices, vertexConsumer, lightAtBlock, overlay);
|
||||
matrices.pop();
|
||||
}
|
||||
@@ -88,7 +91,7 @@ public class FurnaceBlockEntityRenderer<E extends AbstractFurnaceBlockEntity> im
|
||||
|
||||
}
|
||||
public static Identifier spriteToTexture(Sprite sprite) {
|
||||
String texture = sprite.getId().getPath();
|
||||
return new Identifier(sprite.getId().getNamespace(), "textures/" + texture + ".png");
|
||||
String texture = sprite.getContents().getId().getPath();
|
||||
return new Identifier(sprite.getAtlasId().getNamespace(), "textures/" + texture + ".png");
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,19 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.joml.AxisAngle4f;
|
||||
import org.joml.Math;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -41,17 +43,17 @@ public class JukeboxBlockEntityRenderer implements BlockEntityRenderer<JukeboxBl
|
||||
int lightAbove = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().up());
|
||||
|
||||
// Tries to get the disc using the serverside method
|
||||
if (blockEntity.getRecord() != ItemStack.EMPTY) {
|
||||
record = blockEntity.getRecord().copy();
|
||||
if (blockEntity.getStack() != ItemStack.EMPTY) {
|
||||
record = blockEntity.getStack().copy();
|
||||
}
|
||||
// Else gets the record sound played at the position of the jukebox //
|
||||
else if (SoundTest.getSound(blockEntity.getPos()) != null) {
|
||||
// Converts the Sound Id to the item id of the appropriate disc (minecraft:music_disc.cat -> minecraft:music_disc_cat) //
|
||||
// Converts the Sound ID to the item ID of the appropriate disc (minecraft:music_disc.cat -> minecraft:music_disc_cat) //
|
||||
discItem = new Identifier(String.valueOf(SoundTest.getSound(blockEntity.getPos())).replace(".", "_"));
|
||||
|
||||
// Tries to get the disc item from the registry //
|
||||
if (Registry.ITEM.getOrEmpty(discItem).isPresent()) {
|
||||
record = new ItemStack(Registry.ITEM.get(discItem));
|
||||
if (Registries.ITEM.getOrEmpty(discItem).isPresent()) {
|
||||
record = new ItemStack(Registries.ITEM.get(discItem));
|
||||
}
|
||||
else {
|
||||
if (VOConfig.debug) LogManager.getLogger("VisualOverhaul").warn("Error getting music disc item for " + SoundTest.getSound(blockEntity.getPos()));
|
||||
@@ -71,8 +73,8 @@ public class JukeboxBlockEntityRenderer implements BlockEntityRenderer<JukeboxBl
|
||||
|
||||
matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(Util.getMeasuringTimeMs() / 9.0f));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(Util.getMeasuringTimeMs() / 9.0f), 0, 1, 0)));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(record, ModelTransformationMode.GROUND, lightAbove, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
@@ -3,15 +3,21 @@ package eu.midnightdust.visualoverhaul.config;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
public class VOConfig extends MidnightConfig {
|
||||
@Client @Entry public static boolean brewingstand = true;
|
||||
@Client @Entry public static boolean jukebox = true;
|
||||
@Client @Entry public static boolean jukebox_fake_block = true;
|
||||
@Client @Entry public static boolean furnace = true;
|
||||
@Client @Entry public static boolean smoker_particles = true;
|
||||
@Client @Entry public static boolean blast_furnace_particles = true;
|
||||
@Client @Entry public static boolean coloredItems = true;
|
||||
@Client @Entry public static boolean coloredLilypad = true;
|
||||
@Client @Entry public static boolean potionEnchantmentGlint = true;
|
||||
@Client @Entry(name = "Debug") public static boolean debug = false;
|
||||
public static final String blocks = "blocks";
|
||||
public static final String colors = "colors";
|
||||
public static final String gui = "gui";
|
||||
@Client @Entry(category = blocks) public static boolean brewingstand = true;
|
||||
@Client @Entry(category = blocks) public static boolean jukebox = true;
|
||||
@Client @Entry(category = blocks) public static boolean jukebox_fake_block = true;
|
||||
@Client @Entry(category = blocks) public static boolean furnace = true;
|
||||
@Client @Entry(category = blocks) public static boolean smoker_particles = true;
|
||||
@Client @Entry(category = blocks) public static boolean blast_furnace_particles = true;
|
||||
@Client @Entry(category = colors) public static boolean coloredItems = true;
|
||||
@Client @Entry(category = colors) public static boolean coloredLilypad = true;
|
||||
@Client @Entry(category = gui) public static boolean buttonIcons = true;
|
||||
@Client @Entry(category = gui) public static IconPosition buttonIconPosition = IconPosition.LOCATION;
|
||||
@Client @Entry(category = gui) public static boolean zoomIconOnHover = true;
|
||||
@Client @Entry(category = gui, name = "Debug") public static boolean debug = false;
|
||||
@Client @Entry @Hidden public static boolean firstLaunch = true;
|
||||
public enum IconPosition {LOCATION, LEFT, RIGHT, BOTH}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(JukeboxBlockEntity.class)
|
||||
public interface JukeboxBlockEntityAccessor {
|
||||
@Accessor @Final
|
||||
DefaultedList<ItemStack> getInventory();
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public abstract class MixinJukeboxBlockEntity extends BlockEntity {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "getRecord")
|
||||
@Inject(at = @At("RETURN"), method = "getStack")
|
||||
public void getRecord(CallbackInfoReturnable<ItemStack> cir) {
|
||||
JukeboxPacketUpdate.invUpdate = true;
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.PotionItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(PotionItem.class)
|
||||
public abstract class MixinPotionItem extends Item {
|
||||
public MixinPotionItem(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "hasGlint", cancellable = true)
|
||||
public void vo$hasGlint(ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!VOConfig.potionEnchantmentGlint) cir.setReturnValue(super.hasGlint(stack));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.IconicButtons;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(PressableWidget.class)
|
||||
public abstract class MixinPressableWidget extends ClickableWidget {
|
||||
@Unique IconicButtons iconicButtons;
|
||||
public MixinPressableWidget(int x, int y, int width, int height, Text message) {
|
||||
super(x, y, width, height, message);
|
||||
}
|
||||
@Inject(at = @At("TAIL"), method = "<init>")
|
||||
private void iconic$onInitButton(int i, int j, int k, int l, Text text, CallbackInfo ci) {
|
||||
iconicButtons = new IconicButtons(this);
|
||||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/PressableWidget;drawMessage(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;I)V", shift = At.Shift.BEFORE), method = "renderButton")
|
||||
private void iconic$onRenderButton(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
iconicButtons.renderIcons(matrices, this, this.alpha);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.IconicButtons;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(SliderWidget.class)
|
||||
public abstract class MixinSliderWidget extends ClickableWidget {
|
||||
@Unique IconicButtons iconicButtons;
|
||||
public MixinSliderWidget(int x, int y, int width, int height, Text message) {
|
||||
super(x, y, width, height, message);
|
||||
}
|
||||
@Inject(at = @At("TAIL"), method = "<init>")
|
||||
private void iconic$onInitButton(int x, int y, int width, int height, Text text, double value, CallbackInfo ci) {
|
||||
iconicButtons = new IconicButtons(this);
|
||||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/SliderWidget;drawScrollableText(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;II)V", shift = At.Shift.BEFORE), method = "renderButton")
|
||||
private void iconic$onRenderButton(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
iconicButtons.renderIcons(matrices, this, this.alpha);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public abstract class MixinSoundSystem {
|
||||
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
|
||||
jukeboxPos = new BlockPos(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
jukeboxPos = BlockPos.ofFloored(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
SoundTest.soundPos.put(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public abstract class MixinSoundSystem {
|
||||
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
|
||||
jukeboxPos = new BlockPos(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
jukeboxPos = BlockPos.ofFloored(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
if (SoundTest.soundPos.containsKey(jukeboxPos)) {
|
||||
SoundTest.soundPos.remove(jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(TextureManager.class)
|
||||
public interface TextureManagerAccessor {
|
||||
@Accessor
|
||||
ResourceManager getResourceContainer();
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ModIconUtil {
|
||||
private static final Map<Path, NativeImageBackedTexture> modIconCache = new HashMap<>();
|
||||
private final String modid;
|
||||
|
||||
public ModIconUtil(String modid) {
|
||||
this.modid = modid;
|
||||
}
|
||||
@ExpectPlatform
|
||||
public static Path getPath(String modid) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@Unique
|
||||
public NativeImageBackedTexture createModIcon() {
|
||||
try {
|
||||
Path path = getPath(modid);
|
||||
if (VOConfig.debug) System.out.println(path);
|
||||
NativeImageBackedTexture cachedIcon = getCachedModIcon(path);
|
||||
if (cachedIcon != null) {
|
||||
return cachedIcon;
|
||||
}
|
||||
cachedIcon = getCachedModIcon(path);
|
||||
if (cachedIcon != null) {
|
||||
return cachedIcon;
|
||||
}
|
||||
try (InputStream inputStream = Files.newInputStream(path)) {
|
||||
NativeImage image = NativeImage.read(Objects.requireNonNull(inputStream));
|
||||
Validate.validState(image.getHeight() == image.getWidth(), "Must be square icon");
|
||||
NativeImageBackedTexture tex = new NativeImageBackedTexture(image);
|
||||
cacheModIcon(path, tex);
|
||||
return tex;
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
if (VOConfig.debug) System.out.println(t.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
static NativeImageBackedTexture getCachedModIcon(Path path) {
|
||||
return modIconCache.get(path);
|
||||
}
|
||||
|
||||
static void cacheModIcon(Path path, NativeImageBackedTexture tex) {
|
||||
modIconCache.put(path, tex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.done.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/written_book.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/paper.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/knowledge_book.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/modmenu.title.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/experience_bottle.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.cancel.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/coal.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/emerald.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/block/redstone_lamp.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.done.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/paper.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/block/redstone_lamp_on.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/menu.returntomenu.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/diamond_sword.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/netherite_hoe.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/command_block_minecart.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/mangrove_sign.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/barrier.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/pufferfish.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/emerald.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/blaze_powder.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/echo_shard.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/recovery_compass_18.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/iron_pickaxe.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.no.properties
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 123 B |
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.yes.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/totem_of_undying.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/axolotl_bucket.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/birch_hanging_sign.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/jungle_boat.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/name_tag.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/ender_eye.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/writable_book.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/comparator.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/painting.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/armor_stand.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/music_disc_otherside.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/nether_star.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/end_crystal.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/mojang_banner_pattern.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/slime_ball.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/selectworld.create.properties
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/selectworld.delete.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/firework_rocket.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/selectworld.edit.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/blaze_powder.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/selectworld.select.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/diamond.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/tnt_minecart.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/menu.options.properties
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.done.properties
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/furnace_minecart.png
|
||||
@@ -0,0 +1 @@
|
||||
texture=minecraft:textures/item/trident.png
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.no.properties
|
||||
@@ -0,0 +1 @@
|
||||
properties=iconic:textures/gui/icons/gui.yes.properties
|
||||
23
common/src/main/resources/assets/visualoverhaul/lang/de_de.json
Executable file
23
common/src/main/resources/assets/visualoverhaul/lang/de_de.json
Executable file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Visual Overhaul Konfiguration",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Braustand-Verbesserungen",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Jukebox-Verbesserungen",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Fake-Block auf der Jukebox",
|
||||
"visualoverhaul.midnightconfig.furnace":"Ofen-Verbesserungen",
|
||||
"visualoverhaul.midnightconfig.smoker_particles":"Räucherofen-Partikel",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles":"Schmelzofen-Partikel",
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Biom-basierte Item-Farben",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§cNeustart benötigt!",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad":"Biom-basierte Seerosenfarbe",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§cNeustart benötigt!",
|
||||
"visualoverhaul.midnightconfig.buttonIcons": "Symbole auf Knöpfen",
|
||||
"visualoverhaul.midnightconfig.buttonIconPosition": "Knopfsymbolposition",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LOCATION": "Ortsbasiert",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LEFT": "Links",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.RIGHT": "Rechts",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.BOTH": "Links & Rechts",
|
||||
"visualoverhaul.midnightconfig.zoomIconOnHover": "Vergrößere Symbol beim Überfahren",
|
||||
"visualoverhaul.midnightconfig.category.gui": "GUI",
|
||||
"visualoverhaul.midnightconfig.category.blocks": "Blöcke",
|
||||
"visualoverhaul.midnightconfig.category.colors": "Farben"
|
||||
}
|
||||
@@ -10,5 +10,14 @@
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§cNeeds restart!",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad":"Biome-based Lily Pad color",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§cNeeds restart!",
|
||||
"visualoverhaul.midnightconfig.potionEnchantmentGlint":"Potion enchantment glint"
|
||||
"visualoverhaul.midnightconfig.buttonIcons": "Button Icons",
|
||||
"visualoverhaul.midnightconfig.buttonIconPosition": "Button Icon Position",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LOCATION": "Location-dependant",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LEFT": "Left",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.RIGHT": "Right",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.BOTH": "Left & Right",
|
||||
"visualoverhaul.midnightconfig.zoomIconOnHover": "Zoom icon on hover",
|
||||
"visualoverhaul.midnightconfig.category.gui": "GUI",
|
||||
"visualoverhaul.midnightconfig.category.blocks": "Blocks",
|
||||
"visualoverhaul.midnightconfig.category.colors": "Colors"
|
||||
}
|
||||
@@ -9,6 +9,5 @@
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Couleurs des objets basées sur le biome",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§cBesoin de redémarrer !",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad":"Couleur de nénuphar basée sur le biome",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§cBesoin de redémarrer !",
|
||||
"visualoverhaul.midnightconfig.potionEnchantmentGlint":"Brillance d'enchantement de potion"
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§cBesoin de redémarrer !"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
"MixinSoundSystem",
|
||||
"MixinSmokerBlock",
|
||||
"MixinBlastFurnaceBlock",
|
||||
"MixinPotionItem"
|
||||
"MixinPressableWidget",
|
||||
"MixinSliderWidget",
|
||||
"TextureManagerAccessor",
|
||||
"JukeboxBlockEntityAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user