mirror of
https://github.com/TeamMidnightDust/VisualOverhaul.git
synced 2025-12-15 13:45:09 +01:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f583f515f4 | ||
|
|
8b920a4b1a | ||
|
|
3406380d90 | ||
|
|
f78ba317a8 | ||
|
|
4c78e266fd | ||
|
|
18d1f5af76 | ||
|
|
132d05a1d2 | ||
|
|
1ae9580315 | ||
|
|
9dd620515c | ||
|
|
821d5bd87c | ||
|
|
d95a18b28b | ||
|
|
3307ba337e | ||
|
|
0a905a79d1 | ||
|
|
16f558644c | ||
|
|
7f1aaa3113 | ||
|
|
27be58d6de | ||
|
|
80af118f78 | ||
|
|
51c354c533 | ||
|
|
cd9db8c8bc | ||
|
|
f1d4e36ed9 | ||
|
|
5237106a48 | ||
|
|
680d2a3a8b | ||
|
|
ca9b7a0357 | ||
|
|
65a3cfbc5d | ||
|
|
e9539ba28f | ||
|
|
c6ccdb0d95 | ||
|
|
363a9ab634 | ||
|
|
801d46d9d2 | ||
|
|
08324fbfb6 | ||
|
|
94c6929099 | ||
|
|
2eb56f0d95 | ||
|
|
478bad8d38 | ||
|
|
258cc3c64e | ||
|
|
7fb093de15 | ||
|
|
37e5789081 | ||
|
|
01f894a184 | ||
|
|
775d3bd6b2 | ||
|
|
042c68d81e | ||
|
|
eb778de237 | ||
|
|
2fb840a19d | ||
|
|
316caf8a95 | ||
|
|
1bcba33aaa | ||
|
|
88e5c38337 | ||
|
|
98dee343e1 | ||
|
|
8f51167982 |
33
.gitignore
vendored
33
.gitignore
vendored
@@ -1,25 +1,20 @@
|
||||
# gradle
|
||||
|
||||
.gradle/
|
||||
out/
|
||||
classes/
|
||||
build/
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
run/
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
out/
|
||||
*.iml
|
||||
.gradle/
|
||||
output/
|
||||
bin/
|
||||
libs/
|
||||
.architectury-transformer/
|
||||
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# fabric
|
||||
|
||||
run/
|
||||
.idea/
|
||||
classes/
|
||||
.metadata
|
||||
.vscode
|
||||
.settings
|
||||
*.launch
|
||||
2
README.md
Normal file → Executable file
2
README.md
Normal file → Executable file
@@ -1,2 +1,4 @@
|
||||
# VisualOverhaul
|
||||
https://www.curseforge.com/minecraft/mc-mods/visual-overhaul
|
||||
|
||||
Revamps the visual aspect of certain vanilla blocks.
|
||||
|
||||
131
build.gradle
131
build.gradle
@@ -1,84 +1,75 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
minecraft {
|
||||
architectury {
|
||||
minecraft = rootProject.minecraft_version
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
subprojects {
|
||||
apply plugin: 'dev.architectury.loom'
|
||||
apply plugin: 'architectury-plugin'
|
||||
|
||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}") {
|
||||
exclude group: "net.fabricmc.fabric-api"
|
||||
}
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
// The following line declares the mojmap mappings, you may use other mappings as well
|
||||
//mappings loom.officialMojangMappings()
|
||||
// The following line declares the yarn mappings you may select this one as well.
|
||||
mappings loom.layered {
|
||||
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
|
||||
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include "fabric.mod.json"
|
||||
expand "version": project.version
|
||||
}
|
||||
allprojects {
|
||||
apply plugin: "java"
|
||||
apply plugin: "architectury-plugin"
|
||||
apply plugin: "maven-publish"
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude "fabric.mod.json"
|
||||
}
|
||||
}
|
||||
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this task, sources will not be generated.
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = "sources"
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// add all the jars that should be included when publishing to maven
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// select the repositories you want to publish to
|
||||
repositories {
|
||||
// uncomment to publish to the local maven
|
||||
// mavenLocal()
|
||||
}
|
||||
archivesBaseName = rootProject.archives_base_name
|
||||
version = rootProject.mod_version
|
||||
group = rootProject.maven_group
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
// You should only use this when depending on other mods because
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 21
|
||||
}
|
||||
ext {
|
||||
releaseChangelog = {
|
||||
def changes = new StringBuilder()
|
||||
changes << "## VisualOverhaul v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/VisualOverhaul/commits/)"
|
||||
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
||||
proc.in.eachLine { line ->
|
||||
def processedLine = line.toString()
|
||||
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
||||
changes << "\n- ${processedLine.capitalize()}"
|
||||
}
|
||||
}
|
||||
proc.waitFor()
|
||||
return changes.toString()
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
|
||||
19
common/build.gradle
Normal file
19
common/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
||||
architectury {
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
|
||||
loom {
|
||||
}
|
||||
repositories {
|
||||
maven { url "https://api.modrinth.com/maven" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||
// Do NOT use other classes from fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
||||
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
//modApi "dev.architectury:architectury:${rootProject.architectury_version}"
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.model.ModelNameSupplier;
|
||||
import net.minecraft.client.model.SpriteGetter;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.block.BlockRenderManager;
|
||||
import net.minecraft.client.render.model.*;
|
||||
import net.minecraft.client.render.model.json.JsonUnbakedModel;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.LOGGER;
|
||||
|
||||
public class FakeBlocks {
|
||||
private static final Baker BAKER = new FakeBaker();
|
||||
private static final Map<Identifier, BakedModel> FAKE_MODELS = new HashMap<>();
|
||||
private static final BlockRenderManager renderManager = MinecraftClient.getInstance().getBlockRenderManager();
|
||||
|
||||
public static void reload(ResourceManager manager) {
|
||||
manager.findResources("models", path -> path.getPath().startsWith("models/fakeblock") && path.getPath().endsWith(".json")).forEach((id, resource) -> {
|
||||
try {
|
||||
JsonUnbakedModel unbaked = JsonUnbakedModel.deserialize(resource.getReader());
|
||||
BakedModel baked = unbaked.bake(new ModelTextures.Builder().addFirst(unbaked.getTextures()).build(() -> "#fakeblock"), BAKER,
|
||||
new ModelBakeSettings(){}, Boolean.TRUE.equals(unbaked.getAmbientOcclusion()), unbaked.getGuiLight() != null && unbaked.getGuiLight().isSide(), unbaked.getTransformation());
|
||||
Identifier fakeId = Identifier.of(id.getNamespace(), id.getPath().replace("models/fakeblock/", "").replace(".json", ""));
|
||||
FAKE_MODELS.put(fakeId, baked);
|
||||
if (VOConfig.debug) LOGGER.info("Successfully loaded fake block model: {}", fakeId);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Error occurred while loading fake block model {}", id.toString(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void renderFakeBlock(Identifier id, BlockPos pos, BlockRenderView world, MatrixStack matrices, VertexConsumer vertexConsumer) {
|
||||
renderManager.getModelRenderer().render(world, FAKE_MODELS.get(id), Blocks.DIRT.getDefaultState(), // State is just needed for a few generic checks
|
||||
pos, matrices, vertexConsumer, false, Random.create(), 0, OverlayTexture.DEFAULT_UV);
|
||||
}
|
||||
|
||||
public static class FakeBaker implements Baker {
|
||||
public BakedModel bake(Identifier id, ModelBakeSettings settings) {
|
||||
return null; // Not used in Json models, so we just leave ít like this and cross our fingers.
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpriteGetter getSpriteGetter() {
|
||||
return new SpriteGetter() {
|
||||
static final SpriteIdentifier MISSING = new SpriteIdentifier(Identifier.ofVanilla("textures/atlas/blocks.png"), Identifier.ofVanilla("missingno"));
|
||||
|
||||
@Override public Sprite get(SpriteIdentifier spriteId) { return spriteId.getSprite(); }
|
||||
@Override public Sprite getMissing(String textureId) { return MISSING.getSprite(); }
|
||||
};
|
||||
}
|
||||
|
||||
public ModelNameSupplier getModelNameSupplier() { return () -> "#fakeblock"; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
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 eu.midnightdust.visualoverhaul.util.VOColorUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||
import net.minecraft.client.texture.ResourceTexture;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.LOGGER;
|
||||
import static eu.midnightdust.visualoverhaul.util.VOColorUtil.alphaAndBrightness;
|
||||
|
||||
public class IconicButtons {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
TextureManager textureManager = client.getTextureManager();
|
||||
private String buttonId;
|
||||
private Text prevText;
|
||||
private Identifier iconId;
|
||||
private static final Map<Identifier, Identifier> ICONS = new HashMap<>();
|
||||
|
||||
public IconicButtons() {}
|
||||
public void init(ClickableWidget widget) {
|
||||
if (widget == null || widget.getMessage() == null || widget.getMessage().getContent() == null) return;
|
||||
prevText = widget.getMessage();
|
||||
buttonId = (widget.getMessage().getContent() instanceof TranslatableTextContent translatableTextContent) ? translatableTextContent.getKey().toLowerCase() : "";
|
||||
if (VOConfig.buttonIcons && !buttonId.isEmpty()) {
|
||||
if (VOConfig.debug) System.out.println(buttonId);
|
||||
iconId = Identifier.tryParse("iconic:textures/gui/icons/" + buttonId.toLowerCase()+".png");
|
||||
// Show mod icons in MidnightConfig overview
|
||||
if (buttonId.endsWith(".midnightconfig.title")) {
|
||||
iconId = Identifier.of("modid", buttonId.replace(".midnightconfig.title", "") + "_icon");
|
||||
NativeImageBackedTexture icon = new ModIconUtil(buttonId.replace(".midnightconfig.title", "")).createModIcon();
|
||||
if (icon != null) {
|
||||
client.getTextureManager().registerTexture(iconId, icon);
|
||||
ICONS.put(iconId, iconId);
|
||||
} else {
|
||||
iconId = null;
|
||||
}
|
||||
}
|
||||
// Handle dynamic icons
|
||||
else if (iconId != null && !ICONS.containsKey(iconId)) {
|
||||
if (((TextureManagerAccessor)textureManager).getResourceContainer().getResource(iconId).isEmpty())
|
||||
return; // If no icon is present, don't load it
|
||||
|
||||
ResourceTexture abstractTexture = new ResourceTexture(iconId);
|
||||
if (VOConfig.debug) System.out.println("Loading dynamic icon: "+iconId);
|
||||
try {
|
||||
abstractTexture.loadContents(((TextureManagerAccessor)textureManager).getResourceContainer());
|
||||
} catch (Exception e) {e.fillInStackTrace();}
|
||||
textureManager.registerTexture(iconId, abstractTexture);
|
||||
ICONS.put(iconId, iconId);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void renderIcons(DrawContext context, ClickableWidget widget, float alpha) {
|
||||
if (widget.getMessage() == null || widget.getWidth() <= 20) return;
|
||||
if (prevText != widget.getMessage()) init(widget);
|
||||
if (VOConfig.buttonIcons && !buttonId.isEmpty() && iconId != null && ICONS.containsKey(iconId)) {
|
||||
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);
|
||||
|
||||
int color = widget.active ? alphaAndBrightness(alpha, 1.0F) : alphaAndBrightness(alpha, 0.3F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
int inset = 2;
|
||||
if (VOConfig.zoomIconOnHover && widget.isSelected() && widget.active) inset = 1;
|
||||
int size = 20-inset*2;
|
||||
|
||||
Identifier textureId = ICONS.get(iconId);
|
||||
|
||||
if (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LEFT) || showLeftWhenBoth || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LOCATION) && widget.getX() < scaledWidth/2))
|
||||
context.drawTexture(RenderLayer::getGuiTextured, textureId, widget.getX()+inset, widget.getY()+inset, 0, 0, size, size, size, size, size, size, color);
|
||||
|
||||
if (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.RIGHT) || showRightWhenBoth || (VOConfig.buttonIconPosition.equals(VOConfig.IconPosition.LOCATION) && widget.getX()+widget.getWidth() > scaledWidth/2))
|
||||
context.drawTexture(RenderLayer::getGuiTextured, textureId, widget.getX()+widget.getWidth()-20+inset, widget.getY()+inset, 0, 0, size, size, size, size, size, size, color);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.disableDepthTest();
|
||||
}
|
||||
}
|
||||
public static void reload(ResourceManager manager) {
|
||||
manager.findResources("textures", path -> path.getNamespace().equals("iconic") && path.getPath().contains(".properties")).forEach((id, resource) -> {
|
||||
if (manager.getResource(id).isEmpty()) return;
|
||||
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
|
||||
Identifier iconId = Identifier.of(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 = Identifier.of(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 = Identifier.tryParse(properties.getProperty("texture"));
|
||||
ICONS.put(iconId, textureId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error occurred while loading texture.properties for button icon {}", id.toString(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.MOD_ID;
|
||||
|
||||
public class VisualOverhaulClient {
|
||||
public static int waterColor = 4159204;
|
||||
public static int foliageColor = -8934609;
|
||||
public static int grassColor = -8934609;
|
||||
public static int potionColor = -13083194;
|
||||
|
||||
public static void onInitializeClient() {
|
||||
VOConfig.init(MOD_ID, VOConfig.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package eu.midnightdust.visualoverhaul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VisualOverhaulCommon {
|
||||
public static final String MOD_ID = "visualoverhaul";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("VisualOverhaul");
|
||||
public static final List<UUID> playersWithMod = new ArrayList<>();
|
||||
public static final Map<BlockPos, ItemStack> jukeboxItems = new HashMap<>();
|
||||
|
||||
public static final Identifier HELLO_PACKET = id("hello");
|
||||
public static final Identifier UPDATE_ITEMS_PACKET = id("update_items");
|
||||
|
||||
public static final Identifier UPDATE_TYPE_POTION_BOTTLES = id("type_brewingstand");
|
||||
public static final Identifier UPDATE_TYPE_RECORD = id("type_record");
|
||||
public static final Identifier UPDATE_TYPE_FURNACE_ITEMS = id("type_furnace");
|
||||
|
||||
public static Identifier id(String path) {
|
||||
return Identifier.of(MOD_ID, path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package eu.midnightdust.visualoverhaul.block.model;
|
||||
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.id;
|
||||
|
||||
public class FurnaceWoodenPlanksModel extends Model {
|
||||
private static ModelPart bb_main;
|
||||
public static final EntityModelLayer WOODEN_PLANKS_MODEL_LAYER = new EntityModelLayer(id("wooden_planks"), "main");
|
||||
|
||||
public FurnaceWoodenPlanksModel(ModelPart root) {
|
||||
super(root, RenderLayer::getEntitySolid);
|
||||
bb_main = root;
|
||||
bb_main.setPivot(0.0F, 24.0F, 0.0F);
|
||||
}
|
||||
public ModelPart getPart() {
|
||||
return bb_main;
|
||||
}
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
return TexturedModelData.of(getModelData(), 16, 16);
|
||||
}
|
||||
|
||||
public static ModelData getModelData(){
|
||||
ModelData modelData = new ModelData();
|
||||
ModelPartData modelPartData = modelData.getRoot();
|
||||
modelPartData.addChild("cube_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -3.0F, 0.0F, 10.0F, 1.0F, 1.0F), ModelTransform.of(6.0F, 1.0F, -2.0F,0.0F, -0.5672F, 0.0F));
|
||||
modelPartData.addChild("cube_r2", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -2.5F, 0.0F, 10.0F, 2.0F, 2.0F), ModelTransform.of(5.0F, 0.0F, -5.0F,0.0F, -0.1309F, 0.0F));
|
||||
modelPartData.addChild("cube_r3", ModelPartBuilder.create().uv(0, 0).cuboid(-10.0F, -2.0F, 0.0F, 10.0F, 2.0F, 2.0F), ModelTransform.of(5.0F, -1.0F, -7.0F,0.0F, 0.2618F, 0.0F));
|
||||
return modelData;
|
||||
}
|
||||
|
||||
// public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||
// bb_main.render(matrices, vertices, light, overlay);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package eu.midnightdust.visualoverhaul.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
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.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ModelTransformationMode;
|
||||
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) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void render(BrewingStandBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
|
||||
if (VOConfig.brewingstand) {
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos());
|
||||
ItemStack item1 = blockEntity.getStack(0);
|
||||
ItemStack item2 = blockEntity.getStack(1);
|
||||
ItemStack item3 = blockEntity.getStack(2);
|
||||
|
||||
if (!item1.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.86f, 0.23f, 0.5f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
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(degrees315);
|
||||
matrices.translate(0.32f, 0.23f, 0f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item2, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (!item3.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.multiply(degrees45);
|
||||
matrices.translate(-0.39f, 0.23f, 0.705f);
|
||||
matrices.scale(1.15f, 1.15f, 1.15f);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(item3, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package eu.midnightdust.visualoverhaul.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.block.model.FurnaceWoodenPlanksModel;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
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.texture.Sprite;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ModelTransformationMode;
|
||||
import net.minecraft.registry.tag.ItemTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
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) {
|
||||
this.planks = new FurnaceWoodenPlanksModel(ctx.getLayerModelPart(FurnaceWoodenPlanksModel.WOODEN_PLANKS_MODEL_LAYER));
|
||||
}
|
||||
|
||||
public void render(E blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
if (VOConfig.furnace && blockEntity != null) {
|
||||
BlockState blockState = blockEntity.getCachedState();
|
||||
int lightAtBlock = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().offset(blockState.get(AbstractFurnaceBlock.FACING)));
|
||||
ItemStack input = blockEntity.getStack(0);
|
||||
ItemStack fuel = blockEntity.getStack(1);
|
||||
ItemStack output = blockEntity.getStack(2);
|
||||
float angle = (blockState.get(AbstractFurnaceBlock.FACING)).getRotationQuaternion().angle();
|
||||
|
||||
if(!input.isEmpty() || !output.isEmpty()) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 0.58f, 0.5f);
|
||||
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(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(degrees90x);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(input.isEmpty() ? output : input, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
if (!fuel.isEmpty() && !fuel.isIn(ItemTags.LOGS_THAT_BURN) && !fuel.isIn(ItemTags.PLANKS)) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 0.08f, 0.5f);
|
||||
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(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
matrices.translate(0.0f, 0.0f, -0.4f);
|
||||
matrices.multiply(degrees90x);
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(fuel, ModelTransformationMode.GROUND, lightAtBlock, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
else if (!fuel.isEmpty()) {
|
||||
matrices.push();
|
||||
BlockState state = Block.getBlockFromItem(fuel.getItem()).getDefaultState();
|
||||
Sprite texture = MinecraftClient.getInstance().getBlockRenderManager().getModel(state).getParticleSprite();
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(spriteToTexture(texture)));
|
||||
|
||||
matrices.translate(0.5f, -1.3f, 0.5f);
|
||||
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.2f, 0f);
|
||||
matrices.scale(1f, 1f, 1f);
|
||||
|
||||
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(angle * 3 + 180), 0, 1, 0)));
|
||||
planks.getPart().render(matrices, vertexConsumer, lightAtBlock, overlay);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static Identifier spriteToTexture(Sprite sprite) {
|
||||
String texture = sprite.getContents().getId().getPath();
|
||||
return Identifier.of(sprite.getAtlasId().getNamespace(), "textures/" + texture + ".png");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package eu.midnightdust.visualoverhaul.block.renderer;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.FakeBlocks;
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import eu.midnightdust.visualoverhaul.util.SoundTest;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SideShapeType;
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.block.BlockRenderManager;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import org.joml.AxisAngle4f;
|
||||
import org.joml.Math;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.id;
|
||||
import static eu.midnightdust.visualoverhaul.VisualOverhaulCommon.jukeboxItems;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class JukeboxBlockEntityRenderer implements BlockEntityRenderer<JukeboxBlockEntity> {
|
||||
|
||||
public JukeboxBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {}
|
||||
|
||||
@Override
|
||||
public void render(JukeboxBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
if (VOConfig.jukebox) {
|
||||
int lightAbove = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().up());
|
||||
|
||||
Identifier discModel = null; // If the sound is stopped or no sound is playing, no model is set //
|
||||
|
||||
// Tries to get the disc using the serverside method
|
||||
if (jukeboxItems.containsKey(blockEntity.getPos()) && !jukeboxItems.get(blockEntity.getPos()).isEmpty()) {
|
||||
discModel = RoundDiscRenderer.getModelId(jukeboxItems.get(blockEntity.getPos()));
|
||||
}
|
||||
// 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) //
|
||||
discModel = Identifier.of(String.valueOf(SoundTest.getSound(blockEntity.getPos())).replace(".", "_"));
|
||||
}
|
||||
|
||||
if (discModel != null) {
|
||||
matrices.push();
|
||||
|
||||
matrices.translate(0.5f, 1.03f, 0.5f);
|
||||
matrices.scale(0.75f, 0.75f, 0.75f);
|
||||
matrices.multiply(new Quaternionf(new AxisAngle4f(Math.toRadians(Util.getMeasuringTimeMs() / 9.0f), 0, 1, 0)));
|
||||
|
||||
RoundDiscRenderer.render(discModel, lightAbove, overlay, matrices, vertexConsumers);
|
||||
matrices.pop();
|
||||
}
|
||||
if (VOConfig.jukebox_fake_block && !blockEntity.getWorld().getBlockState(blockEntity.getPos().up()).isSideSolid(blockEntity.getWorld(),blockEntity.getPos().up(), Direction.DOWN, SideShapeType.FULL)) {
|
||||
matrices.push();
|
||||
matrices.translate(0f, 1f, 0f);
|
||||
Identifier blockId = discModel != null ? id("jukebox_top_playing") : id("jukebox_top_stopped");
|
||||
FakeBlocks.renderFakeBlock(blockId, blockEntity.getPos().up(), blockEntity.getWorld(), matrices, vertexConsumers.getBuffer(RenderLayer.getCutout()));
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
24
common/src/main/java/eu/midnightdust/visualoverhaul/config/VOConfig.java
Executable file
24
common/src/main/java/eu/midnightdust/visualoverhaul/config/VOConfig.java
Executable file
@@ -0,0 +1,24 @@
|
||||
package eu.midnightdust.visualoverhaul.config;
|
||||
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
public class VOConfig extends MidnightConfig {
|
||||
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 jukebox_clientside = 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 = false;
|
||||
@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,12 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import net.minecraft.client.render.item.ItemRenderState;
|
||||
import net.minecraft.item.ModelTransformationMode;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(ItemRenderState.class)
|
||||
public interface ItemRenderStateAccessor {
|
||||
@Accessor("modelTransformationMode")
|
||||
void setModelTransformationMode(ModelTransformationMode modelTransformationMode);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.AbstractFurnaceBlock;
|
||||
import net.minecraft.block.BlastFurnaceBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.World;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(BlastFurnaceBlock.class)
|
||||
public abstract class MixinBlastFurnaceBlock extends AbstractFurnaceBlock {
|
||||
protected MixinBlastFurnaceBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "randomDisplayTick")
|
||||
public void vo$randomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo ci) {
|
||||
if (state.get(LIT) && VOConfig.blast_furnace_particles) {
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = pos.getY();
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
|
||||
Direction direction = state.get(FACING);
|
||||
Direction.Axis axis = direction.getAxis();
|
||||
double h = random.nextDouble() * 0.6D - 0.3D;
|
||||
double i = axis == Direction.Axis.X ? (double)direction.getOffsetX() * 0.4D : h;
|
||||
double j = random.nextDouble() * 6.0D / 16.0D;
|
||||
double k = axis == Direction.Axis.Z ? (double)direction.getOffsetZ() * 0.4D : h;
|
||||
world.addParticle(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.client.render.item.tint.ConstantTintSource;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Mixin(ConstantTintSource.class)
|
||||
public abstract class MixinConstantTintSource {
|
||||
@Inject(at = @At("RETURN"), method = "getTint", cancellable = true)
|
||||
public void vo$modifyLeafTint(ItemStack stack, ClientWorld world, LivingEntity user, CallbackInfoReturnable<Integer> cir) {
|
||||
// Dynamic Leaf Item colors
|
||||
if (VOConfig.coloredItems && Objects.equals(-12012264, cir.getReturnValue())) {
|
||||
cir.setReturnValue(VisualOverhaulClient.foliageColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.client.render.item.tint.GrassTintSource;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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(GrassTintSource.class)
|
||||
public abstract class MixinGrassTintSource {
|
||||
@Inject(at = @At("RETURN"), method = "getTint", cancellable = true)
|
||||
public void vo$modifyGrassTint(ItemStack stack, ClientWorld world, LivingEntity user, CallbackInfoReturnable<Integer> cir) {
|
||||
// Dynamic Grass Item colors
|
||||
if (VOConfig.coloredItems) {
|
||||
cir.setReturnValue(VisualOverhaulClient.grassColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.util.JukeboxPacketUpdate;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(JukeboxBlockEntity.class)
|
||||
public abstract class MixinJukeboxBlockEntity extends BlockEntity {
|
||||
|
||||
public MixinJukeboxBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "onRecordStackChanged")
|
||||
public void getRecord(CallbackInfo ci) {
|
||||
JukeboxPacketUpdate.invUpdate = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulClient;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.client.render.item.tint.PotionTintSource;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(PotionTintSource.class)
|
||||
public class MixinPotionTintSource {
|
||||
@Unique private static final List<RegistryEntry<Potion>> WATER_POTIONS = List.of(Potions.WATER, Potions.MUNDANE, Potions.THICK, Potions.AWKWARD);
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "getTint", cancellable = true)
|
||||
public void vo$modifyWaterTint(ItemStack stack, ClientWorld world, LivingEntity user, CallbackInfoReturnable<Integer> cir) {
|
||||
// Dynamic Potion Item colors
|
||||
if (VOConfig.coloredItems) {
|
||||
var contents = stack.getComponents().get(DataComponentTypes.POTION_CONTENTS);
|
||||
if (contents != null && contents.potion().isPresent()) {
|
||||
if (!WATER_POTIONS.contains(contents.potion().get()))
|
||||
return; // Skip all potions with effects
|
||||
}
|
||||
if (cir.getReturnValue() == -1) cir.setReturnValue(ColorHelper.fullAlpha(VisualOverhaulClient.potionColor));
|
||||
else cir.setReturnValue(VisualOverhaulClient.potionColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.IconicButtons;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
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 visualoverhaul$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) {
|
||||
visualoverhaul$iconicButtons = new IconicButtons();
|
||||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/PressableWidget;drawMessage(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/font/TextRenderer;I)V", shift = At.Shift.BEFORE), method = "renderWidget")
|
||||
private void iconic$onRenderButton(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
visualoverhaul$iconicButtons.renderIcons(context, this, this.alpha);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.IconicButtons;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
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 visualoverhaul$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) {
|
||||
visualoverhaul$iconicButtons = new IconicButtons();
|
||||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/SliderWidget;drawScrollableText(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/font/TextRenderer;II)V", shift = At.Shift.BEFORE), method = "renderWidget")
|
||||
private void iconic$onRenderButton(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
visualoverhaul$iconicButtons.renderIcons(context, this, this.alpha);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.block.AbstractFurnaceBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SmokerBlock;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.World;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(SmokerBlock.class)
|
||||
public abstract class MixinSmokerBlock extends AbstractFurnaceBlock {
|
||||
protected MixinSmokerBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "randomDisplayTick")
|
||||
public void vo$randomDisplayTick(BlockState state, World world, BlockPos pos, Random random, CallbackInfo ci) {
|
||||
if (state.get(LIT) && VOConfig.smoker_particles) {
|
||||
double d = (double)pos.getX() + 0.5D;
|
||||
double e = pos.getY();
|
||||
double f = (double)pos.getZ() + 0.5D;
|
||||
|
||||
Direction direction = state.get(FACING);
|
||||
Direction.Axis axis = direction.getAxis();
|
||||
double h = random.nextDouble() * 0.6D - 0.3D;
|
||||
double i = axis == Direction.Axis.X ? (double)direction.getOffsetX() * 0.4D : h;
|
||||
double j = random.nextDouble() * 6.0D / 16.0D;
|
||||
double k = axis == Direction.Axis.Z ? (double)direction.getOffsetZ() * 0.4D : h;
|
||||
world.addParticle(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.util.SoundTest;
|
||||
import net.minecraft.client.sound.SoundInstance;
|
||||
import net.minecraft.client.sound.SoundSystem;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
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(SoundSystem.class)
|
||||
public abstract class MixinSoundSystem {
|
||||
|
||||
@Shadow private boolean started;
|
||||
|
||||
@Unique
|
||||
private BlockPos visualoverhaul$jukeboxPos;
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "play(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onPlayRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS) && this.started) {
|
||||
visualoverhaul$jukeboxPos = BlockPos.ofFloored(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
SoundTest.soundPos.put(visualoverhaul$jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"),method = "stop(Lnet/minecraft/client/sound/SoundInstance;)V")
|
||||
public void vo$onStopRecordSound(SoundInstance soundInstance, CallbackInfo ci) {
|
||||
if (soundInstance != null) {
|
||||
if (soundInstance.getCategory().equals(SoundCategory.RECORDS)) {
|
||||
visualoverhaul$jukeboxPos = BlockPos.ofFloored(Math.floor(soundInstance.getX()), Math.floor(soundInstance.getY()), Math.floor(soundInstance.getZ()));
|
||||
if (SoundTest.soundPos.containsKey(visualoverhaul$jukeboxPos)) {
|
||||
SoundTest.soundPos.remove(visualoverhaul$jukeboxPos, soundInstance.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package eu.midnightdust.visualoverhaul.mixin;
|
||||
|
||||
import net.minecraft.client.texture.AbstractTexture;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(TextureManager.class)
|
||||
public interface TextureManagerAccessor {
|
||||
@Accessor
|
||||
ResourceManager getResourceContainer();
|
||||
|
||||
@Accessor
|
||||
Map<Identifier, AbstractTexture> getTextures();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package eu.midnightdust.visualoverhaul.packet;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulCommon;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record HelloPacket(UUID uuid) implements CustomPayload {
|
||||
public static final CustomPayload.Id<HelloPacket> PACKET_ID = new CustomPayload.Id<>(VisualOverhaulCommon.HELLO_PACKET);
|
||||
public static final PacketCodec<PacketByteBuf, HelloPacket> codec = PacketCodec.of(HelloPacket::write, HelloPacket::read);
|
||||
|
||||
public static HelloPacket read(PacketByteBuf buf) {
|
||||
return new HelloPacket(buf.readUuid());
|
||||
}
|
||||
|
||||
public void write(PacketByteBuf buf) {
|
||||
buf.writeUuid(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Id<? extends CustomPayload> getId() {
|
||||
return PACKET_ID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package eu.midnightdust.visualoverhaul.packet;
|
||||
|
||||
import eu.midnightdust.visualoverhaul.VisualOverhaulCommon;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public record UpdateItemsPacket(Identifier blockTypeID, BlockPos pos, DefaultedList<ItemStack> inv) implements CustomPayload {
|
||||
public static final Id<UpdateItemsPacket> PACKET_ID = new Id<>(VisualOverhaulCommon.UPDATE_ITEMS_PACKET);
|
||||
public static final PacketCodec<RegistryByteBuf, UpdateItemsPacket> codec = PacketCodec.of(UpdateItemsPacket::write, UpdateItemsPacket::read);
|
||||
|
||||
public static UpdateItemsPacket read(RegistryByteBuf buf) {
|
||||
return new UpdateItemsPacket(buf.readIdentifier(), buf.readBlockPos(), (DefaultedList<ItemStack>) ItemStack.OPTIONAL_LIST_PACKET_CODEC.decode(buf));
|
||||
}
|
||||
|
||||
public void write(RegistryByteBuf buf) {
|
||||
buf.writeIdentifier(blockTypeID);
|
||||
buf.writeBlockPos(pos);
|
||||
ItemStack.OPTIONAL_LIST_PACKET_CODEC.encode(buf, this.inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Id<? extends CustomPayload> getId() {
|
||||
return PACKET_ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
public class JukeboxPacketUpdate {
|
||||
public static boolean invUpdate = true;
|
||||
public static int playerUpdate = -1;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,24 @@
|
||||
package eu.midnightdust.visualoverhaul.util.sound;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SoundTest {
|
||||
|
||||
public static Map<BlockPos, Identifier> soundPos = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Returns the Sound provided in MixinSoundSystem
|
||||
* {@link eu.midnightdust.visualoverhaul.mixin.MixinSoundSystem}
|
||||
*/
|
||||
public static Identifier getSound(BlockPos pos) {
|
||||
if (soundPos.containsKey(pos)) {
|
||||
return soundPos.get(pos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import eu.midnightdust.visualoverhaul.config.VOConfig;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SoundTest {
|
||||
|
||||
public static Map<BlockPos, Identifier> soundPos = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Returns the Sound provided in MixinSoundSystem
|
||||
* {@link eu.midnightdust.visualoverhaul.mixin.MixinSoundSystem}
|
||||
*/
|
||||
public static Identifier getSound(BlockPos pos) {
|
||||
if (VOConfig.jukebox_clientside && soundPos.containsKey(pos)) {
|
||||
return soundPos.get(pos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package eu.midnightdust.visualoverhaul.util;
|
||||
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class VOColorUtil {
|
||||
public static int convertRgbToArgb(int rgb, int alpha) {
|
||||
int red = 0xFF & (rgb >> 16);
|
||||
int green = 0xFF & (rgb >> 8);
|
||||
int blue = 0xFF & (rgb);
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
public static int alphaAndBrightness(float alpha, float brightness) {
|
||||
return ColorHelper.getArgb(MathHelper.floor(alpha*255), MathHelper.floor(brightness*255), MathHelper.floor(brightness*255), MathHelper.floor(brightness*255));
|
||||
}
|
||||
}
|
||||
2
common/src/main/resources/architectury.common.json
Normal file
2
common/src/main/resources/architectury.common.json
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
BIN
common/src/main/resources/assets/visualoverhaul/icon.png
Normal file
BIN
common/src/main/resources/assets/visualoverhaul/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
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"
|
||||
}
|
||||
25
common/src/main/resources/assets/visualoverhaul/lang/en_us.json
Executable file
25
common/src/main/resources/assets/visualoverhaul/lang/en_us.json
Executable file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Visual Overhaul Config",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Brewing Stand Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Jukebox Enhancements",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Fake block on jukebox top",
|
||||
"visualoverhaul.midnightconfig.jukebox_clientside":"Client-side music disc detection",
|
||||
"visualoverhaul.midnightconfig.jukebox_clientside.tooltip":"Might not be 100% accurate with custom music discs.",
|
||||
"visualoverhaul.midnightconfig.furnace":"Furnace Enhancements",
|
||||
"visualoverhaul.midnightconfig.smoker_particles":"Smoker Particles",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles":"Blast Furnace Particles",
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Biome-based item colors",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§cNeeds restart!",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad":"Biome-based Lily Pad color",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§cNeeds restart!",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Configuración de Visual Overhaul",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Mejoras en el soporte de pociones",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Mejoras en la caja de música",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Bloque falso en la parte superior de la caja de música",
|
||||
"visualoverhaul.midnightconfig.furnace":"Mejoras en el horno",
|
||||
"visualoverhaul.midnightconfig.smoker_particles":"Partículas de ahumador",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles":"Partículas del alto horno",
|
||||
"visualoverhaul.midnightconfig.coloredItems":"Colores de objetos basados en el bioma",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip":"§c¡Necesita reiniciar!",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad":"Color de nenúfar basado en el bioma",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip":"§c¡Necesita reiniciar!",
|
||||
"visualoverhaul.midnightconfig.buttonIcons": "Iconos de botones",
|
||||
"visualoverhaul.midnightconfig.buttonIconPosition": "Posición del icono del botón",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LOCATION": "Dependiente de la ubicación",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LEFT": "Izquierda",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.RIGHT": "Derecha",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.BOTH": "Izquierda y derecha",
|
||||
"visualoverhaul.midnightconfig.zoomIconOnHover": "Icono de zoom al pasar el cursor",
|
||||
"visualoverhaul.midnightconfig.category.gui": "GUI",
|
||||
"visualoverhaul.midnightconfig.category.blocks": "Bloques",
|
||||
"visualoverhaul.midnightconfig.category.colors": "Colores"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title":"Configuration de Visual Overhaul",
|
||||
"visualoverhaul.midnightconfig.brewingstand":"Améliorations de l'Alambic",
|
||||
"visualoverhaul.midnightconfig.jukebox":"Améliorations du Jukebox",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block":"Faux bloc sur le dessus du Jukebox",
|
||||
"visualoverhaul.midnightconfig.furnace":"Améliorations du Four",
|
||||
"visualoverhaul.midnightconfig.smoker_particles":"Particles du Fumoir",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles":"Particles du Haut Fourneau",
|
||||
"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 !"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"visualoverhaul.midnightconfig.title": "《視覺增強》設定",
|
||||
"visualoverhaul.midnightconfig.brewingstand": "釀造台增強",
|
||||
"visualoverhaul.midnightconfig.jukebox": "唱片機增強",
|
||||
"visualoverhaul.midnightconfig.jukebox_fake_block": "唱片機頂部的偽裝方塊",
|
||||
"visualoverhaul.midnightconfig.jukebox_clientside": "用戶端音樂唱片偵測",
|
||||
"visualoverhaul.midnightconfig.jukebox_clientside.tooltip": "對於自訂音樂唱片,可能無法 100% 準確。",
|
||||
"visualoverhaul.midnightconfig.furnace": "熔爐增強",
|
||||
"visualoverhaul.midnightconfig.smoker_particles": "煙燻爐粒子",
|
||||
"visualoverhaul.midnightconfig.blast_furnace_particles": "高爐粒子",
|
||||
"visualoverhaul.midnightconfig.coloredItems": "基於生態域的物品顏色",
|
||||
"visualoverhaul.midnightconfig.coloredItems.tooltip": "§c需要重新啟動!",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad": "基於生態域的睡蓮顏色",
|
||||
"visualoverhaul.midnightconfig.coloredLilypad.tooltip": "§c需要重新啟動!",
|
||||
"visualoverhaul.midnightconfig.buttonIcons": "按鈕圖示",
|
||||
"visualoverhaul.midnightconfig.buttonIconPosition": "按鈕圖示位置",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LOCATION": "取決於位置",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.LEFT": "左",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.RIGHT": "右",
|
||||
"visualoverhaul.midnightconfig.enum.IconPosition.BOTH": "左和右",
|
||||
"visualoverhaul.midnightconfig.zoomIconOnHover": "懸停時放大圖示",
|
||||
"visualoverhaul.midnightconfig.category.gui": "介面",
|
||||
"visualoverhaul.midnightconfig.category.blocks": "方塊",
|
||||
"visualoverhaul.midnightconfig.category.colors": "顏色"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"credit": "made by Motschen",
|
||||
"textures": {
|
||||
"0": "block/glass",
|
||||
"1": "block/black_concrete",
|
||||
"2": "block/anvil",
|
||||
"3": "visualoverhaul:block/vo_jukebox_top",
|
||||
"4": "phonos:block/speaker_top_0",
|
||||
"particle": "block/glass"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 0.01, 16],
|
||||
"faces": {
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#3"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 5, 16],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 16, 5], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 16, 16], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [7.875, 0, 7.875],
|
||||
"to": [8.125, 1.25, 8.125],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [5.75, 1, 11.29],
|
||||
"to": [6, 1.5, 11.54],
|
||||
"rotation": {"angle": 45, "axis": "y", "origin": [5, 8, 12]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#2"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0.875, 0, 14.875],
|
||||
"to": [1.375, 1.5, 15.375],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [1, 8, 15]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0.65, 1.5, 14.875],
|
||||
"to": [7.15, 2, 15.375],
|
||||
"rotation": {"angle": 45, "axis": "y", "origin": [1, 10, 15]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"east": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"south": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"west": {"uv": [0, 0, 0.25, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 0, 0.25, 0.25], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [10, 0.1, 12],
|
||||
"to": [15, 0.1, 15],
|
||||
"faces": {
|
||||
"up": {"uv": [4, 5, 12, 10], "rotation": 180, "texture": "#4"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "visualoverhaul:block/phonos/jukebox_top_playing_0",
|
||||
"textures": {
|
||||
"4": "phonos:block/speaker_top_1"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user