Skip to content

Commit

Permalink
Update to 1.14.4 (holding out for yarn pr)
Browse files Browse the repository at this point in the history
  • Loading branch information
kvverti committed Jul 23, 2019
1 parent fbf9f24 commit ce597be
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.14.2
yarn_mappings=1.14.2+build.7
loader_version=0.4.7+build.147
minecraft_version=1.14.4
yarn_mappings=1.14.4+build.2
loader_version=0.4.7+build.157

# Mod Properties
mod_version = 1.1.0
Expand All @@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1G

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
fabric_version=0.3.0+build.176
fabric_version=0.3.0+build.200
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@

import io.github.kvverti.colormatic.Colormatic;

import net.minecraft.ChatFormat;
import net.minecraft.util.Formatting;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ChatFormat.class)
@Mixin(Formatting.class)
public abstract class ChatFormatMixin {

@Shadow public abstract boolean isColor();

@Inject(method = "getColor", at = @At("HEAD"), cancellable = true)
@Inject(method = "getColorValue", at = @At("HEAD"), cancellable = true)
private void onColor(CallbackInfoReturnable<Integer> info) {
if(isColor()) {
int color = Colormatic.COLOR_PROPS.getProperties().getText((ChatFormat)(Object)this);
int color = Colormatic.COLOR_PROPS.getProperties().getText((Formatting)(Object)this);
if(color != 0) {
info.setReturnValue(color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import java.util.HashMap;
import java.util.Map;

import net.minecraft.ChatFormat;
import net.minecraft.block.MaterialColor;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.registry.Registry;
Expand Down Expand Up @@ -61,7 +61,7 @@ public class GlobalColorProperties {
private final Map<DyeColor, HexColor> banner;
private final Map<MaterialColor, HexColor> map;
private final Map<EntityType<?>, int[]> spawnEgg;
private final Map<ChatFormat, HexColor> textColor;
private final Map<Formatting, HexColor> textColor;
private final TextColor text;
private final int xpOrbTime;

Expand All @@ -85,7 +85,7 @@ private GlobalColorProperties(Settings settings) {
for(Map.Entry<Integer, HexColor> entry : text.code.entrySet()) {
int code = entry.getKey();
if(code < 16) {
ChatFormat color = ChatFormat.byId(code);
Formatting color = Formatting.byColorIndex(code);
textColor.put(color, entry.getValue());
}
}
Expand Down Expand Up @@ -241,7 +241,7 @@ public int getSignText(DyeColor color) {
return getColor(color, text.sign);
}

public int getText(ChatFormat color) {
public int getText(Formatting color) {
return getColor(color, textColor);
}

Expand Down Expand Up @@ -347,7 +347,7 @@ private static class TextColor {
HexColor xpbar;
ButtonText button = new ButtonText();
Map<DyeColor, HexColor> sign = Collections.emptyMap();
Map<ChatFormat, HexColor> format = Collections.emptyMap();
Map<Formatting, HexColor> format = Collections.emptyMap();
Map<Integer, HexColor> code = Collections.emptyMap();

static class ButtonText {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
import java.util.function.Function;
import java.util.function.Predicate;

import net.minecraft.ChatFormat;
import net.minecraft.block.MaterialColor;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;

/**
Expand All @@ -51,7 +51,7 @@ public class PropertyUtil {
.registerTypeAdapter(ApplicableBlockStates.class, new ApplicableBlockStatesAdapter())
.registerTypeAdapter(HexColor.class, new HexColorAdapter())
.registerTypeAdapter(MaterialColor.class, new MaterialColorAdapter())
.registerTypeAdapter(ChatFormat.class, new ChatFormatAdapter())
.registerTypeAdapter(Formatting.class, new ChatFormatAdapter())
.create();

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ public static PropertyImage loadColormap(ResourceManager manager, Identifier id,
return new PropertyImage(props, null);
}
try(Resource rsc = manager.getResource(props.getSource()); InputStream in = rsc.getInputStream()) {
NativeImage image = NativeImage.fromInputStream(in);
NativeImage image = NativeImage.read(in);
// swap the red and blue channels of every pixel, because the biome
// colormap expects ARGB, but NativeImage is ABGR
for(int x = 0; x < image.getWidth(); x++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@

import java.io.IOException;

import net.minecraft.ChatFormat;
import net.minecraft.util.Formatting;

public class ChatFormatAdapter extends TypeAdapter<ChatFormat> {
public class ChatFormatAdapter extends TypeAdapter<Formatting> {

@Override
public ChatFormat read(JsonReader in) throws IOException {
public Formatting read(JsonReader in) throws IOException {
if(in.peek() == JsonToken.NULL) {
in.nextNull();
throw new JsonSyntaxException(new NullPointerException("Required nonnull"));
}
String name = in.nextString();
return ChatFormat.getFormatByName(name);
return Formatting.byName(name);
}

@Override
public void write(JsonWriter out, ChatFormat value) throws IOException {
public void write(JsonWriter out, Formatting value) throws IOException {
if(value == null) {
out.nullValue();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ private int mergeColors(int a, int b, float aweight) {
public CompletableFuture<NativeImage> load(ResourceManager manager, Profiler profiler, Executor executor) {
return CompletableFuture.supplyAsync(() -> {
try(Resource rsc = manager.getResource(id); InputStream in = rsc.getInputStream()) {
return NativeImage.fromInputStream(in);
return NativeImage.read(in);
} catch(IOException e) {
// try optifine ID
try(Resource rsc = manager.getResource(optifineId); InputStream in = rsc.getInputStream()) {
return NativeImage.fromInputStream(in);
return NativeImage.read(in);
} catch(IOException e2) {
// no lightmap
return null;
Expand Down

0 comments on commit ce597be

Please sign in to comment.