From 6e18866c795df2916afc0fc44645546f073b35e8 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 3 May 2016 08:45:01 +0200 Subject: [PATCH] Fixed equipment slot in energizer and enervator being off --- .../mod/inventory/ContainerEnergizer.java | 24 ++++++++++--------- .../mod/inventory/ContainerEnervator.java | 21 ++++++++-------- .../mod/items/base/ItemArmorAA.java | 3 ++- .../misc/special/ThreadSpecialFetcher.java | 2 +- .../mod/update/ThreadUpdateChecker.java | 2 +- .../blockstates/blockHeatCollector.json | 2 +- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index d98edf938..08942436b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -18,6 +18,7 @@ import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -27,9 +28,10 @@ import net.minecraftforge.fml.relauncher.SideOnly; @InventoryContainer public class ContainerEnergizer extends Container{ + public static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; private TileEntityEnergizer energizer; - public ContainerEnergizer(EntityPlayer player, TileEntityBase tile){ + public ContainerEnergizer(final EntityPlayer player, TileEntityBase tile){ this.energizer = (TileEntityEnergizer)tile; InventoryPlayer inventory = player.inventory; @@ -44,24 +46,24 @@ public class ContainerEnergizer extends Container{ for(int i = 0; i < 9; i++){ this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155)); } - final EntityPlayer finalPlayer = player; - for(int i = 0; i < 4; ++i){ - final int finalI = i; - this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ - @Override - public boolean isItemValid(ItemStack stack){ - return stack != null && stack.getItem().isValidArmor(stack, ContainerEnervator.ARMOR_SLOTS[finalI], finalPlayer); - } + for(int k = 0; k < 4; ++k){ + final EntityEquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k]; + this.addSlotToContainer(new Slot(player.inventory, 36+(3-k), 102, 19+k*18){ @Override public int getSlotStackLimit(){ return 1; } + @Override + public boolean isItemValid(ItemStack stack){ + return stack != null && stack.getItem().isValidArmor(stack, slot, player); + } + @Override @SideOnly(Side.CLIENT) public String getSlotTexture(){ - return ItemArmor.EMPTY_SLOT_NAMES[finalI]; + return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()]; } }); } @@ -74,7 +76,7 @@ public class ContainerEnergizer extends Container{ final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; - Slot theSlot = (Slot)this.inventorySlots.get(slot); + Slot theSlot = this.inventorySlots.get(slot); if(theSlot != null && theSlot.getHasStack()){ ItemStack newStack = theSlot.getStack(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index 5774aed05..3a2b66098 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -28,10 +28,9 @@ import net.minecraftforge.fml.relauncher.SideOnly; @InventoryContainer public class ContainerEnervator extends Container{ - public static final EntityEquipmentSlot[] ARMOR_SLOTS = new EntityEquipmentSlot[]{EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; private TileEntityEnervator enervator; - public ContainerEnervator(EntityPlayer player, TileEntityBase tile){ + public ContainerEnervator(final EntityPlayer player, TileEntityBase tile){ this.enervator = (TileEntityEnervator)tile; InventoryPlayer inventory = player.inventory; @@ -46,24 +45,24 @@ public class ContainerEnervator extends Container{ for(int i = 0; i < 9; i++){ this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 155)); } - final EntityPlayer finalPlayer = player; - for(int i = 0; i < 4; ++i){ - final int finalI = i; - this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ - @Override - public boolean isItemValid(ItemStack stack){ - return stack != null && stack.getItem().isValidArmor(stack, ARMOR_SLOTS[finalI], finalPlayer); - } + for(int k = 0; k < 4; ++k){ + final EntityEquipmentSlot slot = ContainerEnergizer.VALID_EQUIPMENT_SLOTS[k]; + this.addSlotToContainer(new Slot(player.inventory, 36+(3-k), 102, 19+k*18){ @Override public int getSlotStackLimit(){ return 1; } + @Override + public boolean isItemValid(ItemStack stack){ + return stack != null && stack.getItem().isValidArmor(stack, slot, player); + } + @Override @SideOnly(Side.CLIENT) public String getSlotTexture(){ - return ItemArmor.EMPTY_SLOT_NAMES[finalI]; + return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()]; } }); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index 41e9e8727..6954f0df1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnergizer; import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; @@ -30,7 +31,7 @@ public class ItemArmorAA extends ItemArmor{ } public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, EnumRarity rarity){ - super(material, 0, ContainerEnervator.ARMOR_SLOTS[type]); + super(material, 0, ContainerEnergizer.VALID_EQUIPMENT_SLOTS[type]); this.repairItem = repairItem; this.name = name; this.rarity = rarity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/ThreadSpecialFetcher.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/ThreadSpecialFetcher.java index bdc869c50..6fce22f5c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/ThreadSpecialFetcher.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/ThreadSpecialFetcher.java @@ -19,7 +19,7 @@ import java.util.Properties; public class ThreadSpecialFetcher extends Thread{ public ThreadSpecialFetcher(){ - this.setName(ModUtil.MOD_ID+" Special Fetcher"); + this.setName(ModUtil.NAME+" Special Fetcher"); this.setDaemon(true); this.start(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/ThreadUpdateChecker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/ThreadUpdateChecker.java index 9535467f1..3f75021c1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/ThreadUpdateChecker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/ThreadUpdateChecker.java @@ -20,7 +20,7 @@ import java.util.Properties; public class ThreadUpdateChecker extends Thread{ public ThreadUpdateChecker(){ - this.setName(ModUtil.MOD_ID+" Update Checker"); + this.setName(ModUtil.NAME+" Update Checker"); this.setDaemon(true); this.start(); } diff --git a/src/main/resources/assets/actuallyadditions/blockstates/blockHeatCollector.json b/src/main/resources/assets/actuallyadditions/blockstates/blockHeatCollector.json index 42f8b7f52..fb8dc627c 100644 --- a/src/main/resources/assets/actuallyadditions/blockstates/blockHeatCollector.json +++ b/src/main/resources/assets/actuallyadditions/blockstates/blockHeatCollector.json @@ -4,7 +4,7 @@ "model": "minecraft:cube_bottom_top", "textures": { "side": "actuallyadditions:blocks/blockHeatCollectorSide", - "bottom": "actuallyadditions:blocks/blockHeatCollector", + "bottom": "actuallyadditions:blocks/blockHeatCollectorBottom", "top": "actuallyadditions:blocks/blockHeatCollectorTop" }, "transform": "forge:default-block"