mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-04 04:18:33 +01:00
Add off-hand slot to Energizer/Enervator (See #1456 )
This commit is contained in:
parent
e62fb634d1
commit
c1d10d12ce
4 changed files with 32 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
* Added the ability for fluid collectors to collect water and lava from filled cauldrons.
|
||||
* Explicitly made the Drills unbreakable.
|
||||
* Fixed worldgenned AA plants breaking on block update.
|
||||
* Add off-hand slot to Energizer/Enervator
|
||||
|
||||
# 1.3.10+mc1.21.1
|
||||
* Fixed Fluid placer not being harvestable.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.ArmorSlot;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
|
||||
|
@ -25,6 +26,7 @@ import net.minecraft.world.inventory.Slot;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerEnergizer extends AbstractContainerMenu {
|
||||
|
@ -59,9 +61,22 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
|||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
EquipmentSlot slot = VALID_EQUIPMENT_SLOTS[k];
|
||||
ResourceLocation resourcelocation = InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot);
|
||||
this.addSlot(new ArmorSlot(inventory, slot, 36 + 3 - k, 102, 19 + k * 18, resourcelocation));
|
||||
ResourceLocation resourcelocation = InventoryMenu.TEXTURE_EMPTY_SLOTS.getOrDefault(slot, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD);
|
||||
this.addSlot(new ArmorSlot(inventory, slot, 36 + 3 - k, 102, 19 + k * 18, resourcelocation) {});
|
||||
}
|
||||
|
||||
this.addSlot(new Slot(inventory, 40, 120, 19 + 3 * 18) {
|
||||
@Override
|
||||
public void setByPlayer(ItemStack newStack, ItemStack oldStack) {
|
||||
inventory.player.onEquipItem(EquipmentSlot.OFFHAND, oldStack, newStack);
|
||||
super.setByPlayer(newStack, oldStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
|
||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.ArmorSlot;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
|
||||
|
@ -57,6 +58,19 @@ public class ContainerEnervator extends AbstractContainerMenu {
|
|||
ResourceLocation resourcelocation = InventoryMenu.TEXTURE_EMPTY_SLOTS.get(slot);
|
||||
this.addSlot(new ArmorSlot(inventory, slot, 36 + 3 - k, 102, 19 + k * 18, resourcelocation));
|
||||
}
|
||||
|
||||
this.addSlot(new Slot(inventory, 40, 120, 19 + 3 * 18) {
|
||||
@Override
|
||||
public void setByPlayer(ItemStack newStack, ItemStack oldStack) {
|
||||
inventory.player.onEquipItem(EquipmentSlot.OFFHAND, oldStack, newStack);
|
||||
super.setByPlayer(newStack, oldStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
|
||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.EMPTY_ARMOR_SLOT_SHIELD);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 903 B |
Loading…
Reference in a new issue