Skip to content

Commit

Permalink
barebones
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyWing committed Jun 9, 2024
1 parent 30ec2b4 commit a173703
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ dependencies {
implementation rfg.deobf("curse.maven:gregtechceu-557242:4951281")
implementation rfg.deobf("curse.maven:actually-additions-228404:3117927")
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848")
implementation rfg.deobf("curse.maven:mekanism-energistics-1027681:5408319")
implementation rfg.deobf("curse.maven:mekanism-ce-399904:5351260")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ curseForgeProjectId=
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
curseForgeRelations=requiredDependency:ae2-extended-life;requiredDependency:mixin-booter
curseForgeRelations=requiredDependency:ae2-extended-life;requiredDependency:mixin-booter;optionalDependency:mekanism-energistics
# This project's release type on CurseForge and/or Modrinth
# Allowed types: release, beta, alpha
releaseType=release
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/co/neeve/nae2/common/features/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public boolean isEnabled() {
}
},
DENSE_CELLS(EnumSet.allOf(DenseCellFeatures.class)),
DENSE_GAS_CELLS() {
@Override
public boolean isEnabled() {
return Platform.isModLoaded("mekeng") && super.isEnabled();
}
},
DENSE_CPU_COPROCESSORS("dense.coprocessor"),
DENSE_FLUID_CELLS(),
EXPOSER();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
import appeng.api.storage.data.IItemList;
import appeng.client.render.StackSizeRenderer;
import appeng.fluids.client.render.FluidStackSizeRenderer;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import co.neeve.nae2.Tags;
import com.github.bsideup.jabel.Desugar;
import com.google.common.collect.ImmutableList;
import com.mekeng.github.common.me.storage.IGasStorageChannel;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import mezz.jei.Internal;
Expand Down Expand Up @@ -81,6 +83,8 @@ private static String getStorageChannelUnits(IStorageChannel<?> storageChannel)
return "items";
} else if (storageChannel instanceof IFluidStorageChannel) {
return "buckets";
} else if (Platform.isModLoaded("mekeng") && storageChannel instanceof IGasStorageChannel) {
return "buckets";
} else {
return "units";
}
Expand Down Expand Up @@ -187,7 +191,8 @@ public void drawExtras(@NotNull Minecraft minecraft) {
var format = NumberFormat.getInstance();

var storedItemCount = this.cellInfo.cellInv.getStoredItemCount();
var transferFactor = this.cellInfo.channel().transferFactor();
var transferFactor = this.getTransferFactor();

var capacity = (this.cellInfo.cellInv.getRemainingItemCount() + storedItemCount) / transferFactor;
var byteLoss = this.cellInfo.cellInv.getBytesPerType() * this.cellInfo.cellInv.getStoredItemTypes();
var capacityLoss = byteLoss * this.cellInfo.channel.getUnitsPerByte() / transferFactor;
Expand All @@ -211,6 +216,16 @@ public void drawExtras(@NotNull Minecraft minecraft) {
}
}

private int getTransferFactor() {
final int transferFactor;
if (Platform.isModLoaded("mekeng") && this.cellInfo.channel instanceof IGasStorageChannel) {
transferFactor = 1000;
} else {
transferFactor = this.cellInfo.channel().transferFactor();
}
return transferFactor;
}

@Override
public @NotNull List<String> getTooltipStrings(int mouseX, int mouseY) {
if (this.cellInfo != null && mouseX > 0 && mouseY > 0 && mouseX < WIDTH && mouseY < TOTAL_HEIGHT - GRID_HEIGHT - 2) {
Expand Down Expand Up @@ -243,7 +258,7 @@ private <T> ITooltipCallback<T> getCallBack(CellInfo<? extends IAEStack<?>> cell
var unitName = I18n.format("nae2.jei.cellview." + getStorageChannelUnits(cellInfo.channel()));

tooltip.add(I18n.format("nae2.jei.cellview.hover.stored",
format.format(stackSize / (double) this.cellInfo.channel.transferFactor()), unitName));
format.format(stackSize / (double) this.getTransferFactor()), unitName));
tooltip.add(I18n.format("nae2.jei.cellview.used",
format.format(cellInfo.cellInv().getBytesPerType() + Math.ceil(stackSize / (double) cellInfo.channel().getUnitsPerByte()))));
}
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/co/neeve/nae2/common/items/cells/DenseGasCell.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package co.neeve.nae2.common.items.cells;

import appeng.core.Api;
import co.neeve.nae2.common.registration.definitions.Materials;
import com.mekeng.github.common.me.data.IAEGasStack;
import com.mekeng.github.common.me.storage.IGasStorageChannel;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;

public class DenseGasCell extends DenseCell<IAEGasStack> {
public DenseGasCell(Materials.MaterialType whichCell, int kilobytes) {
super(whichCell, kilobytes);
}

@NotNull
@Override
public IGasStorageChannel getChannel() {
return Api.INSTANCE.storage().getStorageChannel(IGasStorageChannel.class);
}

@Override
public int getTotalTypes(@NotNull ItemStack cellItem) {
return 15;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import co.neeve.nae2.common.features.Features;
import co.neeve.nae2.common.items.VirtualPattern;
import co.neeve.nae2.common.items.cells.DenseFluidCell;
import co.neeve.nae2.common.items.cells.DenseGasCell;
import co.neeve.nae2.common.items.cells.DenseItemCell;
import co.neeve.nae2.common.items.cells.handlers.VoidCellHandler;
import co.neeve.nae2.common.items.cells.vc.VoidFluidCell;
Expand Down Expand Up @@ -44,6 +45,10 @@ public class Items implements Definitions<IItemDefinition> {
private final IItemDefinition storageCellFluid1024K;
private final IItemDefinition storageCellFluid4096K;
private final IItemDefinition storageCellFluid16384K;
private final IItemDefinition storageCellGas256K;
private final IItemDefinition storageCellGas1024K;
private final IItemDefinition storageCellGas4096K;
private final IItemDefinition storageCellGas16384K;
private final IItemDefinition virtualPattern;

public Items(Registry registry) {
Expand Down Expand Up @@ -139,6 +144,30 @@ public Items(Registry registry) {
.features(Features.DENSE_FLUID_CELLS)
.build());

this.storageCellGas256K = this.registerById(registry.item("storage_cell_gas_256k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_256K,
(int) Math.pow(2, 8)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas1024K = this.registerById(registry.item("storage_cell_gas_1024k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_1024K,
(int) Math.pow(2, 10)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas4096K = this.registerById(registry.item("storage_cell_gas_4096k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_4096K,
(int) Math.pow(2, 12)))
.features(Features.DENSE_GAS_CELLS)
.build());

this.storageCellGas16384K = this.registerById(registry.item("storage_cell_gas_16384k", () ->
new DenseGasCell(Materials.MaterialType.CELL_GAS_PART_16384K,
(int) Math.pow(2, 14)))
.features(Features.DENSE_GAS_CELLS)
.build());

registry.addBootstrapComponent((IPostInitComponent) r -> {
var items = AEApi.instance().definitions().items();
var cellDef = items.cell1k();
Expand Down Expand Up @@ -237,4 +266,20 @@ public IItemDefinition storageCellFluid4096K() {
public IItemDefinition storageCellFluid16384K() {
return this.storageCellFluid16384K;
}

public IItemDefinition storageCellGas256K() {
return this.storageCellGas256K;
}

public IItemDefinition storageCellGas1024K() {
return this.storageCellGas1024K;
}

public IItemDefinition storageCellGas4096K() {
return this.storageCellGas4096K;
}

public IItemDefinition storageCellGas16384K() {
return this.storageCellGas16384K;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class Materials implements DamagedDefinitions<DamagedItemDefinition, Mate
private final IItemDefinition cellFluidPart1024K;
private final IItemDefinition cellFluidPart4096K;
private final IItemDefinition cellFluidPart16384K;
private final IItemDefinition cellGasPart256K;
private final IItemDefinition cellGasPart1024K;
private final IItemDefinition cellGasPart4096K;
private final IItemDefinition cellGasPart16384K;

private final NAEMaterial material;

public Materials(Registry registry) {
Expand All @@ -54,6 +59,26 @@ public Materials(Registry registry) {
this.cellFluidPart1024K = this.createMaterial(this.material, MaterialType.CELL_FLUID_PART_1024K);
this.cellFluidPart4096K = this.createMaterial(this.material, MaterialType.CELL_FLUID_PART_4096K);
this.cellFluidPart16384K = this.createMaterial(this.material, MaterialType.CELL_FLUID_PART_16384K);
this.cellGasPart256K = this.createMaterial(this.material, MaterialType.CELL_GAS_PART_256K);
this.cellGasPart1024K = this.createMaterial(this.material, MaterialType.CELL_GAS_PART_1024K);
this.cellGasPart4096K = this.createMaterial(this.material, MaterialType.CELL_GAS_PART_4096K);
this.cellGasPart16384K = this.createMaterial(this.material, MaterialType.CELL_GAS_PART_16384K);
}

public IItemDefinition cellGasPart256K() {
return this.cellGasPart256K;
}

public IItemDefinition cellGasPart1024K() {
return this.cellGasPart1024K;
}

public IItemDefinition cellGasPart4096K() {
return this.cellGasPart4096K;
}

public IItemDefinition cellGasPart16384K() {
return this.cellGasPart16384K;
}

@NotNull
Expand Down Expand Up @@ -129,7 +154,12 @@ public enum MaterialType implements IModelProvider {
CELL_FLUID_PART_256K("cell_part_fluid_256k", Features.DENSE_FLUID_CELLS),
CELL_FLUID_PART_1024K("cell_part_fluid_1024k", Features.DENSE_FLUID_CELLS),
CELL_FLUID_PART_4096K("cell_part_fluid_4096k", Features.DENSE_FLUID_CELLS),
CELL_FLUID_PART_16384K("cell_part_fluid_16384k", Features.DENSE_FLUID_CELLS);
CELL_FLUID_PART_16384K("cell_part_fluid_16384k", Features.DENSE_FLUID_CELLS),
CELL_GAS_PART_256K("cell_part_gas_256k", Features.DENSE_GAS_CELLS),
CELL_GAS_PART_1024K("cell_part_gas_1024k", Features.DENSE_GAS_CELLS),
CELL_GAS_PART_4096K("cell_part_gas_4096k", Features.DENSE_GAS_CELLS),
CELL_GAS_PART_16384K("cell_part_gas_16384k", Features.DENSE_GAS_CELLS);

private static Int2ObjectLinkedOpenHashMap<MaterialType> cachedValues;

private final String id;
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/assets/nae2/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ item.nae2.storage_cell_fluid_256k.name=§c256k§r ME Fluid Storage Cell
item.nae2.storage_cell_fluid_1024k.name=§61024k§r ME Fluid Storage Cell
item.nae2.storage_cell_fluid_4096k.name=§e4096k§r ME Fluid Storage Cell
item.nae2.storage_cell_fluid_16384k.name=§a16384k§r ME Fluid Storage Cell
item.nae2.storage_cell_gas_256k.name=§c256k§r ME Gas Storage Cell
item.nae2.storage_cell_gas_1024k.name=§61024k§r ME Gas Storage Cell
item.nae2.storage_cell_gas_4096k.name=§e4096k§r ME Gas Storage Cell
item.nae2.storage_cell_gas_16384k.name=§a16384k§r ME Gas Storage Cell

# Materials
item.nae2.material.cell_part_void.name=ME Void Storage Component
Expand All @@ -29,6 +33,10 @@ item.nae2.material.cell_part_fluid_256k.name=§c256k§r ME Fluid Storage Compone
item.nae2.material.cell_part_fluid_1024k.name=§61024k§r ME Fluid Storage Component
item.nae2.material.cell_part_fluid_4096k.name=§e4096k§r ME Fluid Storage Component
item.nae2.material.cell_part_fluid_16384k.name=§a16384k§r ME Fluid Storage Component
item.nae2.material.cell_part_gas_256k.name=§c256k§r ME Gas Storage Component
item.nae2.material.cell_part_gas_1024k.name=§61024k§r ME Gas Storage Component
item.nae2.material.cell_part_gas_4096k.name=§e4096k§r ME Gas Storage Component
item.nae2.material.cell_part_gas_16384k.name=§a16384k§r ME Gas Storage Component

# Parts
item.nae2.part.beam_former.name=ME Beam Former
Expand Down

0 comments on commit a173703

Please sign in to comment.