Added icons for armor slots in MFE\MFSU\etc.

This commit is contained in:
drcrazy 2017-10-23 18:18:25 +03:00
parent c0a43c0947
commit 5974ae094d
4 changed files with 19 additions and 69 deletions

View file

@ -24,11 +24,12 @@
package techreborn.client.container.builder;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import org.apache.commons.lang3.Range;
import reborncore.client.gui.slots.BaseSlot;
import techreborn.client.container.builder.slot.FilteredSlot;
import techreborn.client.IconSupplier;
import techreborn.client.container.builder.slot.SpriteSlot;
public final class ContainerPlayerInventoryBuilder {
@ -94,30 +95,26 @@ public final class ContainerPlayerInventoryBuilder {
}
private ContainerPlayerArmorInventoryBuilder armor(final int index, final int xStart, final int yStart,
final EntityEquipmentSlot slotType) {
// this.parent.parent.slots.add(new FilteredSlot(this.parent.player, index, xStart, yStart)
// .setFilter(stack -> stack.getItem().isValidArmor(stack, slotType, this.parent.player.player)));
String sprite = "armour_" + slotType.getName();
final EntityEquipmentSlot slotType, final TextureAtlasSprite sprite) {
this.parent.parent.slots.add(new SpriteSlot(this.parent.player, index, xStart, yStart, sprite, 1)
.setFilter(stack -> stack.getItem().isValidArmor(stack, slotType, this.parent.player.player)));
return this;
}
public ContainerPlayerArmorInventoryBuilder helmet(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 2, xStart, yStart, EntityEquipmentSlot.HEAD);
return this.armor(this.parent.player.getSizeInventory() - 2, xStart, yStart, EntityEquipmentSlot.HEAD, IconSupplier.armour_head);
}
public ContainerPlayerArmorInventoryBuilder chestplate(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 3, xStart, yStart, EntityEquipmentSlot.CHEST);
return this.armor(this.parent.player.getSizeInventory() - 3, xStart, yStart, EntityEquipmentSlot.CHEST, IconSupplier.armour_chest);
}
public ContainerPlayerArmorInventoryBuilder leggings(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 4, xStart, yStart, EntityEquipmentSlot.LEGS);
return this.armor(this.parent.player.getSizeInventory() - 4, xStart, yStart, EntityEquipmentSlot.LEGS, IconSupplier.armour_legs);
}
public ContainerPlayerArmorInventoryBuilder boots(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 5, xStart, yStart, EntityEquipmentSlot.FEET);
return this.armor(this.parent.player.getSizeInventory() - 5, xStart, yStart, EntityEquipmentSlot.FEET, IconSupplier.armour_feet);
}
public ContainerPlayerArmorInventoryBuilder complete(final int xStart, final int yStart) {

View file

@ -28,23 +28,20 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import techreborn.client.IconSupplier;
import techreborn.lib.ModInfo;
import javax.annotation.Nullable;
public class SpriteSlot extends FilteredSlot {
private final String sprite;
private final String spriteName;
int stacksize;
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final TextureAtlasSprite sprite, final int stacksize) {
super(inventory, index, xPosition, yPosition);
this.sprite = ModInfo.MOD_ID + ":textures/gui/slot_sprites/" + sprite + ".png";
this.spriteName = sprite.getIconName();
this.stacksize = stacksize;
}
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final TextureAtlasSprite sprite) {
this(inventory, index, xPosition, yPosition, sprite, 64);
}
@ -57,6 +54,6 @@ public class SpriteSlot extends FilteredSlot {
@Nullable
@SideOnly(Side.CLIENT)
public String getSlotTexture() {
return this.sprite;
return this.spriteName;
}
}