From 8cc262156e8e1df50debff119a7a441eac5885a9 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:22:57 -0500 Subject: [PATCH] more things. --- .../actuallyadditions/data/BlockTagsGenerator.java | 4 +++- .../mod/inventory/ContainerEnergizer.java | 5 ++--- .../actuallyadditions/mod/inventory/ContainerFarmer.java | 3 +-- .../actuallyadditions/mod/inventory/ContainerFeeder.java | 3 +-- .../mod/inventory/ContainerFermentingBarrel.java | 3 +-- .../actuallyadditions/mod/inventory/ContainerFilter.java | 3 +-- .../mod/inventory/ContainerFluidCollector.java | 3 +-- .../mod/inventory/ContainerFurnaceDouble.java | 5 ++--- .../mod/inventory/ContainerLaserRelayItemWhitelist.java | 3 +-- .../actuallyadditions/mod/inventory/ContainerMiner.java | 3 +-- .../mod/inventory/ContainerXPSolidifier.java | 9 +++++---- .../mod/inventory/CrusherContainer.java | 3 +-- .../actuallyadditions/mod/inventory/SackContainer.java | 4 ++++ .../actuallyadditions/mod/inventory/gui/SackGui.java | 2 +- .../actuallyadditions/mod/inventory/slot/SlotFilter.java | 3 +-- .../actuallyadditions/mod/items/ItemEngineerGoggles.java | 3 +-- 16 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java index b022f9be6..f0b7ef3df 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/BlockTagsGenerator.java @@ -10,6 +10,7 @@ import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.concurrent.CompletableFuture; @@ -19,7 +20,7 @@ public class BlockTagsGenerator extends BlockTagsProvider { } @Override - protected void addTags(HolderLookup.Provider provider) { + protected void addTags(@Nonnull HolderLookup.Provider provider) { tag(BlockTags.WALLS).add( ActuallyBlocks.ETHETIC_WHITE_WALL.get(), ActuallyBlocks.ETHETIC_GREEN_WALL.get(), @@ -179,6 +180,7 @@ public class BlockTagsGenerator extends BlockTagsProvider { /** * Gets a name for this provider, to use in logging. */ + @Nonnull @Override public String getName() { return "Block Tags"; 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 4c34990e4..136e07f27 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -14,7 +14,6 @@ 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; @@ -72,7 +71,7 @@ public class ContainerEnergizer extends AbstractContainerMenu { @Override public boolean mayPlace(ItemStack stack) { - return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem; + return !stack.isEmpty() && stack.getItem() instanceof ArmorItem; } @Override @@ -131,7 +130,7 @@ public class ContainerEnergizer extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java index 7d9a0d91c..4be89d0e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFarmer.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -85,7 +84,7 @@ public class ContainerFarmer extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java index 1381a08dc..95aa33396 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFeeder.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -75,7 +74,7 @@ public class ContainerFeeder extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java index 1ff91cac8..6f16e5dc6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFermentingBarrel.java @@ -11,7 +11,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -69,7 +68,7 @@ public class ContainerFermentingBarrel extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java index ecc839e29..1583dffc0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFilter.java @@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotImmovable; import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -91,7 +90,7 @@ public class ContainerFilter extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java index c35659065..da21edede 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFluidCollector.java @@ -11,7 +11,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -76,7 +75,7 @@ public class ContainerFluidCollector extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java index b9f7983a3..9f66e4141 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerFurnaceDouble.java @@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -87,7 +86,7 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu { ItemStack recipeOutput = recipeHolder.value().getResultItem(player.level().registryAccess()); //Shift from Inventory - if (StackUtil.isValid(recipeOutput)) { + if (!recipeOutput.isEmpty()) { if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_1, TileEntityPoweredFurnace.SLOT_INPUT_1 + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_2, TileEntityPoweredFurnace.SLOT_INPUT_2 + 1, false)) { return ItemStack.EMPTY; @@ -107,7 +106,7 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java index 566756c93..a1000cd27 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerLaserRelayItemWhitelist.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -81,7 +80,7 @@ public class ContainerLaserRelayItemWhitelist extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java index 5ba6a453f..7bde867a3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerMiner.java @@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -80,7 +79,7 @@ public class ContainerMiner extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java index 00484880e..a4d2223e2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerXPSolidifier.java @@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -22,6 +21,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; +import javax.annotation.Nonnull; import java.util.Objects; public class ContainerXPSolidifier extends AbstractContainerMenu { @@ -49,8 +49,9 @@ public class ContainerXPSolidifier extends AbstractContainerMenu { } } + @Nonnull @Override - public ItemStack quickMoveStack(Player player, int slot) { + public ItemStack quickMoveStack(@Nonnull Player player, int slot) { int inventoryStart = 2; int inventoryEnd = inventoryStart + 26; int hotbarStart = inventoryEnd + 1; @@ -79,7 +80,7 @@ public class ContainerXPSolidifier extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); @@ -96,7 +97,7 @@ public class ContainerXPSolidifier extends AbstractContainerMenu { } @Override - public boolean stillValid(Player player) { + public boolean stillValid(@Nonnull Player player) { return this.solidifier.canPlayerUse(player); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java index 25f4d351e..b5e3f290a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/CrusherContainer.java @@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditio import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -111,7 +110,7 @@ public class CrusherContainer extends AbstractContainerMenu { return ItemStack.EMPTY; } - if (!StackUtil.isValid(newStack)) { + if (newStack.isEmpty()) { theSlot.set(ItemStack.EMPTY); } else { theSlot.setChanged(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java index 488750bb9..eeecbf239 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/SackContainer.java @@ -84,6 +84,10 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact } } + public FilterSettings getFilter() { + return filter; + } + @Nonnull @Override public ItemStack quickMoveStack(@Nonnull Player player, int slot) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java index 87d66b36f..9f0910918 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/SackGui.java @@ -48,7 +48,7 @@ public class SackGui extends AAScreen { public void init() { super.init(); - this.filter = new FilterSettingsGui(this.container.filter, this.leftPos + 137, this.topPos + 10, true, this::addRenderableWidget, this::buttonClicked, 1); + this.filter = new FilterSettingsGui(this.container.getFilter(), this.leftPos + 137, this.topPos + 10, true, this::addRenderableWidget, this::buttonClicked, 1); this.buttonAutoInsert = Button.builder( Component.literal("I") diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java index 6dd30902f..1a8ba2bb0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/slot/SlotFilter.java @@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot; import de.ellpeck.actuallyadditions.mod.items.ItemFilter; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.Slot; @@ -52,7 +51,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned { } this.set(ItemStack.EMPTY); - } else if (StackUtil.isValid(cursorItem)) { + } else if (!cursorItem.isEmpty()) { if (!isFilter(stackInSlot)) { ItemStack s = cursorItem.copy(); s.setCount(1); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java index 6da6e190d..da1252d41 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemEngineerGoggles.java @@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.api.misc.IGoggles; import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA; import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials; -import de.ellpeck.actuallyadditions.mod.util.StackUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.client.Minecraft; import net.minecraft.world.entity.Entity; @@ -46,7 +45,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles { public static boolean isWearing(Player player) { ItemStack face = player.getInventory().armor.get(3); - return StackUtil.isValid(face) && face.getItem() instanceof IGoggles; + return !face.isEmpty() && face.getItem() instanceof IGoggles; }