Option to skip empty slots in Sigil of Holding (#807)
* Option to skip empty slots in Sigil of Holding
This commit is contained in:
parent
466f26d80b
commit
6680e8be49
|
@ -142,6 +142,7 @@ public class ConfigHandler
|
||||||
// Client
|
// Client
|
||||||
public static boolean alwaysRenderRoutingLines;
|
public static boolean alwaysRenderRoutingLines;
|
||||||
public static boolean invisibleSpectralBlocks;
|
public static boolean invisibleSpectralBlocks;
|
||||||
|
public static boolean sigilHoldingSkipsEmptySlots;
|
||||||
|
|
||||||
// Compat
|
// Compat
|
||||||
public static int wailaAltarDisplayMode;
|
public static int wailaAltarDisplayMode;
|
||||||
|
@ -290,6 +291,7 @@ public class ConfigHandler
|
||||||
config.addCustomCategoryComment(category, "Client only settings");
|
config.addCustomCategoryComment(category, "Client only settings");
|
||||||
alwaysRenderRoutingLines = config.getBoolean("alwaysRenderRoutingLines", category, false, "Always renders the beams between routing nodes. If false, only renders while a Node Router is being held.");
|
alwaysRenderRoutingLines = config.getBoolean("alwaysRenderRoutingLines", category, false, "Always renders the beams between routing nodes. If false, only renders while a Node Router is being held.");
|
||||||
invisibleSpectralBlocks = config.get(category, "invisibleSpectralBlocks", true, "Spectral Blocks (Used by the Suppression Sigil to store fluids) will not render at all. If false, a see through texture will render. [default: true]").setRequiresMcRestart(true).getBoolean();
|
invisibleSpectralBlocks = config.get(category, "invisibleSpectralBlocks", true, "Spectral Blocks (Used by the Suppression Sigil to store fluids) will not render at all. If false, a see through texture will render. [default: true]").setRequiresMcRestart(true).getBoolean();
|
||||||
|
sigilHoldingSkipsEmptySlots = config.getBoolean( "sigilHoldingSkipsEmptySlots", category, false, "The Sigil of Holding will skip empty sigil slots if set to true.");
|
||||||
|
|
||||||
category = "Compatibility";
|
category = "Compatibility";
|
||||||
config.addCustomCategoryComment(category, "Compatibility settings");
|
config.addCustomCategoryComment(category, "Compatibility settings");
|
||||||
|
|
|
@ -219,15 +219,14 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getCurrentSigil(ItemStack itemStack)
|
public static ItemStack getItemStackInSlot(ItemStack itemStack, int slot)
|
||||||
{
|
{
|
||||||
if (itemStack.getItem() instanceof ItemSigilHolding)
|
if (itemStack.getItem() instanceof ItemSigilHolding)
|
||||||
{
|
{
|
||||||
ItemStack[] itemStacks = getInternalInventory(itemStack);
|
ItemStack[] itemStacks = getInternalInventory(itemStack);
|
||||||
if (itemStacks != null)
|
if (itemStacks != null)
|
||||||
{
|
return itemStacks[slot == 5 ? 4 : slot];
|
||||||
return itemStacks[getCurrentItemOrdinal(itemStack)];
|
else return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -279,12 +278,41 @@ public class ItemSigilHolding extends ItemSigilBase implements IKeybindable
|
||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cycleSigil(ItemStack itemStack, int mode)
|
public static void cycleToNextSigil(ItemStack itemStack, int mode)
|
||||||
{
|
{
|
||||||
if (itemStack.getItem() instanceof ItemSigilHolding)
|
if (itemStack.getItem() instanceof ItemSigilHolding)
|
||||||
{
|
{
|
||||||
initModeTag(itemStack);
|
initModeTag(itemStack);
|
||||||
itemStack.getTagCompound().setInteger(Constants.NBT.CURRENT_SIGIL, mode);
|
|
||||||
|
int index;
|
||||||
|
int currentIndex = getCurrentItemOrdinal(itemStack);
|
||||||
|
ItemStack currentItemStack = getItemStackInSlot(itemStack, currentIndex);
|
||||||
|
if (currentItemStack == null)
|
||||||
|
return;
|
||||||
|
if (mode < 0)
|
||||||
|
{
|
||||||
|
index = next(currentIndex);
|
||||||
|
currentItemStack = getItemStackInSlot(itemStack, index);
|
||||||
|
|
||||||
|
while (currentItemStack == null)
|
||||||
|
{
|
||||||
|
index = next(index);
|
||||||
|
currentItemStack = getItemStackInSlot(itemStack, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = prev(currentIndex);
|
||||||
|
currentItemStack = getItemStackInSlot(itemStack, index);
|
||||||
|
|
||||||
|
while (currentItemStack == null)
|
||||||
|
{
|
||||||
|
index = prev(index);
|
||||||
|
currentItemStack = getItemStackInSlot(itemStack, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itemStack.getTagCompound().setInteger(Constants.NBT.CURRENT_SIGIL, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
@ -168,9 +169,14 @@ public class ClientHandler
|
||||||
|
|
||||||
private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel)
|
private void cycleSigil(ItemStack stack, EntityPlayer player, int dWheel)
|
||||||
{
|
{
|
||||||
int mode = ItemSigilHolding.getCurrentItemOrdinal(stack);
|
int mode = dWheel;
|
||||||
mode = dWheel < 0 ? ItemSigilHolding.next(mode) : ItemSigilHolding.prev(mode);
|
if (ConfigHandler.sigilHoldingSkipsEmptySlots)
|
||||||
ItemSigilHolding.cycleSigil(stack, mode);
|
{
|
||||||
|
mode = ItemSigilHolding.getCurrentItemOrdinal(stack);
|
||||||
|
mode = dWheel < 0 ? ItemSigilHolding.next(mode) : ItemSigilHolding.prev(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemSigilHolding.cycleToNextSigil(stack, mode);
|
||||||
BloodMagicPacketHandler.INSTANCE.sendToServer(new SigilHoldingPacketProcessor(player.inventory.currentItem, mode));
|
BloodMagicPacketHandler.INSTANCE.sendToServer(new SigilHoldingPacketProcessor(player.inventory.currentItem, mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue