fix(coat-bridge, fabric-helper): Fix various issues
This commit is contained in:
@@ -94,12 +94,14 @@ public class TweedCoatMappersImpl {
|
||||
|
||||
@Override
|
||||
public TweedCoatEntryMappingResult<T, String> mapEntry(ConfigEntry<T> entry, TweedCoatEntryMappingContext context) {
|
||||
boolean applicable = anyClassMatches(entry.valueClass(), valueClasses);
|
||||
if (!anyClassMatches(entry.valueClass(), valueClasses)) {
|
||||
return TweedCoatEntryMappingResult.notApplicable();
|
||||
}
|
||||
|
||||
return new TweedCoatEntryMappingResult<T, String>() {
|
||||
@Override
|
||||
public boolean isApplicable() {
|
||||
return applicable;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -198,12 +200,7 @@ public class TweedCoatMappersImpl {
|
||||
|
||||
@Override
|
||||
public TweedCoatEntryMappingResult<T, T> mapEntry(ConfigEntry<T> entry, TweedCoatEntryMappingContext context) {
|
||||
matchingClass: {
|
||||
for (Class<T> valueClass : valueClasses) {
|
||||
if (entry.valueClass() == valueClass) {
|
||||
break matchingClass;
|
||||
}
|
||||
}
|
||||
if (!anyClassMatches(entry.valueClass(), valueClasses)) {
|
||||
return TweedCoatEntryMappingResult.notApplicable();
|
||||
}
|
||||
|
||||
@@ -359,9 +356,9 @@ public class TweedCoatMappersImpl {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean anyClassMatches(Object value, Class<?>... classes) {
|
||||
private static boolean anyClassMatches(Class<?> valueClass, Class<?>... classes) {
|
||||
for (Class<?> clazz : classes) {
|
||||
if (clazz.isInstance(value)) {
|
||||
if (clazz.isAssignableFrom(valueClass)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TweedCoatBridgeTestMod implements ClientModInitializer {
|
||||
|
||||
KeyBindingHelper.registerKeyBinding(new ScreenKeyBinding(MOD_ID + ".config", 84, KeyMapping.Category.MISC));
|
||||
|
||||
log.info("current config");
|
||||
log.info("Current config: " + config);
|
||||
}
|
||||
|
||||
private class ScreenKeyBinding extends KeyMapping implements PriorityKeyBinding {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package de.siphalor.tweed5.coat.bridge.testmod;
|
||||
|
||||
import de.siphalor.tweed5.coat.bridge.api.TweedCoatAttributes;
|
||||
import de.siphalor.tweed5.coat.bridge.api.TweedCoatBridgeExtension;
|
||||
import de.siphalor.tweed5.fabric.helper.api.DefaultTweedMinecraftWeaving;
|
||||
import de.siphalor.tweed5.weaver.pojo.api.annotation.CompoundWeaving;
|
||||
import de.siphalor.tweed5.weaver.pojo.api.annotation.PojoWeaving;
|
||||
import de.siphalor.tweed5.weaver.pojo.api.annotation.TweedExtension;
|
||||
import de.siphalor.tweed5.weaver.pojoext.attributes.api.Attribute;
|
||||
import de.siphalor.tweed5.weaver.pojoext.validation.api.Validator;
|
||||
import de.siphalor.tweed5.weaver.pojoext.validation.api.validators.WeavableNumberRangeValidator;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
@PojoWeaving
|
||||
@DefaultTweedMinecraftWeaving
|
||||
@TweedExtension(TweedCoatBridgeExtension.class)
|
||||
@CompoundWeaving(namingFormat = "kebab_case")
|
||||
@Data
|
||||
public class TweedCoatBridgeTestModConfig {
|
||||
@@ -26,9 +25,11 @@ public class TweedCoatBridgeTestModConfig {
|
||||
@Attribute(key = TweedCoatAttributes.BACKGROUND_TEXTURE, values = "textures/block/red_terracotta.png")
|
||||
private Greeting clientGreeting = new Greeting("Hello client!", "Client");
|
||||
|
||||
@CompoundWeaving
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@CompoundWeaving
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
public static class Greeting {
|
||||
public String greeting;
|
||||
public String greeter;
|
||||
|
||||
Reference in New Issue
Block a user