InexactCIT 图标

InexactCIT

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/inexactcit
资源信息

Minecraft 版本: 1.21.8

平台: fabric

标签: decoration utility

资源介绍

Restoring pattern-based conditional item models.

Purpose

The Custom Item Textures (CIT) mod, originally part of McPatcher and then
Optifine, allowed the replacement of item textures (and models) whose
metadata matched inexact patterns. We now have near-equivalent item-texture
replacement in standard Minecraft with conditional client item types, though
inexact matching is no longer possible. This mod adds CIT replacement with
regular expressions to the new standard conditional item definition system.

Compatibility and Dependencies

  • Minecraft: 1.21.8
  • Loader: Fabric 0.136.1

Fabric API not required.

Installation

Add the mod JAR to your Fabric mods folder.

Usage (Players)

This mod adds a feature to item model definitions which can be used by
resource pack designers. It is always active when the mod is installed.

Resource Pack Integration (Pack Authors)

The JSON files found at assets/minecraft/item are item definitions.
These are not necessarily the model file used to render an item (i.e. an
item model), which are found at assets/minecraft/models/item.

In an item definition file, the JSON object in the "model" field determines
which model file is used to render an item. Typically, a single item type is
always rendered with the same model, so this object has its "type" set to
minecraft:model. But different models can be used for the same item in
different contexts by using "model" objects with other types, such as
minecraft:condition and minecraft:select.

This mod adds the inexactcit:match item definition model type. It is
similar to the built-in select type in that it contains a list of models
with associated conditions, and when one condition matches, its associated
model is used to render the item. Unlike Select, the Match conditions are
potentially-inexact regular expressions.

Match item definition models use the same fields as Select, particularly
"property", "component", "cases", and "fallback".

Labeled Field Structure
    { "model":
      { "type": "inexactcit:match"
      , "property":  ...     # Probably always minecraft:component
      , "component": ...     # Name of component to target
      , "cases":
        [ { "regex": ...     # Regular expression for this case
          , "model": { ... } # Item def'n. model used when regexp matches
          }
        , ...                # Another case, as above
        , ...                # Any number of additional cases
        ]
      , "fallback": { ... }  # Item def'n. model used when no case matches
      }
    }
Required Fields

Regular expression matching is intended for text metadata, so the "property"
field will be minecraft:component. Behavior when "property" is not
minecraft:component is as yet untested.

The "component" field should be set to the namespaced ID for the component
that will be tested by the condition, e.g. minecraft:lore,
minecraft:custom_name.

The "cases" field must contain a list of JSON objects. Each object is to
contain a "regex" field and corresponding "model" field. These must be a
(Java-flavored) regular expression and an item definition model, respectively.
When the regular expression matches against the contents of the component
named in the "component" field, the corresponding model is used for that item.

The "fallback" field gives a model that is used when none of the "case"
objects match, same as the standard Select.

Example

The following is an example of a Match item definition. It replaces all
wooden hoes whose names include the word "Quarterstaff" with the model at
pixelatedvolume:item/quarterstaff.

    { "model":
      { "type": "inexactcit:match"
      , "property": "minecraft:component"
      , "component": "minecraft:custom_name"
      , "cases":
        [ { "model":
            { "model": "pixelatedvolume:item/quarterstaff"
            , "type": "minecraft:model"
            }
          , "regex": ".*Quarterstaff.*"
          }
        ]
      , "fallback":
        { "model": "minecraft:item/wooden_hoe"
        , "type": "minecraft:model"
        }
      }
      , "oversized_in_gui": true
    }
Text Comparison

The contents of the field being examined is serialized with toString.
Text-component (JSON) features, section-code formatting, etc, is all pushed
into this comparison string, so there is no way of telling what might come
before or after the text that is visible in-game, or what happens between
lines of multiline compontents.

Regular Expression or Model Errors

An item definition file with a malformed regular expression cannot be read
so the item will appear with the default model (margenta-and-black cube).
The failure (with the faulty file) is logged as an Error at pack-load time.

Multiple Target Components

To give one item multiple replacement rules that use different components
(e.g. one set of rules for lore and one set for custom_name), set the
fallback model to a new Match client item model that selects the second
component.

Status

The ability to match properties other than minecraft:component will be added
eventually. Currently, such matches are accepted without error, but they have
no effect.

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Simple Health Indicators

价格:0 墨喵币
下载量:0

查看详情
Throw Your Axes

价格:0 墨喵币
下载量:0

查看详情
Fearplay Totem of Undying

价格:0 墨喵币
下载量:0

查看详情
Floating Excavation

价格:0 墨喵币
下载量:0

查看详情