Skip to content

Commit

Permalink
Revert LED for now + minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 4, 2022
1 parent 6aa7041 commit 257aa86
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import ninety.megacells.core.MEGATier;
import ninety.megacells.integration.appmek.AppMekCellType;
import ninety.megacells.integration.appmek.AppMekItems;
import ninety.megacells.item.MEGACellType;
import ninety.megacells.item.MEGAItems;
import ninety.megacells.item.core.MEGACellType;

public class MEGAItemModelProvider extends ItemModelProvider {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import ninety.megacells.core.BlockDefinition;
import ninety.megacells.core.MEGATier;
import ninety.megacells.integration.appmek.AppMekCellType;
import ninety.megacells.item.IMEGACellType;
import ninety.megacells.item.MEGACellType;
import ninety.megacells.item.MEGAItems;
import ninety.megacells.item.MEGAPortableCell;
import ninety.megacells.item.MEGAStorageCell;
import ninety.megacells.item.core.IMEGACellType;
import ninety.megacells.item.core.MEGACellType;

public class MEGARecipeProvider extends RecipeProvider {
public MEGARecipeProvider(DataGenerator generator) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ninety/megacells/init/InitUpgrades.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import appeng.core.localization.GuiText;

import ninety.megacells.integration.appmek.AppMekCellType;
import ninety.megacells.item.MEGACellType;
import ninety.megacells.item.MEGAItems;
import ninety.megacells.item.core.MEGACellType;

public class InitUpgrades {
public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import ninety.megacells.MEGACells;
import ninety.megacells.integration.appmek.AppMekCellType;
import ninety.megacells.item.MEGACellType;
import ninety.megacells.item.MEGAItems;
import ninety.megacells.item.core.MEGACellType;

public class InitCellModels {
public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import ninety.megacells.integration.appmek.AppMekCellType;
import ninety.megacells.item.MEGABulkCell;
import ninety.megacells.item.MEGACellType;
import ninety.megacells.item.MEGAItems;
import ninety.megacells.item.MEGAPortableCell;
import ninety.megacells.item.MEGAStorageCell;
import ninety.megacells.item.core.MEGACellType;

public class InitItemColors {
public static void init() {
Expand All @@ -25,7 +24,7 @@ private static void initItemColors(ColorHandlerEvent.Item event) {
AppMekCellType.CHEMICAL.getCells().stream()).flatMap(s -> s).toList()) {
event.getItemColors().register(MEGAStorageCell::getColor, cell);
}
event.getItemColors().register(MEGABulkCell::getColor, MEGAItems.BULK_ITEM_CELL.asItem());
event.getItemColors().register(MEGAStorageCell::getColor, MEGAItems.BULK_ITEM_CELL.asItem());

for (var cell : Stream.of(
MEGACellType.ITEM.getPortableCells().stream(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import me.ramidzkh.mekae2.AMMenus;
import me.ramidzkh.mekae2.ae2.MekanismKeyType;

import ninety.megacells.item.IMEGACellType;
import ninety.megacells.item.core.IMEGACellType;

public enum AppMekCellType implements IMEGACellType {
CHEMICAL;
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/ninety/megacells/item/MEGABulkCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,4 @@ public FuzzyMode getFuzzyMode(ItemStack is) {
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {
}

public static int getColor(ItemStack is, int tintIndex) {
if (tintIndex == 1) {
// Determine LED color

var handler = BasicCellHandler.INSTANCE.getCellInventory(is, null);
if (handler == null) {
return 0xFFFFFF;
}

double used = handler.getUsedBytes();

if (used == 0) {
return 0xFFFFFF;
} else {
double p = 1 - used / (double) Integer.MAX_VALUE;
int r = (int) (255d * (Math.max(0, Math.min(2 - 2 * p, 1))));
int g = (int) (255d * (Math.max(0, Math.min(2 * p, 1))));
return 0xFF000000 + (r << 16) + (g << 8);
}
} else {
// White
return 0xFFFFFF;
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/ninety/megacells/item/MEGAItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import ninety.megacells.MEGACells;
import ninety.megacells.core.ItemDefinition;
import ninety.megacells.core.MEGATier;
import ninety.megacells.item.core.IMEGACellType;
import ninety.megacells.item.core.MEGACellType;

public final class MEGAItems {

Expand Down
1 change: 1 addition & 0 deletions src/main/java/ninety/megacells/item/MEGAPortableCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import ninety.megacells.MEGACells;
import ninety.megacells.core.MEGATier;
import ninety.megacells.item.core.IMEGACellType;

public class MEGAPortableCell extends PortableCellItem {

Expand Down
1 change: 1 addition & 0 deletions src/main/java/ninety/megacells/item/MEGAStorageCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import appeng.items.storage.BasicStorageCell;

import ninety.megacells.core.MEGATier;
import ninety.megacells.item.core.IMEGACellType;

public class MEGAStorageCell extends BasicStorageCell {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ninety.megacells.item;
package ninety.megacells.item.core;

import net.minecraft.tags.TagKey;
import net.minecraft.world.inventory.MenuType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ninety.megacells.item;
package ninety.megacells.item.core;

import java.util.List;

Expand All @@ -10,6 +10,8 @@
import appeng.datagen.providers.tags.ConventionTags;
import appeng.menu.me.common.MEStorageMenu;

import ninety.megacells.item.MEGAItems;

public enum MEGACellType implements IMEGACellType {
ITEM(AEKeyType.items(), 63, "item"),
FLUID(AEKeyType.fluids(), 9, "fluid");
Expand Down

0 comments on commit 257aa86

Please sign in to comment.