mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-23 21:49:50 +00:00
ManaItemHandler now checks the baubles inventory for items.
This commit is contained in:
1 parent
5c26e26c14
commit
4623c71ba7
5 files changed
+46
-3
No files matched your search
@@ -14,7 +14,9 @@ package vazkii.botania.api.internal;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -105,4 +107,9 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getBaublesInventory(EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@ package vazkii.botania.api.internal;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -60,6 +62,8 @@ public interface IInternalMethodHandler {
|
||||
|
||||
public IIcon getSubTileIconForName(String name);
|
||||
|
||||
public IInventory getBaublesInventory(EntityPlayer player);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
|
||||
@@ -28,7 +33,17 @@ public final class ManaItemHandler {
|
||||
if(stack == null)
|
||||
return 0;
|
||||
|
||||
for(ItemStack stackInSlot : player.inventory.mainInventory) {
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
int size = mainInv.getSizeInventory();
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
IInventory inv = i >= mainInv.getSizeInventory() ? baublesInv : mainInv;
|
||||
ItemStack stackInSlot = inv.getStackInSlot(i);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
|
||||
@@ -63,7 +78,17 @@ public final class ManaItemHandler {
|
||||
if(stack == null)
|
||||
return false;
|
||||
|
||||
for(ItemStack stackInSlot : player.inventory.mainInventory) {
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
List<ItemStack> stacks = new ArrayList();
|
||||
int size = mainInv.getSizeInventory();
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
IInventory inv = i >= mainInv.getSizeInventory() ? baublesInv : mainInv;
|
||||
ItemStack stackInSlot = inv.getStackInSlot(i);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -13,8 +13,11 @@ package vazkii.botania.common.core.handler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -104,6 +107,11 @@ public class InternalMethodHandler implements IInternalMethodHandler {
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return ManaNetworkHandler.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getBaublesInventory(EntityPlayer player) {
|
||||
return BaublesApi.getBaubles(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
|
||||
@@ -167,7 +167,6 @@ public class PageRecipe extends LexiconPage {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(accountForContainer) {
|
||||
ItemStack containerStack = stack.getItem().getContainerItem(stack);
|
||||
if(containerStack != null && containerStack.getItem() != null)
|
||||
|
||||
Reference in new issue
Block a user