Skip to content

Commit

Permalink
Update to 1.19-pre1.
Browse files Browse the repository at this point in the history
  • Loading branch information
kvverti committed May 21, 2022
1 parent 3306373 commit 9e6ef28
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 402 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -16,7 +16,7 @@ archivesBaseName = project.archives_base_name
version = "${project.mod_version}+mc.${project.minecraft_version}"
group = project.maven_group

minecraft {
loom {
}

dependencies {
Expand All @@ -39,12 +39,12 @@ dependencies {
// runtime only setups
// modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// modRuntimeOnly("com.terraformersmc:modmenu:${project.mod_menu_version}") { transitive = false }
modRuntimeOnly fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version)
modRuntimeOnly fabricApi.module("fabric-rendering-fluids-v1", project.fabric_version)
modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version}"
// modRuntimeOnly fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version)
// modRuntimeOnly fabricApi.module("fabric-rendering-fluids-v1", project.fabric_version)
// modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version}"

// because Loom doesn't load Sodium's included non-mod dependency
runtimeOnly "org.joml:joml:1.10.2"
// runtimeOnly "org.joml:joml:1.10.2"
}

processResources {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
minecraft_version=1.19-pre1
yarn_mappings=1.19-pre1+build.7
loader_version=0.14.6
# Mod Properties
mod_version = 3.1.2-snapshot
maven_group = io.github.kvverti
archives_base_name = colormatic

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api
fabric_version=0.47.10+1.18.2
fabric_version=0.53.1+1.19
mod_menu_version=3.1.0
sodium_version=mc1.18.2-0.4.1
4 changes: 3 additions & 1 deletion src/main/java/io/github/kvverti/colormatic/Colormatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class Colormatic implements ClientModInitializer {

public static final String MODID = "colormatic";

public static final Identifier OVERWORLD_ID = new Identifier("minecraft:overworld");

public static final BiomeColormapResource WATER_COLORS =
new BiomeColormapResource(new Identifier(MODID, "colormap/water"));
public static final BiomeColormapResource UNDERWATER_COLORS =
Expand Down Expand Up @@ -95,7 +97,7 @@ public static Identifier getDimId(World world) {
DimensionType type = world.getDimension();
Identifier id = world.getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getId(type);
if(id == null) {
id = DimensionType.OVERWORLD_ID;
id = OVERWORLD_ID;
}
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;

/**
* This class holds functions that control loading, opening, and persisting
Expand All @@ -52,7 +51,7 @@ private ColormaticConfigController() {
}

public static Screen getConfigScreen(ColormaticConfig config, Screen parent) {
return new ColormaticConfigScreen(new TranslatableText("colormatic.config.title.subtitle"), parent, config);
return new ColormaticConfigScreen(Text.translatable("colormatic.config.title.subtitle"), parent, config);
}

private static final String CLEAR_SKY = "fog.clearSky";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@
import org.jetbrains.annotations.Nullable;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.CyclingButtonWidget;
import net.minecraft.client.gui.widget.SliderWidget;
import net.minecraft.client.util.OrderableTooltip;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

public class ColormaticConfigScreen extends Screen {

Expand Down Expand Up @@ -65,49 +63,49 @@ protected void init() {
var clearSkyBtn = this.addDrawableChild(CyclingButtonWidget
.onOffBuilder()
.initially(config.clearSky)
.tooltip(value -> this.textRenderer.wrapLines(new TranslatableText("colormatic.config.option.clearSky.desc"), STANDARD_WIDTH))
.tooltip(value -> this.textRenderer.wrapLines(Text.translatable("colormatic.config.option.clearSky.desc"), STANDARD_WIDTH))
.build(
centerX - STANDARD_MARGIN - STANDARD_WIDTH,
TOP_MARGIN + 2 * STANDARD_HEIGHT,
STANDARD_WIDTH,
STANDARD_HEIGHT,
new TranslatableText("colormatic.config.option.clearSky"),
Text.translatable("colormatic.config.option.clearSky"),
(button, value) -> config.clearSky = value));
var clearVoidBtn = this.addDrawableChild(CyclingButtonWidget
.onOffBuilder()
.initially(config.clearVoid)
.tooltip(value -> this.textRenderer.wrapLines(new TranslatableText("colormatic.config.option.clearVoid.desc"), STANDARD_WIDTH))
.tooltip(value -> this.textRenderer.wrapLines(Text.translatable("colormatic.config.option.clearVoid.desc"), STANDARD_WIDTH))
.build(
centerX + STANDARD_MARGIN,
TOP_MARGIN + 2 * STANDARD_HEIGHT,
STANDARD_WIDTH,
STANDARD_HEIGHT,
new TranslatableText("colormatic.config.option.clearVoid"),
Text.translatable("colormatic.config.option.clearVoid"),
(button, value) -> config.clearVoid = value));
this.fogSectionBottom = clearVoidBtn.y + clearVoidBtn.getHeight() + STANDARD_MARGIN;
// lighting settings
var blendSkyLightBtn = this.addDrawableChild(CyclingButtonWidget
.onOffBuilder()
.initially(config.blendSkyLight)
.tooltip(value -> this.textRenderer.wrapLines(new TranslatableText("colormatic.config.option.blendSkyLight.desc"), STANDARD_WIDTH))
.tooltip(value -> this.textRenderer.wrapLines(Text.translatable("colormatic.config.option.blendSkyLight.desc"), STANDARD_WIDTH))
.build(
clearSkyBtn.x,
this.fogSectionBottom + 2 * STANDARD_HEIGHT,
STANDARD_WIDTH,
STANDARD_HEIGHT,
new TranslatableText("colormatic.config.option.blendSkyLight"),
Text.translatable("colormatic.config.option.blendSkyLight"),
(button, value) -> config.blendSkyLight = value
));
this.addDrawableChild(CyclingButtonWidget
.onOffBuilder()
.initially(config.flickerBlockLight)
.tooltip(value -> this.textRenderer.wrapLines(new TranslatableText("colormatic.config.option.flickerBlockLight.desc"), STANDARD_WIDTH))
.tooltip(value -> this.textRenderer.wrapLines(Text.translatable("colormatic.config.option.flickerBlockLight.desc"), STANDARD_WIDTH))
.build(
clearVoidBtn.x,
this.fogSectionBottom + 2 * STANDARD_HEIGHT,
STANDARD_WIDTH,
STANDARD_HEIGHT,
new TranslatableText("colormatic.config.option.flickerBlockLight"),
Text.translatable("colormatic.config.option.flickerBlockLight"),
(button, value) -> config.flickerBlockLight = value
));
this.addDrawableChild(new BlockLightIntensitySlider(
Expand All @@ -129,13 +127,13 @@ protected void init() {
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// draw category labels
this.renderBackground(matrices);
var title = new TranslatableText("colormatic.config.title");
var title = Text.translatable("colormatic.config.title");
var width = this.textRenderer.getWidth(title);
this.textRenderer.drawWithShadow(matrices, title, (this.width - width) / 2.0f, TOP_MARGIN, -1);
var fogSettingsTitle = new TranslatableText("colormatic.config.category.fog");
var fogSettingsTitle = Text.translatable("colormatic.config.category.fog");
width = this.textRenderer.getWidth(fogSettingsTitle);
this.textRenderer.drawWithShadow(matrices, fogSettingsTitle, (this.width - width) / 2.0f, TOP_MARGIN + STANDARD_HEIGHT, -1);
var lightSettingsTitle = new TranslatableText("colormatic.config.category.light");
var lightSettingsTitle = Text.translatable("colormatic.config.category.light");
width = this.textRenderer.getWidth(lightSettingsTitle);
this.textRenderer.drawWithShadow(matrices, lightSettingsTitle, (this.width - width) / 2.0f, this.fogSectionBottom + STANDARD_HEIGHT, -1);
var tooltip = this.getTooltip(mouseX, mouseY);
Expand Down Expand Up @@ -174,16 +172,16 @@ public BlockLightIntensitySlider(int x, int y) {
y,
ColormaticConfigScreen.STANDARD_WIDTH,
ColormaticConfigScreen.STANDARD_HEIGHT,
LiteralText.EMPTY,
Text.empty(),
1.0 - ColormaticConfigScreen.this.config.relativeBlockLightIntensityExponent / -16.0);
this.updateMessage();
}

@Override
protected void updateMessage() {
this.setMessage(new TranslatableText("colormatic.config.option.relativeBlockLightIntensity")
this.setMessage(Text.translatable("colormatic.config.option.relativeBlockLightIntensity")
.append(": ")
.append(new LiteralText(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(this.configValue()))))).append("%")));
.append(Text.literal(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(this.configValue()))))).append("%")));
}

@Override
Expand All @@ -197,7 +195,7 @@ private double configValue() {

@Override
public List<OrderedText> getOrderedTooltip() {
return ColormaticConfigScreen.this.textRenderer.wrapLines(new TranslatableText("colormatic.config.option.relativeBlockLightIntensity.desc"), TOOLTIP_WIDTH);
return ColormaticConfigScreen.this.textRenderer.wrapLines(Text.translatable("colormatic.config.option.relativeBlockLightIntensity.desc"), TOOLTIP_WIDTH);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Colormatic
* Copyright (C) 2021 Thalia Nero
* Copyright (C) 2021-2022 Thalia Nero
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -72,7 +72,7 @@ private static ColormaticResolver byBlock(Block key) {
private static ColormaticResolver bySky(Identifier key) {
return (manager, biome, posX, posY, posZ) -> {
int color;
if(Colormatic.SKY_COLORS.hasCustomColormap() && key.equals(DimensionType.OVERWORLD_ID)) {
if(Colormatic.SKY_COLORS.hasCustomColormap() && key.equals(Colormatic.OVERWORLD_ID)) {
color = Colormatic.SKY_COLORS.getColormap().getColor(manager, biome, posX, posY, posZ);
} else {
color = Colormatic.COLOR_PROPS.getProperties().getDimensionSky(key);
Expand All @@ -87,7 +87,7 @@ private static ColormaticResolver bySky(Identifier key) {
private static ColormaticResolver byFog(Identifier key) {
return (manager, biome, posX, posY, posZ) -> {
int color;
if(Colormatic.FOG_COLORS.hasCustomColormap() && key.equals(DimensionType.OVERWORLD_ID)) {
if(Colormatic.FOG_COLORS.hasCustomColormap() && key.equals(Colormatic.OVERWORLD_ID)) {
color = 0xff000000 | Colormatic.FOG_COLORS.getColormap().getColor(manager, biome, posX, posY, posZ);
} else {
color = Colormatic.COLOR_PROPS.getProperties().getDimensionFog(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public int getFluidColor(@Nullable BlockRenderView view, @Nullable BlockPos pos,
}

@Override
public boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
return this.delegate.renderFluid(pos, world, vertexConsumer, blockState, fluidState);
public void renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
this.delegate.renderFluid(pos, world, vertexConsumer, blockState, fluidState);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Colormatic
* Copyright (C) 2021 Thalia Nero
* Copyright (C) 2021-2022 Thalia Nero
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -21,8 +21,6 @@
*/
package io.github.kvverti.colormatic.mixin.block;

import java.util.Random;

import io.github.kvverti.colormatic.Colormatic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -37,6 +35,7 @@
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Colormatic
* Copyright (C) 2021 Thalia Nero
* Copyright (C) 2021-2022 Thalia Nero
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -37,15 +37,18 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.argument.BlockStateArgumentType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;

@Mixin(ModelLoader.class)
public abstract class ModelLoaderMixin {

// using the built in DRM is fine because blocks aren't dynamic.
@Unique
private static final BlockStateArgumentType BLOCK_STATE_PARSER = BlockStateArgumentType.blockState();
private static final BlockStateArgumentType BLOCK_STATE_PARSER = BlockStateArgumentType.blockState(new CommandRegistryAccess(DynamicRegistryManager.BUILTIN.get()));

/**
* Partially determines whether Colormatic should replace the tint on a model.
Expand Down
Loading

0 comments on commit 9e6ef28

Please sign in to comment.