your current location:首页 > news>CRT removal/disabled item enchant

CRT removal/disabled item enchant

2024-12-10 17:48:15|Myriagame |source:minecraft skins

This tutorial is set by the author's setting without permission.

Foreword: The applicable version of the tutorial is MC1.19.2

Some mods provide supermodels, causing collapse, or unwanted enchantment for other reasons.

It can be removed by the following incidents:

LivingquipmentChangeEvent

There are many incidents that can operate the items,

But considering factors such as performance overhead,

This tutorial only provides a commonly used event to share.

Note: CRT is only used as a personal reference learning, and the main use of KJS;

Basic code or in -depth usage will not be explained in detail.

 Import Crafttweaker.api.Events.CTEVENTMANAGER;

import crafttweaker.api.event.event;

Import crafttweaker.api.event.entity.entityevent;

Import crafttweaker.api.event.entity.living.living;

import crafttweaker.api.item.iitemstack;

Import crafttweaker.api.entity.equipment.equipmentslot;

Import crafttweaker.api.Item.enchantment.enchantment;

Import Crafttweaker.api.event.entity.living.livingquipmentChangeEvent;

Import crafttweaker.api.entity.entity;

Import crafttweaker.api.entity.entityType;

import crafttweaker.api.entity.livingntity;

// Any entity arbitrarily grooves attached magic correction

CteventManager.register {

Var Entity = Event.entityliving;

Var level = Entity.Level;

If (level.isclientside) {Return;}

Var slot = event.getslot ();

Var item = event.getto ();

// Example sweeping the blade

Var enchantment = ;

Var lv = item.GetenchantmentLevel (enchantment);

If (lv> 0) {{

Entity.setITEMSLOT (slot, item.removeenchantment (enchantment));

}});

Effect map: When holding it in your hand, the enchantment will be removed

It can be triggered regardless of the deputy of the master or the armor groove.

If you want to continue adding new enchantment, you can write down directly:

 enchantment = ;

Lv = item.GetenchantmentLevel (enchantment);

If (lv> 0) {{

Entity.setITEMSLOT (slot, item.removeenchantment (enchantment));

}

Simply put, the above code has no more VAR.

The cycle code is not in the scope of this tutorial.

Remarks: Some items that do not require equipment/handheld will not be affected by this incident. If there is a need, you should consider monitoring backpack changes.