Skip to content

Commit

Permalink
Fix incorrect stack size, charge rates and recipe IDs for chemical an…
Browse files Browse the repository at this point in the history
…d source cells

Closes #119
  • Loading branch information
62832 committed May 2, 2024
1 parent ed42e53 commit eb5d82d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@

import java.util.List;

import org.jetbrains.annotations.NotNull;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;

import appeng.api.stacks.AEKey;
import appeng.core.definitions.ItemDefinition;
import appeng.items.materials.MaterialItem;
import appeng.items.storage.StorageTier;
import appeng.items.tools.powered.AbstractPortableCell;

import me.ramidzkh.mekae2.AMMenus;
import me.ramidzkh.mekae2.item.ChemicalPortableCellItem;
import me.ramidzkh.mekae2.ae2.MekanismKey;
import me.ramidzkh.mekae2.ae2.MekanismKeyType;
import me.ramidzkh.mekae2.item.ChemicalStorageCell;
import mekanism.api.chemical.attribute.ChemicalAttributeValidator;

import gripe._90.megacells.MEGACells;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.integration.appmek.item.RadioactiveCellItem;
import gripe._90.megacells.item.cell.MEGAPortableCell;

public final class AppMekItems {
public static void init() {
Expand All @@ -34,16 +36,11 @@ public static void init() {
public static final ItemDefinition<ChemicalStorageCell> CHEMICAL_CELL_64M = cell(MEGAItems.TIER_64M);
public static final ItemDefinition<ChemicalStorageCell> CHEMICAL_CELL_256M = cell(MEGAItems.TIER_256M);

public static final ItemDefinition<ChemicalPortableCellItem> PORTABLE_CHEMICAL_CELL_1M =
portable(MEGAItems.TIER_1M);
public static final ItemDefinition<ChemicalPortableCellItem> PORTABLE_CHEMICAL_CELL_4M =
portable(MEGAItems.TIER_4M);
public static final ItemDefinition<ChemicalPortableCellItem> PORTABLE_CHEMICAL_CELL_16M =
portable(MEGAItems.TIER_16M);
public static final ItemDefinition<ChemicalPortableCellItem> PORTABLE_CHEMICAL_CELL_64M =
portable(MEGAItems.TIER_64M);
public static final ItemDefinition<ChemicalPortableCellItem> PORTABLE_CHEMICAL_CELL_256M =
portable(MEGAItems.TIER_256M);
public static final ItemDefinition<MEGAPortableCell> PORTABLE_CHEMICAL_CELL_1M = portable(MEGAItems.TIER_1M);
public static final ItemDefinition<MEGAPortableCell> PORTABLE_CHEMICAL_CELL_4M = portable(MEGAItems.TIER_4M);
public static final ItemDefinition<MEGAPortableCell> PORTABLE_CHEMICAL_CELL_16M = portable(MEGAItems.TIER_16M);
public static final ItemDefinition<MEGAPortableCell> PORTABLE_CHEMICAL_CELL_64M = portable(MEGAItems.TIER_64M);
public static final ItemDefinition<MEGAPortableCell> PORTABLE_CHEMICAL_CELL_256M = portable(MEGAItems.TIER_256M);

public static final ItemDefinition<MaterialItem> RADIOACTIVE_CELL_COMPONENT =
MEGAItems.item("MEGA Radioactive Storage Component", "radioactive_cell_component", MaterialItem::new);
Expand All @@ -67,19 +64,24 @@ private static ItemDefinition<ChemicalStorageCell> cell(StorageTier tier) {
return MEGAItems.item(
tier.namePrefix().toUpperCase() + " MEGA Chemical Storage Cell",
"chemical_storage_cell_" + tier.namePrefix(),
p -> new ChemicalStorageCell(p, tier, MEGA_CHEMICAL_CELL_HOUSING));
p -> new ChemicalStorageCell(p.stacksTo(1), tier, MEGA_CHEMICAL_CELL_HOUSING));
}

private static ItemDefinition<ChemicalPortableCellItem> portable(StorageTier tier) {
private static ItemDefinition<MEGAPortableCell> portable(StorageTier tier) {
return MEGAItems.item(
tier.namePrefix().toUpperCase() + " Portable Chemical Cell",
"portable_chemical_cell_" + tier.namePrefix(),
p -> new ChemicalPortableCellItem(18, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, tier, p, 0x33528D) {
@NotNull
@Override
public ResourceLocation getRecipeId() {
return MEGACells.makeId("cells/portable/portable_chemical_cell_" + tier.namePrefix());
}
});
p ->
new MEGAPortableCell(
p, tier, MekanismKeyType.TYPE, AMMenus.PORTABLE_CHEMICAL_CELL_TYPE, 0x33528D) {
@Override
public boolean isBlackListed(ItemStack cellItem, AEKey requestedAddition) {
if (requestedAddition instanceof MekanismKey key) {
return !ChemicalAttributeValidator.DEFAULT.process(key.getStack());
} else {
return true;
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.jetbrains.annotations.NotNull;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;

import appeng.core.definitions.ItemDefinition;
import appeng.items.materials.MaterialItem;
Expand Down Expand Up @@ -54,19 +55,29 @@ private static ItemDefinition<SourceCellItem> cell(StorageTier tier) {
return MEGAItems.item(
tier.namePrefix().toUpperCase() + " MEGA Source Storage Cell",
"source_storage_cell_" + tier.namePrefix(),
p -> new SourceCellItem(p, tier, MEGA_SOURCE_CELL_HOUSING));
p -> new SourceCellItem(p.stacksTo(1), tier, MEGA_SOURCE_CELL_HOUSING));
}

private static ItemDefinition<PortableSourceCellItem> portable(StorageTier tier) {
return MEGAItems.item(
tier.namePrefix().toUpperCase() + " Portable Source Cell",
"portable_source_cell_" + tier.namePrefix(),
p -> new PortableSourceCellItem(p, tier) {
p -> new PortableSourceCellItem(p.stacksTo(1), tier) {
@NotNull
@Override
public ResourceLocation getRecipeId() {
return MEGACells.makeId("cells/portable/portable_source_cell_" + tier.namePrefix());
}

@Override
public double getChargeRate(ItemStack stack) {
return super.getChargeRate(stack) * 2;
}

@Override
public double getAEMaxPower(ItemStack stack) {
return super.getAEMaxPower(stack) * 8;
}
});
}
}

0 comments on commit eb5d82d

Please sign in to comment.