Skip to content

Commit

Permalink
v1.5.2 (#22)
Browse files Browse the repository at this point in the history
Manual merge of v1.5.2 from upstream.

Also updated buildscript and applied spotless, which seems to have switched around import orders for a lot of files.
  • Loading branch information
D-Cysteine authored Apr 27, 2023
1 parent 20b6565 commit d03e63f
Show file tree
Hide file tree
Showing 37 changed files with 428 additions and 193 deletions.
460 changes: 337 additions & 123 deletions build.gradle

Large diffs are not rendered by default.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@

import org.lwjgl.input.Keyboard;

import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import codechicken.nei.recipe.RecipeItemInputHandler;

import com.github.dcysteine.neicustomdiagram.api.diagram.component.Component;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.DisplayComponent;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.FluidComponent;
Expand All @@ -40,6 +30,16 @@
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;
import com.google.common.collect.ImmutableList;

import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import codechicken.nei.recipe.RecipeItemInputHandler;

public class DiagramGroup implements ICraftingHandler, IUsageHandler {

protected final DiagramGroupInfo info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import java.util.function.Predicate;

import codechicken.nei.recipe.HandlerInfo;

import com.github.dcysteine.neicustomdiagram.api.diagram.component.ItemComponent;
import com.github.dcysteine.neicustomdiagram.api.diagram.layout.Grid;
import com.github.dcysteine.neicustomdiagram.main.config.DiagramGroupVisibility;
import com.google.auto.value.AutoValue;

import codechicken.nei.recipe.HandlerInfo;

@AutoValue
public abstract class DiagramGroupInfo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.dcysteine.neicustomdiagram.api.diagram;

import codechicken.nei.NEIClientUtils;

import com.github.dcysteine.neicustomdiagram.api.draw.scroll.ScrollDirection;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;

import codechicken.nei.NEIClientUtils;

/**
* Class that keeps track of any mutable state for diagrams.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;

import codechicken.nei.NEIClientUtils;

import com.github.dcysteine.neicustomdiagram.api.diagram.interactable.Interactable;
import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.TextFormatting;
import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.Tooltip;
Expand All @@ -22,6 +20,8 @@
import com.google.auto.value.extension.toprettystring.ToPrettyString;
import com.google.common.base.Splitter;

import codechicken.nei.NEIClientUtils;

/**
* A display component is a component that may have additional display information attached, such as stack size or
* tooltip.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

import com.github.dcysteine.neicustomdiagram.api.diagram.interactable.Interactable;
import com.github.dcysteine.neicustomdiagram.api.draw.Draw;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;
import com.google.auto.value.AutoValue;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

@AutoValue
public abstract class FluidComponent implements Component {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
import java.util.Optional;

import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

import com.github.dcysteine.neicustomdiagram.api.diagram.interactable.Interactable;
import com.github.dcysteine.neicustomdiagram.api.draw.Draw;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;
import com.google.auto.value.AutoValue;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

@AutoValue
public abstract class ItemComponent implements Component {

Expand All @@ -27,6 +28,18 @@ public abstract class ItemComponent implements Component {

public static final int DEFAULT_STACK_SIZE = 1;

/**
* Helper method for retrieving the raw item damage of an {@code ItemStack}.
*
* <p>
* This method is better than calling {@link ItemStack#getItemDamage()}, because that method could be overridden
* with a custom implementation of {@link Item#getDamage(ItemStack)} and therefore not actually return the raw item
* damage.
*/
public static int getItemDamage(ItemStack itemStack) {
return Items.feather.getDamage(itemStack);
}

public static ItemComponent create(Item item, int damage, Optional<NBTTagCompound> nbt) {
if (item.isDamageable()) {
return new AutoValue_ItemComponent(item, 0, nbt.map(ImmutableNbtWrapper::create));
Expand All @@ -41,15 +54,15 @@ public static ItemComponent create(Item item, int damage) {

/** NBT will be discarded. Use {@link #createWithNbt(ItemStack)} if you want NBT. */
public static ItemComponent create(ItemStack itemStack) {
return create(itemStack.getItem(), itemStack.getItemDamage());
return create(itemStack.getItem(), getItemDamage(itemStack));
}

public static ItemComponent createWithNbt(ItemStack itemStack) {
return create(itemStack.getItem(), itemStack.getItemDamage(), Optional.ofNullable(itemStack.stackTagCompound));
return create(itemStack.getItem(), getItemDamage(itemStack), Optional.ofNullable(itemStack.stackTagCompound));
}

public static ItemComponent createWithNbt(ItemStack itemStack, NBTTagCompound nbt) {
return create(itemStack.getItem(), itemStack.getItemDamage(), Optional.of(nbt));
return create(itemStack.getItem(), getItemDamage(itemStack), Optional.of(nbt));
}

public static Optional<ItemComponent> create(Block block, int damage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import java.util.function.Consumer;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramState;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.FluidComponent;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.ItemComponent;
Expand All @@ -13,6 +10,9 @@
import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;

import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;

/** This class is a flexible way to create arbitrary interactables, but requires a lot of setup. */
public class CustomInteractable implements Interactable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;

import codechicken.nei.NEIClientUtils;

import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramState;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.Component;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.DisplayComponent;
Expand All @@ -20,6 +18,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;

import codechicken.nei.NEIClientUtils;

/**
* An interactive component group.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.ArrayList;
import java.util.List;

import codechicken.lib.gui.GuiDraw;

import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramState;
import com.github.dcysteine.neicustomdiagram.api.draw.BoundedDrawable;
import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
Expand All @@ -15,6 +13,8 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;

import codechicken.lib.gui.GuiDraw;

/**
* Immutable class representing a text label.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.github.dcysteine.neicustomdiagram.api.diagram.tooltip;

import codechicken.lib.gui.GuiDraw;

import com.github.dcysteine.neicustomdiagram.api.diagram.component.Component;
import com.github.dcysteine.neicustomdiagram.api.diagram.component.DisplayComponent;
import com.github.dcysteine.neicustomdiagram.api.diagram.layout.Grid;
import com.github.dcysteine.neicustomdiagram.api.draw.Draw;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.google.auto.value.AutoOneOf;

import codechicken.lib.gui.GuiDraw;

/**
* An element in a tooltip line.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;

import com.github.dcysteine.neicustomdiagram.api.Formatter;
import com.github.dcysteine.neicustomdiagram.api.diagram.layout.Grid;
import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.Tooltip;
import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.TooltipLine;
import com.google.auto.value.AutoValue;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;

/** GUI drawing library. */
public final class Draw {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import org.lwjgl.opengl.GL11;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiRecipe;

import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.Reflection;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;

import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiRecipe;

/** Handles scrolling support, as well as finding the mouse position. */
public final class ScrollManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.dcysteine.neicustomdiagram.api.draw.scroll;

import codechicken.lib.gui.GuiDraw;

import com.github.dcysteine.neicustomdiagram.api.draw.Dimension;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;

import codechicken.lib.gui.GuiDraw;

/** Handles drawing and controlling of a scrollbar. */
class Scrollbar {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

import codechicken.enderstorage.storage.item.EnderItemStorage;

import com.github.dcysteine.neicustomdiagram.api.diagram.CustomDiagramGroup;
import com.github.dcysteine.neicustomdiagram.api.diagram.Diagram;
import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramGenerator;
Expand All @@ -35,6 +33,8 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;

import codechicken.enderstorage.storage.item.EnderItemStorage;

public final class EnderStorageChestOverview implements DiagramGenerator {

public static final ItemComponent ICON = EnderStorageUtil.getItem(EnderStorageUtil.Type.CHEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import net.minecraft.init.Items;

import codechicken.enderstorage.storage.liquid.EnderLiquidStorage;

import com.github.dcysteine.neicustomdiagram.api.diagram.CustomDiagramGroup;
import com.github.dcysteine.neicustomdiagram.api.diagram.Diagram;
import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramGenerator;
Expand All @@ -37,6 +35,8 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;

import codechicken.enderstorage.storage.liquid.EnderLiquidStorage;

public final class EnderStorageTankOverview implements DiagramGenerator {

public static final ItemComponent ICON = EnderStorageUtil.getItem(EnderStorageUtil.Type.TANK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import net.minecraft.init.Items;

import codechicken.lib.gui.GuiDraw;

import com.github.dcysteine.neicustomdiagram.api.diagram.Diagram;
import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramGenerator;
import com.github.dcysteine.neicustomdiagram.api.diagram.DiagramGroup;
Expand All @@ -28,6 +26,8 @@
import com.github.dcysteine.neicustomdiagram.util.ComponentTransformer;
import com.github.dcysteine.neicustomdiagram.util.OreDictUtil;

import codechicken.lib.gui.GuiDraw;

/**
* Generates diagrams showing Forge ore dictionary data for any item.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Table;

import gregtech.api.util.GT_Recipe;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.Lang;
import com.github.dcysteine.neicustomdiagram.util.gregtech5.GregTechOreDictUtil;

import gregtech.api.enums.ItemList;

class LabelHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;

import gregtech.api.util.GT_Recipe;

class RecipeHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void initialize() {
ImmutableSortedMap.Builder<Long, Component> builder = ImmutableSortedMap.naturalOrder();
for (ItemList item : HEATING_COILS) {
ItemStack itemStack = item.get(1);
long heat = GT_Block_Casings5.getCoilHeatFromDamage(itemStack.getItemDamage()).getHeat();
long heat = GT_Block_Casings5.getCoilHeatFromDamage(ItemComponent.getItemDamage(itemStack)).getHeat();

builder.put(heat, ItemComponent.create(itemStack));
}
Expand Down
Loading

0 comments on commit d03e63f

Please sign in to comment.