| Conditions | 71 | 
| Total Lines | 79 | 
| Code Lines | 73 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
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:
If many parameters/temporary variables are present:
Complex classes like de.kleiner3.lasertag.block.models.BlockModelProvider.loadModelResource(Identifier,ModelProviderContext) often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
| 1 | package de.kleiner3.lasertag.block.models;  | 
            ||
| 109 | @Override  | 
            ||
| 110 |     public @Nullable UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException { | 
            ||
| 111 |         if (resourceId.equals(ORANGE_ARENA_BLOCK) || resourceId.equals(ORANGE_ARENA_BLOCK_ITEM)) { | 
            ||
| 112 | return new OrangeArenaBlockModel();  | 
            ||
| 113 |         } else if(resourceId.equals(PINK_ARENA_BLOCK) || resourceId.equals(PINK_ARENA_BLOCK_ITEM)){ | 
            ||
| 114 | return new PinkArenaBlockModel();  | 
            ||
| 115 |         } else if(resourceId.equals(BLUE_ARENA_BLOCK) || resourceId.equals(BLUE_ARENA_BLOCK_ITEM)){ | 
            ||
| 116 | return new BlueArenaBlockModel();  | 
            ||
| 117 |         } else if(resourceId.equals(YELLOW_ARENA_BLOCK) || resourceId.equals(YELLOW_ARENA_BLOCK_ITEM)){ | 
            ||
| 118 | return new YellowArenaBlockModel();  | 
            ||
| 119 |         } else if(resourceId.equals(GREEN_ARENA_BLOCK) || resourceId.equals(GREEN_ARENA_BLOCK_ITEM)){ | 
            ||
| 120 | return new GreenArenaBlockModel();  | 
            ||
| 121 |         } else if(resourceId.equals(PURPLE_ARENA_BLOCK) || resourceId.equals(PURPLE_ARENA_BLOCK_ITEM)){ | 
            ||
| 122 | return new PurpleArenaBlockModel();  | 
            ||
| 123 |         } else if(resourceId.equals(RED_ARENA_BLOCK) || resourceId.equals(RED_ARENA_BLOCK_ITEM)){ | 
            ||
| 124 | return new RedArenaBlockModel();  | 
            ||
| 125 | |||
| 126 |         } else if (resourceId.equals(ORANGE_ARENA_PILLAR_BLOCK) || resourceId.equals(ORANGE_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 127 | return new OrangeArenaPillarBlockModel();  | 
            ||
| 128 |         } else if (resourceId.equals(PINK_ARENA_PILLAR_BLOCK) || resourceId.equals(PINK_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 129 | return new PinkArenaPillarBlockModel();  | 
            ||
| 130 |         } else if (resourceId.equals(BLUE_ARENA_PILLAR_BLOCK) || resourceId.equals(BLUE_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 131 | return new BlueArenaPillarBlockModel();  | 
            ||
| 132 |         } else if (resourceId.equals(YELLOW_ARENA_PILLAR_BLOCK) || resourceId.equals(YELLOW_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 133 | return new YellowArenaPillarBlockModel();  | 
            ||
| 134 |         } else if (resourceId.equals(GREEN_ARENA_PILLAR_BLOCK) || resourceId.equals(GREEN_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 135 | return new GreenArenaPillarBlockModel();  | 
            ||
| 136 |         } else if (resourceId.equals(PURPLE_ARENA_PILLAR_BLOCK) || resourceId.equals(PURPLE_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 137 | return new PurpleArenaPillarBlockModel();  | 
            ||
| 138 |         } else if (resourceId.equals(RED_ARENA_PILLAR_BLOCK) || resourceId.equals(RED_ARENA_PILLAR_BLOCK_ITEM)) { | 
            ||
| 139 | return new RedArenaPillarBlockModel();  | 
            ||
| 140 | |||
| 141 |         } else if (resourceId.equals(ORANGE_ARENA_BLOCK_STAIRS) || resourceId.equals(ORANGE_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 142 | return new OrangeArenaBlockStairsModel();  | 
            ||
| 143 |         } else if (resourceId.equals(PINK_ARENA_BLOCK_STAIRS) || resourceId.equals(PINK_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 144 | return new PinkArenaBlockStairsModel();  | 
            ||
| 145 |         } else if (resourceId.equals(BLUE_ARENA_BLOCK_STAIRS) || resourceId.equals(BLUE_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 146 | return new BlueArenaBlockStairsModel();  | 
            ||
| 147 |         } else if (resourceId.equals(YELLOW_ARENA_BLOCK_STAIRS) || resourceId.equals(YELLOW_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 148 | return new YellowArenaBlockStairsModel();  | 
            ||
| 149 |         } else if (resourceId.equals(GREEN_ARENA_BLOCK_STAIRS) || resourceId.equals(GREEN_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 150 | return new GreenArenaBlockStairsModel();  | 
            ||
| 151 |         } else if (resourceId.equals(PURPLE_ARENA_BLOCK_STAIRS) || resourceId.equals(PURPLE_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 152 | return new PurpleArenaBlockStairsModel();  | 
            ||
| 153 |         } else if (resourceId.equals(RED_ARENA_BLOCK_STAIRS) || resourceId.equals(RED_ARENA_BLOCK_STAIRS_ITEM)) { | 
            ||
| 154 | return new RedArenaBlockStairsModel();  | 
            ||
| 155 | |||
| 156 |         } else if (resourceId.equals(ORANGE_ARENA_DIVIDER) || resourceId.equals(ORANGE_ARENA_DIVIDER_ITEM)) { | 
            ||
| 157 | return new OrangeArenaDividerBlockModel();  | 
            ||
| 158 |         } else if (resourceId.equals(PINK_ARENA_DIVIDER) || resourceId.equals(PINK_ARENA_DIVIDER_ITEM)) { | 
            ||
| 159 | return new PinkArenaDividerBlockModel();  | 
            ||
| 160 |         } else if (resourceId.equals(BLUE_ARENA_DIVIDER) || resourceId.equals(BLUE_ARENA_DIVIDER_ITEM)) { | 
            ||
| 161 | return new BlueArenaDividerBlockModel();  | 
            ||
| 162 |         } else if (resourceId.equals(YELLOW_ARENA_DIVIDER) || resourceId.equals(YELLOW_ARENA_DIVIDER_ITEM)) { | 
            ||
| 163 | return new YellowArenaDividerBlockModel();  | 
            ||
| 164 |         } else if (resourceId.equals(GREEN_ARENA_DIVIDER) || resourceId.equals(GREEN_ARENA_DIVIDER_ITEM)) { | 
            ||
| 165 | return new GreenArenaDividerBlockModel();  | 
            ||
| 166 |         } else if (resourceId.equals(PURPLE_ARENA_DIVIDER) || resourceId.equals(PURPLE_ARENA_DIVIDER_ITEM)) { | 
            ||
| 167 | return new PurpleArenaDividerBlockModel();  | 
            ||
| 168 |         } else if (resourceId.equals(RED_ARENA_DIVIDER) || resourceId.equals(RED_ARENA_DIVIDER_ITEM)) { | 
            ||
| 169 | return new RedArenaDividerBlockModel();  | 
            ||
| 170 | |||
| 171 |         } else if (resourceId.equals(ORANGE_ARENA_BLOCK_SLAB) || resourceId.equals(ORANGE_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 172 | return new OrangeArenaBlockSlabModel();  | 
            ||
| 173 |         } else if (resourceId.equals(PINK_ARENA_BLOCK_SLAB) || resourceId.equals(PINK_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 174 | return new PinkArenaBlockSlabModel();  | 
            ||
| 175 |         } else if (resourceId.equals(BLUE_ARENA_BLOCK_SLAB) || resourceId.equals(BLUE_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 176 | return new BlueArenaBlockSlabModel();  | 
            ||
| 177 |         } else if (resourceId.equals(YELLOW_ARENA_BLOCK_SLAB) || resourceId.equals(YELLOW_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 178 | return new YellowArenaBlockSlabModel();  | 
            ||
| 179 |         } else if (resourceId.equals(GREEN_ARENA_BLOCK_SLAB) || resourceId.equals(GREEN_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 180 | return new GreenArenaBlockSlabModel();  | 
            ||
| 181 |         } else if (resourceId.equals(PURPLE_ARENA_BLOCK_SLAB) || resourceId.equals(PURPLE_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 182 | return new PurpleArenaBlockSlabModel();  | 
            ||
| 183 |         } else if (resourceId.equals(RED_ARENA_BLOCK_SLAB) || resourceId.equals(RED_ARENA_BLOCK_SLAB_ITEM)) { | 
            ||
| 184 | return new RedArenaBlockSlabModel();  | 
            ||
| 185 | }  | 
            ||
| 186 | |||
| 187 | return null;  | 
            ||
| 188 | }  | 
            ||
| 190 |