mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Fix up the Energizer and Enervator
This commit is contained in:
parent
1bcf01101e
commit
e7e2de68f3
6 changed files with 26 additions and 21 deletions
|
@ -10,20 +10,24 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -76,13 +80,11 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
|||
return (itemstack.isEmpty() || player.isCreative() || !EnchantmentHelper.hasBindingCurse(itemstack)) && super.mayPickup(player);
|
||||
}
|
||||
|
||||
// TODO: [port] add back
|
||||
|
||||
// @Override
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public String getSlotTexture() {
|
||||
// return Armor.EMPTY_SLOT_NAMES[slot.getIndex()];
|
||||
// }
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
|
||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.TEXTURE_EMPTY_SLOTS[slot.getIndex()]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,19 +10,23 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -64,13 +68,11 @@ public class ContainerEnervator extends AbstractContainerMenu {
|
|||
return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem;
|
||||
}
|
||||
|
||||
// TODO: [port] add this back
|
||||
|
||||
// @Override
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public String getSlotTexture() {
|
||||
// return ItemArmor.EMPTY_SLOT_NAMES[slot.getIndex()];
|
||||
// }
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<ResourceLocation, ResourceLocation> getNoItemIcon() {
|
||||
return Pair.of(InventoryMenu.BLOCK_ATLAS, InventoryMenu.TEXTURE_EMPTY_SLOTS[slot.getIndex()]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements Menu
|
|||
if (t instanceof TileEntityEnergizer tile) {
|
||||
tile.serverTick();
|
||||
|
||||
if (StackUtil.isValid(tile.inv.getStackInSlot(0)) && !StackUtil.isValid(tile.inv.getStackInSlot(1))) {
|
||||
if (!tile.inv.getStackInSlot(0).isEmpty() && tile.inv.getStackInSlot(1).isEmpty()) {
|
||||
if (tile.storage.getEnergyStored() > 0) {
|
||||
Optional<IEnergyStorage> capability = Optional.ofNullable(tile.inv.getStackInSlot(0).getCapability(Capabilities.EnergyStorage.ITEM, null));
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements Menu
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.empty();
|
||||
return Component.translatable("container.actuallyadditions.energizer");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha
|
|||
if (t instanceof TileEntityEnervator tile) {
|
||||
tile.serverTick();
|
||||
|
||||
if (StackUtil.isValid(tile.inv.getStackInSlot(0)) && !StackUtil.isValid(tile.inv.getStackInSlot(1))) {
|
||||
if (!tile.inv.getStackInSlot(0).isEmpty() && tile.inv.getStackInSlot(1).isEmpty()) {
|
||||
if (tile.storage.getEnergyStored() < tile.storage.getMaxEnergyStored()) {
|
||||
Optional<IEnergyStorage> capability = Optional.ofNullable(tile.inv.getStackInSlot(0).getCapability(Capabilities.EnergyStorage.ITEM, null));
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements ISha
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.empty();
|
||||
return Component.translatable("container.actuallyadditions.enervator");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -2,4 +2,5 @@ public net.minecraft.world.damagesource.DamageSources *() # DamageSources
|
|||
public net.minecraft.world.damagesource.DamageSources damageTypes
|
||||
public-f net.minecraft.data.recipes.RecipeProvider getName()Ljava/lang/String;
|
||||
public-f net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList list
|
||||
public net.minecraft.world.item.crafting.ShapedRecipe pattern # pattern
|
||||
public net.minecraft.world.item.crafting.ShapedRecipe pattern
|
||||
public net.minecraft.world.inventory.InventoryMenu TEXTURE_EMPTY_SLOTS
|
|
@ -114,8 +114,8 @@
|
|||
"block.actuallyadditions.item_repairer": "Item Repairer (wip)",
|
||||
"block.actuallyadditions.wood_casing": "Wood Casing (wip)",
|
||||
"block.actuallyadditions.greenhouse_glass": "Greenhouse Glass (wip)",
|
||||
"block.actuallyadditions.energizer": "Energizer (wip)",
|
||||
"block.actuallyadditions.enervator": "Enervator (wip)",
|
||||
"block.actuallyadditions.energizer": "Energizer",
|
||||
"block.actuallyadditions.enervator": "Enervator",
|
||||
"block.actuallyadditions.rice": "Rice Plant",
|
||||
"block.actuallyadditions.coal_generator": "Coal Generator",
|
||||
"block.actuallyadditions.lamp_controller": "Lamp Controller (wip)",
|
||||
|
|
Loading…
Reference in a new issue