aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-02-15 12:21:57 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-02-15 12:28:36 +0200
commit972e6c330d03f205ab738ed28c4e47496f30e92d (patch)
treec90360cb169cdb53b608ede798020ae2ac20d85e /src/main
parent32caf009812501e9e9a8f9d835726f12723c4a17 (diff)
downloadCITResewn-972e6c330d03f205ab738ed28c4e47496f30e92d.tar.gz
CITResewn-972e6c330d03f205ab738ed28c4e47496f30e92d.tar.bz2
CITResewn-972e6c330d03f205ab738ed28c4e47496f30e92d.zip
Ported item type (missing asset resolution)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java3
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java2
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITType.java6
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParsingException.java2
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java6
-rw-r--r--src/main/resources/citresewn.accesswidener30
6 files changed, 15 insertions, 34 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
index 99cdbf0..b2dd2cd 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITContext.java
@@ -1,5 +1,6 @@
package shcm.shsupercm.fabric.citresewn.cit;
+import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -13,7 +14,7 @@ public class CITContext {
public CITContext(ItemStack stack, World world, LivingEntity entity) {
this.stack = stack;
- this.world = world;
+ this.world = world == null ? MinecraftClient.getInstance().world : world;
this.entity = entity;
}
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
index 33f6367..fb0f793 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
@@ -55,7 +55,7 @@ public class CITRegistry {
public static CITType parseType(PropertyGroup properties) throws CITParsingException {
Identifier type = new Identifier("citresewn", "item");
- PropertyValue propertiesType = properties.getLast("citresewn", "type");
+ PropertyValue propertiesType = properties.getLastWithoutMetadata("citresewn", "type");
if (propertiesType != null) {
String value = propertiesType.value();
if (!value.contains(":"))
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITType.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITType.java
index abbe755..b618dde 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITType.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITType.java
@@ -1,10 +1,16 @@
package shcm.shsupercm.fabric.citresewn.cit;
+import shcm.shsupercm.fabric.citresewn.CITResewn;
import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
+import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue;
import java.util.List;
public abstract class CITType {
public abstract void load(List<? extends CITCondition> conditions, PropertyGroup properties) throws CITParsingException;
+
+ protected void warn(String message, PropertyValue value, PropertyGroup properties) {
+ CITResewn.logWarnLoading("Warning: " + CITParsingException.descriptionOf(message, properties, value.position()));
+ }
}
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParsingException.java b/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParsingException.java
index 964b58d..384014b 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParsingException.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParsingException.java
@@ -8,6 +8,6 @@ public class CITParsingException extends Exception {
}
public static String descriptionOf(String message, PropertyGroup propertyGroup, int position) {
- return message + " at " + position + " in " + propertyGroup.identifier.toString() + " from " + propertyGroup.packName;
+ return message + (position != -1 ? " line " + position : "") + " in " + propertyGroup.identifier.toString() + " from " + propertyGroup.packName;
}
}
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
index 6955ac1..b2806a2 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
@@ -40,9 +40,11 @@ public abstract class PropertyGroup {
return values;
}
- public PropertyValue getLast(String namespace, String... pathAliases) {
+ public PropertyValue getLastWithoutMetadata(String namespace, String... pathAliases) {
PropertyValue value = null;
- for (Iterator<PropertyValue> iterator = get(namespace, pathAliases).iterator(); iterator.hasNext(); value = iterator.next());
+ for (PropertyValue next : get(namespace, pathAliases))
+ if (next.keyMetadata() == null)
+ value = next;
return value;
}
diff --git a/src/main/resources/citresewn.accesswidener b/src/main/resources/citresewn.accesswidener
index 33ad46d..dfde67a 100644
--- a/src/main/resources/citresewn.accesswidener
+++ b/src/main/resources/citresewn.accesswidener
@@ -1,29 +1 @@
-accessWidener v1 named
-
-# net.minecraft.client.render.model.json.ModelOverrideList
-accessible class net/minecraft/client/render/model/json/ModelOverrideList$BakedOverride
-accessible class net/minecraft/client/render/model/json/ModelOverrideList$InlinedCondition
-accessible method net/minecraft/client/render/model/json/ModelOverrideList <init> ()V
-accessible method net/minecraft/client/render/model/json/ModelOverrideList$BakedOverride <init> ([Lnet/minecraft/client/render/model/json/ModelOverrideList$InlinedCondition;Lnet/minecraft/client/render/model/BakedModel;)V
-accessible method net/minecraft/client/render/model/json/ModelOverrideList$InlinedCondition <init> (IF)V
-accessible field net/minecraft/client/render/model/json/ModelOverrideList overrides [Lnet/minecraft/client/render/model/json/ModelOverrideList$BakedOverride;
-mutable field net/minecraft/client/render/model/json/ModelOverrideList overrides [Lnet/minecraft/client/render/model/json/ModelOverrideList$BakedOverride;
-accessible field net/minecraft/client/render/model/json/ModelOverrideList conditionTypes [Lnet/minecraft/util/Identifier;
-mutable field net/minecraft/client/render/model/json/ModelOverrideList conditionTypes [Lnet/minecraft/util/Identifier;
-
-# net.minecraft.client.render.RenderLayer
-accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
-accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;ILnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;
-
-# net.minecraft.client.render.RenderPhase
-accessible class net/minecraft/client/render/RenderPhase$Shader
-accessible class net/minecraft/client/render/RenderPhase$Texturing
-accessible class net/minecraft/client/render/RenderPhase$Transparency
-accessible class net/minecraft/client/render/RenderPhase$Texture
-accessible class net/minecraft/client/render/RenderPhase$Lightmap
-accessible class net/minecraft/client/render/RenderPhase$Overlay
-accessible class net/minecraft/client/render/RenderPhase$Cull
-accessible class net/minecraft/client/render/RenderPhase$DepthTest
-accessible class net/minecraft/client/render/RenderPhase$WriteMaskState
-accessible class net/minecraft/client/render/RenderPhase$Layering
-accessible class net/minecraft/client/render/RenderPhase$Target \ No newline at end of file
+accessWidener v1 named \ No newline at end of file