Armor module

Armor: Minecraft 26.3 cheat module, full source for every implementation (1 client: Nicotine).

1 implementationHUD

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

NicotineHUDsrc/client/java/nicotine/mod/mods/hud/Armor.javaJava · 72 lines · 2.3 KB
Armor.javaJava · Minecraft 26.3 · 72 lines · 2.3 KB · complete file, verbatimOriginal ↗
1
package nicotine.mod.mods.hud;
2
3
import net.minecraft.core.component.DataComponents;
4
import net.minecraft.world.entity.EquipmentSlot;
5
import net.minecraft.world.item.Item;
6
import net.minecraft.world.item.ItemStack;
7
import net.minecraft.world.item.Items;
8
import nicotine.events.GuiRenderAfterEvent;
9
import nicotine.mod.ModCategory;
10
import nicotine.mod.HUDMod;
11
import nicotine.util.EventBus;
12
import nicotine.util.Player;
13
14
import java.util.HashMap;
15
import java.util.List;
16
17
import static nicotine.util.Common.mc;
18
19
public class Armor extends HUDMod {
20
21
    public Armor() {
22
        super(ModCategory.HUD, "Armor");
23
    }
24
25
    @Override
26
    protected void init() {
27
        EventBus.register(GuiRenderAfterEvent.class, event -> {
28
            if (!this.enabled)
29
                return true;
30
31
            int posX = (mc.getWindow().getGuiScaledWidth() / 2) + 19;
32
            int posY = mc.getWindow().getGuiScaledHeight() - 59;
33
34
            HashMap<Integer, Integer> armorCount= new HashMap<>();
35
36
            List<ItemStack> armorItems = Player.getArmorItems();
37
38
            ItemStack chestplate = armorItems.get(2);
39
40
            for (int i = 0; i <= 35; i++) {
41
                Item curItem = mc.player.getInventory().getItem(i).getItem();
42
                if (curItem.components().has(DataComponents.EQUIPPABLE)) {
43
                    EquipmentSlot equipmentSlot = curItem.components().get(DataComponents.EQUIPPABLE).slot();
44
45
46
                    if (equipmentSlot.getIndex() == 2) {
47
                        if ((chestplate.getItem() != Items.ELYTRA && curItem == Items.ELYTRA) ||
48
                                (chestplate.getItem() == Items.ELYTRA && curItem != Items.ELYTRA)) {
49
                            continue;
50
                        }
51
                    }
52
53
                    int amount = armorCount.getOrDefault(equipmentSlot.getIndex(), 1) + 1;
54
                    armorCount.put(equipmentSlot.getIndex(), amount);
55
                }
56
            }
57
58
            posX += 18 * 4;
59
60
            for (int i = 0; i < armorItems.size(); i++) {
61
62
                posX -= 18;
63
64
                event.drawContext.fakeItem(armorItems.get(i), posX, posY);
65
                event.drawContext.itemDecorations(mc.font, armorItems.get(i), posX, posY, armorCount.getOrDefault(i, 1).toString());
66
            }
67
68
            return true;
69
        });
70
    }
71
}
72