de.pewpewproject.lasertag.item.Items.register()   B
last analyzed

Complexity

Conditions 1

Size

Total Lines 101
Code Lines 90

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 90
dl 0
loc 101
rs 7.3272
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
package de.pewpewproject.lasertag.item;
2
3
import de.pewpewproject.lasertag.LasertagMod;
4
import de.pewpewproject.lasertag.block.Blocks;
5
import de.pewpewproject.lasertag.item.material.LaserVestMaterial;
6
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
7
import net.minecraft.item.ArmorMaterial;
8
import net.minecraft.item.BlockItem;
9
import net.minecraft.item.Item;
10
import net.minecraft.util.Identifier;
11
import net.minecraft.util.Rarity;
12
import net.minecraft.util.registry.Registry;
13
14
/**
15
 * Class for registering all items
16
 *
17
 * @author Étienne Muser
18
 */
19
public class Items {
20
21
    // Create instances for all materials
22
    public static final ArmorMaterial LASERVEST_MATERIAL = new LaserVestMaterial();
23
24
    // Create instances for all items
25
    public static final Item LASERTAG_WEAPON = new LasertagWeaponItem(new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC));
26
    public static final Item LASERTAG_VEST = new LasertagVestItem(LASERVEST_MATERIAL, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP).rarity(Rarity.EPIC));
27
28
    // Block items
29
    public static final Item LASERTAG_FLAG = new LasertagFlagItem();
30
31
    public static void register() {
32
33
        // Block items
34
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_orange"),
35
                new BlockItem(Blocks.ARENA_BLOCK_ORANGE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
36
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_pink"),
37
                new BlockItem(Blocks.ARENA_BLOCK_PINK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
38
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_blue"),
39
                new BlockItem(Blocks.ARENA_BLOCK_BLUE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
40
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_yellow"),
41
                new BlockItem(Blocks.ARENA_BLOCK_YELLOW, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
42
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_green"),
43
                new BlockItem(Blocks.ARENA_BLOCK_GREEN, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
44
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_purple"),
45
                new BlockItem(Blocks.ARENA_BLOCK_PURPLE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
46
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_red"),
47
                new BlockItem(Blocks.ARENA_BLOCK_RED, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
48
49
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_orange"),
50
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_ORANGE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
51
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_pink"),
52
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_PINK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
53
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_blue"),
54
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_BLUE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
55
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_yellow"),
56
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_YELLOW, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
57
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_green"),
58
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_GREEN, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
59
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_purple"),
60
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_PURPLE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
61
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pillar_block_red"),
62
                new BlockItem(Blocks.ARENA_PILLAR_BLOCK_RED, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
63
64
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_orange"),
65
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_ORANGE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
66
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_pink"),
67
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_PINK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
68
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_blue"),
69
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_BLUE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
70
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_yellow"),
71
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_YELLOW, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
72
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_green"),
73
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_GREEN, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
74
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_purple"),
75
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_PURPLE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
76
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_stairs_red"),
77
                new BlockItem(Blocks.ARENA_BLOCK_STAIRS_RED, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
78
79
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_orange"),
80
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_ORANGE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
81
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_pink"),
82
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_PINK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
83
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_blue"),
84
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_BLUE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
85
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_yellow"),
86
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_YELLOW, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
87
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_green"),
88
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_GREEN, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
89
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_purple"),
90
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_PURPLE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
91
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_slab_red"),
92
                new BlockItem(Blocks.ARENA_BLOCK_SLAB_RED, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
93
94
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_orange"),
95
                new BlockItem(Blocks.ARENA_DIVIDER_ORANGE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
96
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_pink"),
97
                new BlockItem(Blocks.ARENA_DIVIDER_PINK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
98
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_blue"),
99
                new BlockItem(Blocks.ARENA_DIVIDER_BLUE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
100
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_yellow"),
101
                new BlockItem(Blocks.ARENA_DIVIDER_YELLOW, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
102
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_green"),
103
                new BlockItem(Blocks.ARENA_DIVIDER_GREEN, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
104
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_purple"),
105
                new BlockItem(Blocks.ARENA_DIVIDER_PURPLE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
106
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_divider_red"),
107
                new BlockItem(Blocks.ARENA_DIVIDER_RED, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
108
109
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_block_dark"),
110
                new BlockItem(Blocks.ARENA_BLOCK_DARK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
111
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "arena_pressure_plate"),
112
                new BlockItem(Blocks.ARENA_PRESSURE_PLATE, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
113
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertarget"),
114
                new BlockItem(Blocks.LASER_TARGET, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
115
116
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "game_manager"),
117
                new BlockItem(Blocks.LASERTAG_GAME_MANAGER_BLOCK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
118
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "team_selector"),
119
                new BlockItem(Blocks.LASERTAG_TEAM_SELECTOR_BLOCK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
120
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertag_credits_button"),
121
                new BlockItem(Blocks.LASERTAG_CREDITS_BUTTON, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
122
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertag_start_game_button"),
123
                new BlockItem(Blocks.LASERTAG_START_GAME_BUTTON, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
124
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "team_zone_generator"),
125
                new BlockItem(Blocks.LASERTAG_TEAM_ZONE_GENERATOR_BLOCK, new FabricItemSettings().group(ItemGroups.LASERTAG_ITEM_GROUP)));
126
127
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertag_flag"), LASERTAG_FLAG);
128
129
        // Normal items
130
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertag_weapon"), LASERTAG_WEAPON);
131
        Registry.register(Registry.ITEM, new Identifier(LasertagMod.ID, "lasertag_vest"), LASERTAG_VEST);
132
    }
133
}
134