mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a105a60a1a | ||
|
|
3a4a6734dc | ||
|
|
11f9194de9 |
No files matched your search
@@ -160,7 +160,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
// 1 - partitial hidden
|
||||
// 2 - enabled
|
||||
public int state = 2;
|
||||
public int calculatedWidth;
|
||||
public volatile int calculatedWidth = -1;
|
||||
public final List<ItemStack> items;
|
||||
public final List<SubsetTag> children = new ArrayList<>();
|
||||
protected final SubsetSlot slot = new SubsetSlot();
|
||||
@@ -206,7 +206,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
this.state = 2;
|
||||
this.items.clear();
|
||||
this.children.clear();
|
||||
this.calculatedWidth = 0;
|
||||
this.calculatedWidth = -1;
|
||||
}
|
||||
|
||||
public void updateVisiblity(int mx, int my) {
|
||||
@@ -261,6 +261,10 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
}
|
||||
|
||||
public void resize(Rectangle4i screen, Rectangle4i parent, boolean dropRight) {
|
||||
if (calculatedWidth < 0) {
|
||||
calculatedWidth = this.children.stream().mapToInt(SubsetTag::nameWidth).max().orElse(0);
|
||||
}
|
||||
|
||||
int height = Math.min(slot.contentHeight(), screen.h);
|
||||
int width = Math.max(calculatedWidth + 2, this.items.isEmpty() ? 0 : 16 + MARGIN * 2);
|
||||
int scrollbarWidth = slot.scrollbarDim().width;
|
||||
@@ -686,12 +690,12 @@ public class SubsetWidget extends Button implements ItemFilterProvider {
|
||||
|
||||
for (SubsetTag tag : list) {
|
||||
tag.children.sort(Comparator.comparing(SubsetTag::displayName));
|
||||
tag.calculatedWidth = tag.children.stream().mapToInt(SubsetTag::nameWidth).max().orElse(0);
|
||||
tag.calculatedWidth = -1;
|
||||
}
|
||||
|
||||
root.children.removeIf(child -> child.children.isEmpty() && child.items.isEmpty());
|
||||
root.children.sort(Comparator.comparing(SubsetTag::displayName));
|
||||
root.calculatedWidth = root.children.stream().mapToInt(SubsetTag::nameWidth).max().orElse(0);
|
||||
root.calculatedWidth = -1;
|
||||
|
||||
calculateVisibility(root);
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class BookmarkItem {
|
||||
private static synchronized String getItemGUID(ItemStack stack) {
|
||||
final FluidStack fluidStack = StackInfo.getFluid(stack);
|
||||
|
||||
if (fluidStack != null) {
|
||||
if (fluidStack != null && (fluidStack.amount > 0 || !StackInfo.isFluidContainer(stack))) {
|
||||
return fluidStack.getFluid().getName() + ":" + fluidStack.tag;
|
||||
} else {
|
||||
|
||||
|
||||
@@ -131,7 +131,14 @@ public class StackInfo {
|
||||
}
|
||||
|
||||
if (isFluidDisplayItem(stackA)) {
|
||||
return isFluidDisplayItem(stackB) && getFluid(stackA).isFluidEqual(getFluid(stackB));
|
||||
|
||||
if (isFluidDisplayItem(stackB)) {
|
||||
final FluidStack fluidA = getFluid(stackA);
|
||||
final FluidStack fluidB = getFluid(stackB);
|
||||
return fluidA != null && fluidA.isFluidEqual(fluidB);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stackA.getItem() != stackB.getItem()) {
|
||||
|
||||
@@ -21,6 +21,7 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
protected static Method getFluidFromDisplayStack = null;
|
||||
protected static Class<?> gtMetaGeneratedTool = null;
|
||||
protected static Field playSound = null;
|
||||
private static boolean loggedNoNbtDisplay = false;
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -88,6 +89,12 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
return (FluidStack) obj;
|
||||
}
|
||||
|
||||
final Fluid fluid = FluidRegistry.getFluid(stack.getItemDamage());
|
||||
|
||||
if (fluid != null) {
|
||||
return new FluidStack(fluid, 0);
|
||||
}
|
||||
|
||||
} else if (item == GameRegistry.findItem("ae2fc", "fluid_packet")) {
|
||||
NBTTagCompound nbtTag = stack.getTagCompound();
|
||||
|
||||
|
||||
Reference in new issue
Block a user