Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Travel Upgrade #66

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This is the universal Text Editor Configuration
# for all GTNewHorizons projects
# See: https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{bat,ini}]
end_of_line = crlf

[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
indent_size = 2

[*.java]
indent_size = 2
ij_java_space_before_if_parentheses = false
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

import java.util.stream.Stream;

public class TravelUpgrade extends AbstractUpgrade {

private static String UPGRADE_NAME = "travel";
private static final String UPGRADE_NAME = "travel";

public static final TravelUpgrade INSTANCE = new TravelUpgrade();

Expand All @@ -32,17 +34,18 @@ public TravelUpgrade(NBTTagCompound tag) {
}

public TravelUpgrade() {
super(UPGRADE_NAME, "enderio.darksteel.upgrade.travel", new ItemStack(EnderIO.itemMaterial,1,Material.ENDER_CRYSTAL.ordinal()), Config.darkSteelTravelCost);
super(UPGRADE_NAME, "enderio.darksteel.upgrade.travel", new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()), Config.darkSteelTravelCost);
}

@Override
public boolean canAddToItem(ItemStack stack) {
if(stack == null || (stack.getItem() != DarkSteelItems.itemDarkSteelSword && stack.getItem() != DarkSteelItems.itemEndSteelPickaxe && stack.getItem() != DarkSteelItems.itemEndSteelSword && stack.getItem() != DarkSteelItems.itemDarkSteelPickaxe)|| !EnergyUpgrade.itemHasAnyPowerUpgrade(stack)) {
return false;
}
TravelUpgrade up = loadFromItem(stack);
if(up == null) {
return true;
if(stack == null) return false;
if(Stream.of(
DarkSteelItems.itemDarkSteelSword, DarkSteelItems.itemEndSteelSword, DarkSteelItems.itemStellarSword,
DarkSteelItems.itemDarkSteelPickaxe, DarkSteelItems.itemEndSteelPickaxe, DarkSteelItems.itemStellarPickaxe,
DarkSteelItems.itemEndSteelAxe, DarkSteelItems.itemStellarAxe
).anyMatch(item -> stack.getItem() == item)) {
return EnergyUpgrade.itemHasAnyPowerUpgrade(stack) && loadFromItem(stack) == null;
}
return false;
}
Expand Down