Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 19 additions & 45 deletions src/main/java/talonos/blightbuster/items/ItemPurityFocus.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,18 @@ public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z,
private void cleanNode(int x, int y, int z, EntityPlayer player, ItemStack itemstack) {
TileEntity tile = player.getEntityWorld()
.getTileEntity(x, y, z);
if (tile instanceof TileNode node) {

if (tile instanceof TileNode node_) {
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
boolean hasNodeUpgrade = isUpgradedWith(wand.getFocusItem(itemstack), ItemPurityFocus.node);
if (node.getNodeType() == NodeType.TAINTED
if (node_.getNodeType() == NodeType.TAINTED
&& wand.consumeAllVis(itemstack, player, getNodeVisCost(), true, false)) {
if (hasNodeUpgrade) {
node.setNodeType(NodeType.PURE);
node_.setNodeType(NodeType.PURE);
} else {
node.setNodeType(NodeType.NORMAL);
node_.setNodeType(NodeType.NORMAL);
}
node.markDirty();
node_.markDirty();
player.worldObj.markBlockForUpdate(x, y, z);
PurityFocusFX.node(player, x, y, z);
}
Expand Down Expand Up @@ -347,6 +348,7 @@ public boolean showAxis(ItemStack stack, World world, EntityPlayer player, int s
} else return axis == EnumAxis.Z && (dim == 0 || dim == 2);
}

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
AspectList al = this.getVisCost(stack);
Expand All @@ -372,7 +374,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool
this.addFocusInformation(stack, player, list, par4);
}

private static void addVis(List list, AspectList al) {
private static void addVis(List<String> list, AspectList al) {
if (al.size() < 1) {
list.add(" " + StatCollector.translateToLocal("gui.visCost.noCost"));
return;
Expand Down Expand Up @@ -421,62 +423,34 @@ public static AspectList getVacuumVisCost() {
}

public static void setBlockVisCost(AspectList list) {
for (Aspect a : blockCost.getAspects()) {
blockCost.remove(a);
}
if (list.size() < 1) {
return;
}
for (Aspect a : list.getAspects()) {
blockCost.add(a, list.getAmount(a));
}
setVisCost(list, blockCost);
}

public static void setNodeVisCost(AspectList list) {
for (Aspect a : nodeCost.getAspects()) {
nodeCost.remove(a);
}
if (list.size() < 1) {
return;
}
for (Aspect a : list.getAspects()) {
nodeCost.add(a, list.getAmount(a));
}
setVisCost(list, nodeCost);
}

public static void setAttackVisCost(AspectList list) {
for (Aspect a : attackCost.getAspects()) {
attackCost.remove(a);
}
if (list.size() < 1) {
return;
}
for (Aspect a : list.getAspects()) {
attackCost.add(a, list.getAmount(a));
}
setVisCost(list, attackCost);
}

public static void setHealVisCost(AspectList list) {
for (Aspect a : healCost.getAspects()) {
healCost.remove(a);
}
if (list.size() < 1) {
return;
}
for (Aspect a : list.getAspects()) {
healCost.add(a, list.getAmount(a));
}
setVisCost(list, healCost);
}

public static void setVacuumVisCost(AspectList list) {
for (Aspect a : vacuumCost.getAspects()) {
vacuumCost.remove(a);
setVisCost(list, vacuumCost);
}

private static void setVisCost(AspectList list, AspectList nodeCost) {
for (Aspect a : nodeCost.getAspects()) {
nodeCost.remove(a);
}
if (list.size() < 1) {
return;
}
for (Aspect a : list.getAspects()) {
vacuumCost.add(a, list.getAmount(a));
nodeCost.add(a, list.getAmount(a));
}
}

Expand Down