Skip to content

Commit

Permalink
More rearrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Sep 4, 2023
1 parent ce88e62 commit 36b9271
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/gripe/_90/megacells/MEGACells.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import gripe._90.megacells.integration.ae2wt.AE2WTIntegration;
import gripe._90.megacells.integration.appbot.AppBotIntegration;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.item.MEGABulkCell;
import gripe._90.megacells.item.cell.MEGABulkCell;

public final class MEGACells {
private MEGACells() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import gripe._90.megacells.MEGACells;
import gripe._90.megacells.crafting.DecompressionPatternItem;
import gripe._90.megacells.item.MEGABulkCell;
import gripe._90.megacells.item.MEGAPortableCell;
import gripe._90.megacells.item.cell.MEGABulkCell;
import gripe._90.megacells.item.cell.MEGAPortableCell;
import gripe._90.megacells.item.part.DecompressionModulePart;
import gripe._90.megacells.item.part.MEGAInterfacePart;
import gripe._90.megacells.item.part.MEGAPatternProviderPart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.cells.StorageCell;

import gripe._90.megacells.item.MEGABulkCell;
import gripe._90.megacells.util.CompressionChain;
import gripe._90.megacells.util.CompressionService;

Expand All @@ -27,7 +26,7 @@ public class BulkCellInventory implements StorageCell {
private static final long STACK_LIMIT = (long) Math.pow(2, 42);

private final ISaveProvider container;
private final ItemStack i;
private final ItemStack stack;

private AEItemKey storedItem;
private final AEItemKey filterItem;
Expand All @@ -39,17 +38,17 @@ public class BulkCellInventory implements StorageCell {

private boolean isPersisted = true;

public BulkCellInventory(MEGABulkCell cell, ItemStack o, ISaveProvider container) {
this.i = o;
public BulkCellInventory(MEGABulkCell cell, ItemStack stack, ISaveProvider container) {
this.stack = stack;
this.container = container;

filterItem = (AEItemKey) cell.getConfigInventory(i).getKey(0);
filterItem = (AEItemKey) cell.getConfigInventory(this.stack).getKey(0);
storedItem = getTag().contains(KEY) ? AEItemKey.fromTag(getTag().getCompound(KEY)) : null;
unitCount = !getTag().getString(UNIT_COUNT).isEmpty()
? new BigInteger(getTag().getString(UNIT_COUNT))
: BigInteger.ZERO;

compressionEnabled = cell.getUpgrades(i).isInstalled(COMPRESSION_CARD);
compressionEnabled = cell.getUpgrades(this.stack).isInstalled(COMPRESSION_CARD);
compressionChain = CompressionService.INSTANCE
.getChain(storedItem != null ? storedItem : filterItem)
.orElseGet(CompressionChain::new);
Expand All @@ -61,7 +60,7 @@ private long clampedLong(BigInteger toClamp, long limit) {
}

private CompoundTag getTag() {
return i.getOrCreateTag();
return stack.getOrCreateTag();
}

@Override
Expand Down Expand Up @@ -231,6 +230,6 @@ public void getAvailableStacks(KeyCounter out) {

@Override
public Component getDescription() {
return i.getHoverName();
return stack.getHoverName();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gripe._90.megacells.item;
package gripe._90.megacells.item.cell;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -32,7 +32,6 @@

import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.definition.MEGATranslations;
import gripe._90.megacells.item.cell.BulkCellInventory;

public class MEGABulkCell extends AEBaseItem implements ICellWorkbenchItem {
public static final Handler HANDLER = new Handler();
Expand All @@ -46,6 +45,11 @@ public ConfigInventory getConfigInventory(ItemStack is) {
return CellConfig.create(AEItemKey.filter(), is, 1);
}

@Override
public IUpgradeInventory getUpgrades(ItemStack is) {
return UpgradeInventories.forItem(is, 1);
}

@Override
public void appendHoverText(ItemStack is, Level level, @NotNull List<Component> lines, @NotNull TooltipFlag adv) {
var inv = HANDLER.getCellInventory(is, null);
Expand Down Expand Up @@ -114,11 +118,6 @@ public Optional<TooltipComponent> getTooltipImage(ItemStack is) {
return Optional.of(new StorageCellTooltipComponent(upgrades, content, false, true));
}

@Override
public IUpgradeInventory getUpgrades(ItemStack is) {
return UpgradeInventories.forItem(is, 1);
}

@Override
public FuzzyMode getFuzzyMode(ItemStack itemStack) {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gripe._90.megacells.item;
package gripe._90.megacells.item.cell;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.Set;
import java.util.stream.Stream;

import gripe._90.megacells.MEGACells;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;

Expand All @@ -19,6 +18,7 @@

import appeng.api.stacks.AEItemKey;

import gripe._90.megacells.MEGACells;
import gripe._90.megacells.definition.MEGATags;

public class CompressionService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import me.ramidzkh.mekae2.ae2.MekanismKeyType;
import mekanism.api.chemical.attribute.ChemicalAttributeValidator;

import gripe._90.megacells.item.MEGAPortableCell;
import gripe._90.megacells.item.cell.MEGAPortableCell;

public class MEGAPortableChemicalCell extends MEGAPortableCell {
public MEGAPortableChemicalCell(Properties props, StorageTier tier, int defaultColour) {
Expand Down

0 comments on commit 36b9271

Please sign in to comment.