|
7 | 7 | import com.minecolonies.api.inventory.InventoryCitizen; |
8 | 8 | import com.minecolonies.api.inventory.ModContainers; |
9 | 9 | import com.minecolonies.api.util.ItemStackUtils; |
| 10 | +import com.mojang.datafixers.util.Pair; |
10 | 11 | import net.minecraft.core.BlockPos; |
11 | 12 | import net.minecraft.network.FriendlyByteBuf; |
| 13 | +import net.minecraft.resources.ResourceLocation; |
12 | 14 | import net.minecraft.world.SimpleContainer; |
13 | 15 | import net.minecraft.world.entity.Entity; |
14 | 16 | import net.minecraft.world.entity.EquipmentSlot; |
15 | 17 | import net.minecraft.world.entity.player.Inventory; |
16 | 18 | import net.minecraft.world.entity.player.Player; |
17 | 19 | import net.minecraft.world.inventory.AbstractContainerMenu; |
| 20 | +import net.minecraft.world.inventory.InventoryMenu; |
18 | 21 | import net.minecraft.world.inventory.Slot; |
19 | 22 | import net.minecraft.world.item.ArmorItem; |
20 | 23 | import net.minecraft.world.item.ItemStack; |
@@ -265,6 +268,20 @@ public boolean mayPlace(final @NotNull ItemStack stack) |
265 | 268 | } |
266 | 269 | return false; |
267 | 270 | } |
| 271 | + |
| 272 | + @Override |
| 273 | + public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() |
| 274 | + { |
| 275 | + final ResourceLocation icon = switch (equipmentSlot) |
| 276 | + { |
| 277 | + case HEAD -> InventoryMenu.EMPTY_ARMOR_SLOT_HELMET; |
| 278 | + case CHEST -> InventoryMenu.EMPTY_ARMOR_SLOT_CHESTPLATE; |
| 279 | + case LEGS -> InventoryMenu.EMPTY_ARMOR_SLOT_LEGGINGS; |
| 280 | + case FEET -> InventoryMenu.EMPTY_ARMOR_SLOT_BOOTS; |
| 281 | + default -> null; |
| 282 | + }; |
| 283 | + return icon == null ? null : Pair.of(InventoryMenu.BLOCK_ATLAS, icon); |
| 284 | + } |
268 | 285 | }); |
269 | 286 | } |
270 | 287 |
|
|
0 commit comments