Skip to content

Commit

Permalink
Fixed upgrade desync (for real, this time)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroksl committed Dec 3, 2024
1 parent a888b4c commit 5e283ad
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 150 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ loader_version_range=[4,)
mod_id=advanced_ae
mod_name=Advanced AE
mod_license=LGPL-3.0
mod_version=1.1.7-1.21.1
mod_version=1.1.8-1.21.1
mod_group_id=net.pedroksl.advanced_ae
mod_authors=Pedroksl
mod_description=An AE2 addon that adds a lot of utilities and quality of life.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
public interface IUpgradeableItem extends IGridLinkedItem {
List<UpgradeType> getPossibleUpgrades();

List<UpgradeType> getAppliedUpgrades(ItemStack stack);
default List<UpgradeType> getAppliedUpgrades(ItemStack stack) {
var appliedUpgrades = new ArrayList<UpgradeType>();
for (var upgrade : getPossibleUpgrades()) {
if (hasUpgrade(stack, upgrade)) {
appliedUpgrades.add(upgrade);
}
}
return appliedUpgrades;
}

default List<UpgradeType> getPassiveUpgrades(ItemStack itemStack) {
List<UpgradeType> abilityList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public class QuantumArmorBase extends PoweredItem implements GeoItem, IMenuItem,
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);

protected final List<UpgradeType> possibleUpgrades = new ArrayList<>();
private List<UpgradeType> appliedUpgrades;

protected static final String MENU_TYPE = "aae$menutype";

Expand Down Expand Up @@ -134,19 +133,6 @@ public List<UpgradeType> getPossibleUpgrades() {
return possibleUpgrades;
}

@Override
public List<UpgradeType> getAppliedUpgrades(ItemStack stack) {
if (appliedUpgrades == null) {
appliedUpgrades = new ArrayList<>();
for (var upgrade : possibleUpgrades) {
if (hasUpgrade(stack, upgrade)) {
appliedUpgrades.add(upgrade);
}
}
}
return appliedUpgrades;
}

protected boolean checkPreconditions(ItemStack item) {
return !item.isEmpty() && item.getItem() == this;
}
Expand Down
Loading

0 comments on commit 5e283ad

Please sign in to comment.