Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/codechicken/nei/ItemsTooltipLineHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public void setLabelColor(EnumChatFormatting color) {
this.labelColor = color;
}

public void setLabel(String label) {
this.label = label;
this.size.width = Math.max(this.columns * SLOT_SIZE, fontRenderer.getStringWidth(this.label) + 15);
}

@Override
public void draw(int x, int y) {
if (this.length == 0) return;
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/codechicken/nei/PositionedStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public class PositionedStack implements Cloneable {
protected int chance = CHANCE_FULL;
protected boolean permutated = false;

protected String acceptsLabel;
protected List<String> tooltip;
protected List<Badge> badges;

public PositionedStack(Object object, int x, int y, boolean genPerms) {
items = NEIServerUtils.extractRecipeItems(object);
relx = x;
Expand Down Expand Up @@ -90,12 +94,28 @@ public void setMaxSize(int i) {
for (ItemStack item : items) if (item.stackSize > i) item.stackSize = i;
}

public void setAcceptsLabel(String acceptsLabel) {
this.acceptsLabel = acceptsLabel;
}

public String getAcceptsLabel() {
return this.acceptsLabel;
}

public void setBadges(List<Badge> badges) {
this.badges = badges;
}

public List<Badge> getBadges() {
return null;
return this.badges;
}

public void setTooltip(List<String> tooltip) {
this.tooltip = tooltip;
}

public List<String> getTooltip() {
return null;
return this.tooltip;
}

public int getChance() {
Expand All @@ -111,6 +131,8 @@ public PositionedStack copy() {
PositionedStack pStack = (PositionedStack) super.clone();
pStack.items = Arrays.stream(this.items).map(ItemStack::copy).toArray(ItemStack[]::new);
pStack.item = this.item == null ? null : this.item.copy();
pStack.tooltip = this.tooltip == null ? null : new ArrayList<>(this.tooltip);
pStack.badges = this.badges == null ? null : new ArrayList<>(this.badges);
return pStack;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AcceptsFollowingTooltipLineHandler extends ItemsTooltipLineHandler

public Object tooltipGUID;

public AcceptsFollowingTooltipLineHandler(Object tooltipGUID, List<ItemStack> items, ItemStack activeStack,
protected AcceptsFollowingTooltipLineHandler(Object tooltipGUID, List<ItemStack> items, ItemStack activeStack,
int maxRows) {
super(NEIClientUtils.translate("recipe.accepts"), items, false, maxRows);
this.tooltipGUID = tooltipGUID;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/codechicken/nei/recipe/NEIRecipeWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ public List<String> handleItemTooltip(ItemStack itemstack, int mousex, int mouse
|| this.acceptsFollowingTooltipLineHandler.tooltipGUID != hovered) {
this.acceptsFollowingTooltipLineHandler = AcceptsFollowingTooltipLineHandler
.of(hovered, this.permutations.get(hovered), hovered.item);

if (this.acceptsFollowingTooltipLineHandler != null && hovered.getAcceptsLabel() != null) {
this.acceptsFollowingTooltipLineHandler.setLabel(hovered.getAcceptsLabel());
}
}
} else if (this.acceptsFollowingTooltipLineHandler != null) {
this.acceptsFollowingTooltipLineHandler = null;
Expand Down