sp614x / optifine

1.8k stars 418 forks source link

CIT type=enchantment doesn't work when no enchantment is specified #3198

Open Foobin opened 4 years ago

Foobin commented 4 years ago

I am trying to use optifine to remove the enchantment glint texture from a written book. Unfortunately, optifine seems to require an enchantment property to be set for the enchantment cit type. As the cit_single.properties does not explicitly require this property to be set, I believe this to be a bug:

# (Optional) List of enchantment names.
# The enchantment names may be short ("flame") or full ("minecraft:flame").
# For example:
#   enchantments=minecraft:silk_touch sharpness smite 
# The legacy property "enchantmentIDs" is also recognized.
enchantments=<enchantment names>

When the resource pack is loaded by the game, optifine prints the following warning to console: [OptiFine] No enchantmentIDs specified: optifine/cit/disable_enchant.properties

The workaround I have found for now is to apply a ridiculously high existing useless enchantment to the book (with the nbt tag HideTags:1), and then looking for that exact enchantment and using blend=replace. However, this seems somewhat hacky.

Anslean commented 3 years ago

@Foobin can you share your related files? Every other person I've seen have issues with this wasn't even able to use type=enchantment at all. I'd love to settle for what you've got going while I wait for the fix.

Foobin commented 3 years ago

@Anslean type=enchantment only works if you also specify the name of the enchantment you want to target using enchantments=<enchantment names> (hence bug report). In my case, I specifically wanted a setup where I could disable the enchantment effect on a particular item using nbt data, regardless of what enchantments were or weren't on the item.

So in the case of non-armor items I added a protection enchantment with a really high level - around 100 I think. I was then able to target the item using the enchantmentLevels=<enchantment levels 0-255> tag:

type=enchantment
enchantments=protection
enchantmentLevels=100

This way I could selectively choose which items to disable the enchantment effect on. I hope that helps!

TheTexasDev commented 1 year ago

I can't get your method to work. I've got a .properties file in my optifine/cit/ folder and i've got

type=enchantment
enchantments=minecraft:knockback
texture=misc/empty_glint.png

where empty_glint.png is just a black image. but it still won't blank out the glint from items and optifine is not giving me any errors or warnings.