Skip to content

Commit 0600220

Browse files
committed
Add no item icon
1 parent c35e7c5 commit 0600220

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/main/java/com/minecolonies/api/inventory/container/ContainerCitizenInventory.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
import com.minecolonies.api.inventory.InventoryCitizen;
88
import com.minecolonies.api.inventory.ModContainers;
99
import com.minecolonies.api.util.ItemStackUtils;
10+
import com.mojang.datafixers.util.Pair;
1011
import net.minecraft.core.BlockPos;
1112
import net.minecraft.network.FriendlyByteBuf;
13+
import net.minecraft.resources.ResourceLocation;
1214
import net.minecraft.world.SimpleContainer;
1315
import net.minecraft.world.entity.Entity;
1416
import net.minecraft.world.entity.EquipmentSlot;
1517
import net.minecraft.world.entity.player.Inventory;
1618
import net.minecraft.world.entity.player.Player;
1719
import net.minecraft.world.inventory.AbstractContainerMenu;
20+
import net.minecraft.world.inventory.InventoryMenu;
1821
import net.minecraft.world.inventory.Slot;
1922
import net.minecraft.world.item.ArmorItem;
2023
import net.minecraft.world.item.ItemStack;
@@ -265,6 +268,20 @@ public boolean mayPlace(final @NotNull ItemStack stack)
265268
}
266269
return false;
267270
}
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+
}
268285
});
269286
}
270287

0 commit comments

Comments
 (0)