Skip to content

Commit

Permalink
wip item nonsense
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAPenguin0 committed Jan 9, 2025
1 parent 801f41c commit ddce335
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/gregtech/api/items/CircuitComponentFakeItem.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package gregtech.api.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import gregtech.common.tileentities.machines.multi.nanochip.util.CircuitComponent;
import net.minecraft.util.IIcon;

import java.util.List;

public class CircuitComponentFakeItem extends GTGenericItem {

Expand All @@ -26,4 +30,21 @@ public String getItemStackDisplayName(ItemStack stack) {
CircuitComponent component = CircuitComponent.getFromFakeStackUnsafe(stack);
return component.getLocalizedName();
}

@Override
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List<String> aList, boolean aF3_H) {
aList.add("Item in the Nanochip Assembly Complex vacuum pipe system");
super.addInformation(aStack, aPlayer, aList, aF3_H);
}

@Override
public IIcon getIconFromDamage(int meta) {
// If the component stores an icon, use that
CircuitComponent component = CircuitComponent.getFromMetaDataUnsafe(meta);
if (component.icon != null) return component.icon;
// Else just use the texture that should be assigned to it
return super.getIconFromDamage(meta);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;

import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;

import gregtech.api.enums.ItemList;
Expand Down Expand Up @@ -94,6 +95,9 @@ public enum CircuitComponent {

public final String unlocalizedName;
public String fallbackLocalizedName = null;
// If this component is a direct conversion of some other item in the NAC main controller, this is the item used for that.
// Otherwise, this is null
public IIcon icon = null;
public final Materials material;
// This is the recipe map that this component is used in as an input item
public final RecipeMap<?> processingMap;
Expand Down Expand Up @@ -147,6 +151,10 @@ public static CircuitComponent getFromFakeStackUnsafe(ItemStack stack) {
return CircuitComponent.values()[stack.getItemDamage()];
}

public static CircuitComponent getFromMetaDataUnsafe(int metadata) {
return CircuitComponent.values()[metadata];
}

static {
// Populate real circuit conversion hashmap
for (CircuitComponent component : CircuitComponent.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private static void addConversionRecipe(CircuitComponent component, ItemStack st
.duration(1 * TICKS)
.eut(0)
.addTo(RecipeMaps.nanochipConversionRecipes);
component.icon = stack.getIconIndex();
}

// Adds a simple processing recipe for circuit components in a module. The recipe map used for processing is
Expand Down

0 comments on commit ddce335

Please sign in to comment.