more things.

This commit is contained in:
Flanks255 2024-07-24 17:22:57 -05:00
parent adce5984e4
commit 8cc262156e
16 changed files with 27 additions and 32 deletions

View file

@ -10,6 +10,7 @@ import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.BlockTagsProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.common.data.ExistingFileHelper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -19,7 +20,7 @@ public class BlockTagsGenerator extends BlockTagsProvider {
} }
@Override @Override
protected void addTags(HolderLookup.Provider provider) { protected void addTags(@Nonnull HolderLookup.Provider provider) {
tag(BlockTags.WALLS).add( tag(BlockTags.WALLS).add(
ActuallyBlocks.ETHETIC_WHITE_WALL.get(), ActuallyBlocks.ETHETIC_WHITE_WALL.get(),
ActuallyBlocks.ETHETIC_GREEN_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. * Gets a name for this provider, to use in logging.
*/ */
@Nonnull
@Override @Override
public String getName() { public String getName() {
return "Block Tags"; return "Block Tags";

View file

@ -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.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
@ -72,7 +71,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
@Override @Override
public boolean mayPlace(ItemStack stack) { public boolean mayPlace(ItemStack stack) {
return StackUtil.isValid(stack) && stack.getItem() instanceof ArmorItem; return !stack.isEmpty() && stack.getItem() instanceof ArmorItem;
} }
@Override @Override
@ -131,7 +130,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -85,7 +84,7 @@ public class ContainerFarmer extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -75,7 +74,7 @@ public class ContainerFeeder extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -69,7 +68,7 @@ public class ContainerFermentingBarrel extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -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.inventory.slot.SlotImmovable;
import de.ellpeck.actuallyadditions.mod.items.DrillItem; import de.ellpeck.actuallyadditions.mod.items.DrillItem;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -91,7 +90,7 @@ public class ContainerFilter extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -76,7 +75,7 @@ public class ContainerFluidCollector extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -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.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -87,7 +86,7 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu {
ItemStack recipeOutput = recipeHolder.value().getResultItem(player.level().registryAccess()); ItemStack recipeOutput = recipeHolder.value().getResultItem(player.level().registryAccess());
//Shift from Inventory //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_1, TileEntityPoweredFurnace.SLOT_INPUT_1 + 1, false)) {
if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_2, TileEntityPoweredFurnace.SLOT_INPUT_2 + 1, false)) { if (!this.moveItemStackTo(newStack, TileEntityPoweredFurnace.SLOT_INPUT_2, TileEntityPoweredFurnace.SLOT_INPUT_2 + 1, false)) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -107,7 +106,7 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -81,7 +80,7 @@ public class ContainerLaserRelayItemWhitelist extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger; import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -80,7 +79,7 @@ public class ContainerMiner extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -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.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; 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.inventory.Slot;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.Objects; import java.util.Objects;
public class ContainerXPSolidifier extends AbstractContainerMenu { public class ContainerXPSolidifier extends AbstractContainerMenu {
@ -49,8 +49,9 @@ public class ContainerXPSolidifier extends AbstractContainerMenu {
} }
} }
@Nonnull
@Override @Override
public ItemStack quickMoveStack(Player player, int slot) { public ItemStack quickMoveStack(@Nonnull Player player, int slot) {
int inventoryStart = 2; int inventoryStart = 2;
int inventoryEnd = inventoryStart + 26; int inventoryEnd = inventoryStart + 26;
int hotbarStart = inventoryEnd + 1; int hotbarStart = inventoryEnd + 1;
@ -79,7 +80,7 @@ public class ContainerXPSolidifier extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();
@ -96,7 +97,7 @@ public class ContainerXPSolidifier extends AbstractContainerMenu {
} }
@Override @Override
public boolean stillValid(Player player) { public boolean stillValid(@Nonnull Player player) {
return this.solidifier.canPlayerUse(player); return this.solidifier.canPlayerUse(player);
} }
} }

View file

@ -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.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -111,7 +110,7 @@ public class CrusherContainer extends AbstractContainerMenu {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
if (!StackUtil.isValid(newStack)) { if (newStack.isEmpty()) {
theSlot.set(ItemStack.EMPTY); theSlot.set(ItemStack.EMPTY);
} else { } else {
theSlot.setChanged(); theSlot.setChanged();

View file

@ -84,6 +84,10 @@ public class SackContainer extends AbstractContainerMenu implements IButtonReact
} }
} }
public FilterSettings getFilter() {
return filter;
}
@Nonnull @Nonnull
@Override @Override
public ItemStack quickMoveStack(@Nonnull Player player, int slot) { public ItemStack quickMoveStack(@Nonnull Player player, int slot) {

View file

@ -48,7 +48,7 @@ public class SackGui extends AAScreen<SackContainer> {
public void init() { public void init() {
super.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( this.buttonAutoInsert = Button.builder(
Component.literal("I") Component.literal("I")

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.inventory.slot;
import de.ellpeck.actuallyadditions.mod.items.ItemFilter; import de.ellpeck.actuallyadditions.mod.items.ItemFilter;
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings; import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; 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.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.Slot; import net.minecraft.world.inventory.Slot;
@ -52,7 +51,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned {
} }
this.set(ItemStack.EMPTY); this.set(ItemStack.EMPTY);
} else if (StackUtil.isValid(cursorItem)) { } else if (!cursorItem.isEmpty()) {
if (!isFilter(stackInSlot)) { if (!isFilter(stackInSlot)) {
ItemStack s = cursorItem.copy(); ItemStack s = cursorItem.copy();
s.setCount(1); s.setCount(1);

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.misc.IGoggles; import de.ellpeck.actuallyadditions.api.misc.IGoggles;
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA; import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials; import de.ellpeck.actuallyadditions.mod.material.ArmorMaterials;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -46,7 +45,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
public static boolean isWearing(Player player) { public static boolean isWearing(Player player) {
ItemStack face = player.getInventory().armor.get(3); ItemStack face = player.getInventory().armor.get(3);
return StackUtil.isValid(face) && face.getItem() instanceof IGoggles; return !face.isEmpty() && face.getItem() instanceof IGoggles;
} }