Skip to content

Commit

Permalink
Fixes upgrade to the u16
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Dec 26, 2024
1 parent 56daecd commit 60b196e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 166 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

// Curseforge mod dependencies
//implementation fg.deobf("curse.maven:vault-hunters-official-mod-458203:${vault_hunters_version}")

implementation fg.deobf("iskallia.vault:the_vault-3434:3434")
implementation fg.deobf("curse.maven:vault-hunters-official-mod-458203:${vault_hunters_version}")

// Dependencies for Runtime Debug
implementation fg.deobf("curse.maven:quark-243121:3840125")
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod_name=More Vault Tables Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GNU GPL 3.0
# The mod version. See https://semver.org/
mod_version=1.0
mod_version=1.2
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand All @@ -48,6 +48,6 @@ mod_authors=BONNe
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=A mod that adds more vault tables into game
# The version of Vault Hunters Mod
vault_hunters_version=5631250
vault_hunters_version=5925633
# The change Log
changelog=Check changelog in CurseForge page
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import java.util.List;

import iskallia.vault.block.entity.base.FilteredInputInventoryTileEntity;
import iskallia.vault.container.oversized.OverSizedInvWrapper;
import iskallia.vault.container.oversized.OverSizedInventory;
import iskallia.vault.init.ModItems;
import iskallia.vault.integration.IntegrationRefinedStorage;
import javax.annotation.Nonnull;
import lv.id.bonne.vaulthunters.morevaulttables.block.menu.CardSelectorTableContainer;
import lv.id.bonne.vaulthunters.morevaulttables.init.MoreVaultTablesReferences;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -295,7 +295,6 @@ public AbstractContainerMenu createMenu(int containerId, @NotNull Inventory inv,
* @param itemStack Inserted item stack
* @return {@code true} if item can be inserted, {@code false} otherwise
*/
@Override
public boolean canInsertItem(int slot, @NotNull ItemStack itemStack)
{
// The item will should not be placed in first slot.
Expand All @@ -316,77 +315,6 @@ public boolean isInventorySideAccessible(@Nullable Direction direction)
}


/**
* This method returns input filter compatibility.
* @param inventory The targeted inventory.
* @param side The input side.
* @return LazyOptional with capability inside it.
* @param <T> Capability type.
*/
@Override
public <T> LazyOptional<T> getFilteredInputCapability(@NotNull Container inventory, @Nullable Direction side)
{
return !this.isInventorySideAccessible(side) ? LazyOptional.empty() :
LazyOptional.of(() -> new FilteredInvWrapper(this, inventory)
{
@NotNull
@Override
public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate)
{
if (!canInsertItem(slot, stack))
{
// Cannot insert.
return stack;
}
else if (slot == 0)
{
// Custom slot 0 processor
if (this.getStackInSlot(0).isEmpty())
{
if (stack.getCount() > 1)
{
stack = stack.copy();

if (!simulate)
{
this.getInv().setItem(slot, stack.split(1));
this.getInv().setChanged();
}
else
{
stack.shrink(Math.min(stack.getCount(), 1));
}

return stack;
}
else
{
if (!simulate)
{
ItemStack copy = stack.copy();
this.getInv().setItem(slot, copy);
this.getInv().setChanged();
}

return ItemStack.EMPTY;
}
}
else
{
// Cannot insert item into non-empty slot
return stack;
}
}
else
{
// Default processing.
return super.insertItem(slot, stack, simulate);
}
}
}).cast();
}


/**
* This method returns output filter compatibility.
* @param inventory The targeted inventory.
Expand All @@ -398,7 +326,7 @@ public <T> LazyOptional<T> getFilteredOutputCapability(@NotNull Container invent
{
// Only down direction currently
return side != Direction.DOWN ? LazyOptional.empty() :
LazyOptional.of(() -> new FilteredInvWrapper(this, inventory)
LazyOptional.of(() -> new OverSizedInvWrapper(inventory)
{
/**
* This method use default extraction method.
Expand Down Expand Up @@ -474,7 +402,7 @@ else if (Direction.DOWN == side)
else
{
return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ?
this.getFilteredInputCapability(this.inputInventory, side) :
this.getFilteredInputCapability(side, new Container[]{this.inputInventory}) :
super.getCapability(cap, side);
}
}
Expand Down Expand Up @@ -509,7 +437,7 @@ public void setChanged()
/**
* This variable stores pack inventory.
*/
private final OverSizedInventory inputInventory = new OverSizedInventory(61, this)
private final OverSizedInventory inputInventory = new OverSizedInventory.FilteredInsert(61, this, this::canInsertItem)
{
/**
* This method updates how many card pouches are in the system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;

import iskallia.vault.block.entity.base.FilteredInputInventoryTileEntity;
import iskallia.vault.container.oversized.OverSizedInvWrapper;
import iskallia.vault.container.oversized.OverSizedInventory;
import iskallia.vault.init.ModItems;
import iskallia.vault.integration.IntegrationRefinedStorage;
Expand Down Expand Up @@ -289,7 +290,6 @@ public AbstractContainerMenu createMenu(int containerId, @NotNull Inventory inv,
* @param itemStack Inserted item stack
* @return {@code true} if item can be inserted, {@code false} otherwise
*/
@Override
public boolean canInsertItem(int slot, @NotNull ItemStack itemStack)
{
// The item will should not be placed in first slot.
Expand All @@ -310,77 +310,6 @@ public boolean isInventorySideAccessible(@Nullable Direction direction)
}


/**
* This method returns input filter compatibility.
* @param inventory The targeted inventory.
* @param side The input side.
* @return LazyOptional with capability inside it.
* @param <T> Capability type.
*/
@Override
public <T> LazyOptional<T> getFilteredInputCapability(@NotNull Container inventory, @Nullable Direction side)
{
return !this.isInventorySideAccessible(side) ? LazyOptional.empty() :
LazyOptional.of(() -> new FilteredInvWrapper(this, inventory)
{
@NotNull
@Override
public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate)
{
if (!canInsertItem(slot, stack))
{
// Cannot insert.
return stack;
}
else if (slot == 0)
{
// Custom slot 0 processor
if (this.getStackInSlot(0).isEmpty())
{
if (stack.getCount() > 1)
{
stack = stack.copy();

if (!simulate)
{
this.getInv().setItem(slot, stack.split(1));
this.getInv().setChanged();
}
else
{
stack.shrink(Math.min(stack.getCount(), 1));
}

return stack;
}
else
{
if (!simulate)
{
ItemStack copy = stack.copy();
this.getInv().setItem(slot, copy);
this.getInv().setChanged();
}

return ItemStack.EMPTY;
}
}
else
{
// Cannot insert item into non-empty slot
return stack;
}
}
else
{
// Default processing.
return super.insertItem(slot, stack, simulate);
}
}
}).cast();
}


/**
* This method returns output filter compatibility.
* @param inventory The targeted inventory.
Expand All @@ -392,7 +321,7 @@ public <T> LazyOptional<T> getFilteredOutputCapability(@NotNull Container invent
{
// Only down direction currently
return side != Direction.DOWN ? LazyOptional.empty() :
LazyOptional.of(() -> new FilteredInvWrapper(this, inventory)
LazyOptional.of(() -> new OverSizedInvWrapper(inventory)
{
/**
* This method use default extraction method.
Expand Down Expand Up @@ -468,7 +397,7 @@ else if (Direction.DOWN == side)
else
{
return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ?
this.getFilteredInputCapability(this.inputInventory, side) :
this.getFilteredInputCapability(side, new Container[]{this.inputInventory}) :
super.getCapability(cap, side);
}
}
Expand Down Expand Up @@ -502,7 +431,7 @@ public void setChanged()
/**
* This variable stores pouches inventory.
*/
private final OverSizedInventory inputInventory = new OverSizedInventory(61, this)
private final OverSizedInventory inputInventory = new OverSizedInventory.FilteredInsert(61, this, this::canInsertItem)
{
/**
* This method updates how many jewel pouches are in the system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ public void setChanged()
{
super.setChanged();

if (CardSelectorTableContainer.this.player instanceof LocalPlayer)
if (CardSelectorTableContainer.this.player instanceof ServerPlayer serverPlayer)
{
CardSelectorTableContainer.this.identifySelectedItem(serverPlayer);
}
else if (CardSelectorTableContainer.this.player instanceof LocalPlayer)
{
if (Minecraft.getInstance().screen instanceof CardSelectorTableScreen screen)
{
screen.setRegenerate();
}
}
else if (CardSelectorTableContainer.this.player instanceof ServerPlayer serverPlayer)
{
CardSelectorTableContainer.this.identifySelectedItem(serverPlayer);
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ public void setChanged()
{
super.setChanged();

if (JewelSelectorTableContainer.this.player instanceof LocalPlayer)
if (JewelSelectorTableContainer.this.player instanceof ServerPlayer serverPlayer)
{
JewelSelectorTableContainer.this.identifySelectedItem(serverPlayer);
}
else if (JewelSelectorTableContainer.this.player instanceof LocalPlayer)
{
if (Minecraft.getInstance().screen instanceof JewelSelectorTableScreen screen)
{
screen.setRegenerate();
}
}
else if (JewelSelectorTableContainer.this.player instanceof ServerPlayer serverPlayer)
{
JewelSelectorTableContainer.this.identifySelectedItem(serverPlayer);
}
}
});

Expand Down

0 comments on commit 60b196e

Please sign in to comment.