Fix: Interaction Sigil of Holding + Seer/Divination Sigil (no render) (#1391)
* Seer Sigil and Sigil of Divination now work properly when placed inside the Sigil of Holding closes #1285 * cleanup * Cleanup.
This commit is contained in:
parent
92e3333701
commit
3d3ce53ddd
|
@ -1,12 +1,15 @@
|
||||||
package WayofTime.bloodmagic.client.hud.element;
|
package WayofTime.bloodmagic.client.hud.element;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||||
|
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class ElementDivinedInformation<T extends TileEntity> extends ElementTileInformation<T> {
|
public abstract class ElementDivinedInformation<T extends TileEntity> extends ElementTileInformation<T> {
|
||||||
|
|
||||||
private final boolean simple;
|
private final boolean simple;
|
||||||
|
@ -24,23 +27,38 @@ public abstract class ElementDivinedInformation<T extends TileEntity> extends El
|
||||||
if (simple) {
|
if (simple) {
|
||||||
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION)
|
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION)
|
||||||
flag = true;
|
flag = true;
|
||||||
|
else flag = isFlagSigilHolding(sigilStack, true);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
sigilStack = player.getHeldItem(EnumHand.OFF_HAND);
|
sigilStack = player.getHeldItem(EnumHand.OFF_HAND);
|
||||||
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION)
|
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION)
|
||||||
flag = true;
|
flag = true;
|
||||||
|
else flag = isFlagSigilHolding(sigilStack, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
||||||
flag = true;
|
flag = true;
|
||||||
|
else flag = isFlagSigilHolding(sigilStack, false);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
sigilStack = player.getHeldItem(EnumHand.OFF_HAND);
|
sigilStack = player.getHeldItem(EnumHand.OFF_HAND);
|
||||||
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
||||||
flag = true;
|
flag = true;
|
||||||
|
else flag = isFlagSigilHolding(sigilStack, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.shouldRender(minecraft) && flag;
|
return super.shouldRender(minecraft) && flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFlagSigilHolding(ItemStack sigilStack, boolean simple) {
|
||||||
|
if (sigilStack.getItem() instanceof ItemSigilHolding) {
|
||||||
|
List<ItemStack> internalInv = ItemSigilHolding.getInternalInventory(sigilStack);
|
||||||
|
int currentSlot = ItemSigilHolding.getCurrentItemOrdinal(sigilStack);
|
||||||
|
if(internalInv != null && !internalInv.get(currentSlot).isEmpty()) {
|
||||||
|
return (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_SEER && !simple) || (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION && simple);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue