mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-23 21:50:02 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e3846bea | ||
|
|
d73df3aedc | ||
|
|
f84b24724a | ||
|
|
1bb550305c |
No files matched your search
@@ -1073,6 +1073,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
}
|
||||
|
||||
this.grid.shiftGroupAmount(groupId, multiplier * shift);
|
||||
clearTooltips();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1226,6 +1227,8 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
if (helmStackIndex != -1) {
|
||||
FastTransferManager.clickSlot(guiContainer, helmStackIndex, 0, 0);
|
||||
}
|
||||
|
||||
clearTooltips();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -265,8 +265,8 @@ public final class MobOverlayScan {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link #moveTo} reads the chunk, the height map and the biome of a column, and {@link #scan} reads the column's
|
||||
* blocks.
|
||||
* {@link #moveTo} reads a column's chunk, biome and highest non-air block in the box, and {@link #scan} reads the
|
||||
* column's blocks.
|
||||
*/
|
||||
private final class Column {
|
||||
|
||||
@@ -285,15 +285,14 @@ public final class MobOverlayScan {
|
||||
canBiomeSpawn = !biome.getSpawnableList(EnumCreatureType.monster).isEmpty()
|
||||
&& biome.getSpawningChance() > 0;
|
||||
chunk = scannedWorld.getChunkFromBlockCoords(x, z);
|
||||
// on the client, `Chunk.generateHeightMap()` never tests the top layer of the highest non-empty section.
|
||||
// `getHeightValue()` can then be below a block on that layer, so test that layer here
|
||||
final int topLayerY = chunk.getTopFilledSegment() + 15;
|
||||
final boolean isTopLayerFilled = !chunk.isEmpty() && chunk.func_150808_b(x & 15, topLayerY, z & 15) != 0;
|
||||
final int heightValue = isTopLayerFilled ? topLayerY + 1 : scannedWorld.getHeightValue(x, z);
|
||||
// `getHeightValue()` is the height above the highest block with a light opacity above 0. A snow layer and a
|
||||
// hopper have a light opacity of 0, and a mob can spawn on top of a full snow block or a hopper, so scan
|
||||
// one block above the height value
|
||||
topY = Math.min(scannedWorld.getHeight() - 1, heightValue + 1);
|
||||
// `getHeightValue()` is the height above the highest block with a light opacity above 0. A block with a
|
||||
// light opacity of 0 can be higher: Tinkers' Construct slime grass, a hopper or a snow layer. A mob can
|
||||
// spawn on top of slime grass, a hopper or a full snow block. Search the blocks for the highest non-air
|
||||
// block
|
||||
final int SECTION_HEIGHT = 16;
|
||||
int y = Math.min(minY + height - 1, chunk.getTopFilledSegment() + SECTION_HEIGHT - 1);
|
||||
while (y >= minY && chunk.getBlock(x & 15, y, z & 15).isAir(chunk.worldObj, x, y, z)) y--;
|
||||
topY = y + 1;
|
||||
}
|
||||
|
||||
/** @return whether a spawn mode or the top of a flat block changed */
|
||||
|
||||
@@ -123,6 +123,11 @@ public class AutoCraftingManager {
|
||||
AutoCraftingManager.math = math;
|
||||
|
||||
if (AutoCraftingManager.math != null) {
|
||||
|
||||
if (NEIClientUtils.getGuiContainer() instanceof GuiRecipe<?>gui && gui.firstGui != null) {
|
||||
gui.mc.displayGuiScreen(gui.firstGui);
|
||||
}
|
||||
|
||||
ItemPanels.bookmarkPanel.clearTooltips();
|
||||
math.createMasterRoot();
|
||||
task.restart();
|
||||
|
||||
@@ -111,6 +111,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
private Rectangle pageArea = new Rectangle();
|
||||
|
||||
private int lastPage = -1;
|
||||
private int catalystsVersion = -1;
|
||||
private final GuiRecipeTabs recipeTabs;
|
||||
private final GuiRecipeCatalyst recipeCatalyst;
|
||||
private SearchRecipeHandler<H> handler;
|
||||
@@ -549,7 +550,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
}
|
||||
|
||||
this.recipeCatalyst.setCatalysts(RecipeCatalysts.getRecipeCatalysts(this.handler.original));
|
||||
if (this.catalystsVersion != RecipeCatalysts.getVersion()) {
|
||||
this.catalystsVersion = RecipeCatalysts.getVersion();
|
||||
this.recipeCatalyst.setCatalysts(RecipeCatalysts.getRecipeCatalysts(this.handler.original));
|
||||
}
|
||||
|
||||
this.container.update();
|
||||
}
|
||||
|
||||
@@ -580,6 +585,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
this.recipetype = (this.currenthandlers.size() + idx) % this.currenthandlers.size();
|
||||
this.handler = new SearchRecipeHandler<>(this.currenthandlers.get(this.recipetype));
|
||||
this.handlerInfo = GuiRecipeTab.getHandlerInfo(this.handler.original);
|
||||
this.catalystsVersion = RecipeCatalysts.getVersion();
|
||||
this.recipeCatalyst.setCatalysts(RecipeCatalysts.getRecipeCatalysts(this.handler.original));
|
||||
updateContainerSize();
|
||||
this.handlerPages = new RecipePageManager(this.handler, this.handlerInfo, this.container);
|
||||
this.prevpage.enabled = this.nextpage.enabled = this.handlerPages.getNumPages() > 1;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -71,21 +72,22 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
.setOverflowType(ScrollBar.OverflowType.AUTO).setTrackPadding(0, BORDER_PADDING, -13, BORDER_PADDING)
|
||||
.setScrollPlace(ScrollBar.ScrollPlace.START);
|
||||
|
||||
private PositionedStack[] items = new PositionedStack[0];
|
||||
private List<PositionedStack> items = Collections.emptyList();
|
||||
private boolean showWidget = false;
|
||||
private int availableHeight = 0;
|
||||
private int style = -1;
|
||||
|
||||
public GuiRecipeCatalyst() {
|
||||
setPaddingBlock(BORDER_PADDING + 1, BORDER_PADDING + 1);
|
||||
}
|
||||
|
||||
public void setCatalysts(List<PositionedStack> items) {
|
||||
this.items = items.toArray(new PositionedStack[0]);
|
||||
this.items = items;
|
||||
createWidgets();
|
||||
}
|
||||
|
||||
public void setAvailableHeight(int height) {
|
||||
if (this.availableHeight != height) {
|
||||
if (this.availableHeight != height || this.style != NEIClientConfig.getJEIStyleRecipeCatalysts()) {
|
||||
this.availableHeight = height;
|
||||
createWidgets();
|
||||
}
|
||||
@@ -102,14 +104,14 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
public int getColumnCount() {
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 1) {
|
||||
final int maxItemsPerColumn = Math.max(0, this.availableHeight - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
|
||||
return maxItemsPerColumn > 0 ? NEIServerUtils.divideCeil(this.items.length, maxItemsPerColumn) : 0;
|
||||
return maxItemsPerColumn > 0 ? NEIServerUtils.divideCeil(this.items.size(), maxItemsPerColumn) : 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
final int columnCount = getColumnCount();
|
||||
return columnCount > 0 ? NEIServerUtils.divideCeil(this.items.length, columnCount) : 0;
|
||||
return columnCount > 0 ? NEIServerUtils.divideCeil(this.items.size(), columnCount) : 0;
|
||||
}
|
||||
|
||||
protected void createWidgets() {
|
||||
@@ -119,10 +121,11 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
setVerticalScroll(null);
|
||||
setPaddingInline(BORDER_PADDING + 1, BORDER_PADDING - 3);
|
||||
|
||||
this.style = NEIClientConfig.getJEIStyleRecipeCatalysts();
|
||||
this.h = rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd;
|
||||
this.w = columns * SLOT_SIZE + this.paddingInlineStart + this.paddingInlineEnd;
|
||||
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 2
|
||||
if (this.style == 2
|
||||
&& rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd > this.availableHeight) {
|
||||
this.h = Math.min(this.h, this.availableHeight);
|
||||
this.w += VERTICAL_SCROLLBAR.getTrackWidth();
|
||||
@@ -134,6 +137,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
this.showWidget = rows * columns > 0;
|
||||
|
||||
if (rows == 0 || columns == 0) {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ public class RecipeCatalysts {
|
||||
public static final Map<String, List<ItemStack>> catalystsRemoverFromIMC = new HashMap<>();
|
||||
private static final Map<String, List<PositionedStack>> recipeCatalystMap = new HashMap<>();
|
||||
private static final List<String> forceClassNameList = new ArrayList<>();
|
||||
private static int version = 0;
|
||||
|
||||
public static int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void addRecipeCatalyst(String handlerID, CatalystInfo catalystInfo) {
|
||||
if (handlerID == null || handlerID.isEmpty() || catalystInfo.getStack() == null) return;
|
||||
@@ -69,6 +74,7 @@ public class RecipeCatalysts {
|
||||
if (handlerID == null || handlerID.isEmpty()) return;
|
||||
catalystsAdderFromAPI.put(handlerID, catalystInfoList);
|
||||
recipeCatalystMap.put(handlerID, convertToPositionedStackList(catalystInfoList));
|
||||
version++;
|
||||
}
|
||||
|
||||
public static List<PositionedStack> getRecipeCatalysts(IRecipeHandler handler) {
|
||||
@@ -176,6 +182,7 @@ public class RecipeCatalysts {
|
||||
recipeCatalystMap.put(entry.getKey(), convertToPositionedStackList(entry.getValue()));
|
||||
}
|
||||
|
||||
version++;
|
||||
}
|
||||
|
||||
private static void resolveAdderQueue(Map<String, CatalystInfoList> recipeCatalystMap) {
|
||||
|
||||
@@ -149,6 +149,7 @@ public class RecipeHandlerRef {
|
||||
if (overlayHandler != null && overlayHandler.canCraft(firstGui, this.handler, this.recipeIndex)) {
|
||||
|
||||
if (!firstGui.equals(firstGui.mc.currentScreen)) {
|
||||
if (!firstGui.mc.func_152345_ab()) return false;
|
||||
firstGui.mc.displayGuiScreen(firstGui);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user