mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 11:05:07 +00:00
disable pop animation on bookmark load
This commit is contained in:
1 parent
b8b2b1f4f5
commit
67e74498bf
4 files changed
+29
-28
No files matched your search
@@ -14,13 +14,15 @@ public class AnimatedItemStack {
|
||||
private int lastPosX = -1;
|
||||
private int lastPosY = -1;
|
||||
private float currentScale = 0;
|
||||
private boolean doAnim;
|
||||
private final boolean doMoveAnim;
|
||||
private final boolean doPopAnim;
|
||||
|
||||
public ItemStack itemStack;
|
||||
|
||||
public AnimatedItemStack(ItemStack itemStack, boolean doAnim) {
|
||||
public AnimatedItemStack(ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
|
||||
this.itemStack = itemStack;
|
||||
this.doAnim = doAnim;
|
||||
this.doMoveAnim = doMoveAnim;
|
||||
this.doPopAnim = doPopAnim;
|
||||
}
|
||||
|
||||
public void drawItem(int x, int y) {
|
||||
@@ -28,16 +30,14 @@ public class AnimatedItemStack {
|
||||
}
|
||||
|
||||
public void drawItem(int x, int y, boolean smallAmount, String stackSize) {
|
||||
if (doAnim) {
|
||||
if (currentScale < 1) {
|
||||
drawPoppingItem(x, y, smallAmount, stackSize);
|
||||
return;
|
||||
} else if (lastPosX != x || lastPosY != y) {
|
||||
drawMovingItem(x, y, smallAmount, stackSize);
|
||||
return;
|
||||
}
|
||||
if (doPopAnim && currentScale < 1) {
|
||||
drawPoppingItem(x, y, smallAmount, stackSize);
|
||||
} else if (doMoveAnim && lastPosX != x || lastPosY != y) {
|
||||
drawMovingItem(x, y, smallAmount, stackSize);
|
||||
}
|
||||
else{
|
||||
GuiContainerManager.drawItem(x, y, itemStack, smallAmount, stackSize);
|
||||
}
|
||||
GuiContainerManager.drawItem(x, y, itemStack, smallAmount, stackSize);
|
||||
}
|
||||
|
||||
private void drawPoppingItem(int x, int y, boolean smallAmount, String stackSize) {
|
||||
|
||||
@@ -222,24 +222,24 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return metadata.get(idx);
|
||||
}
|
||||
|
||||
public void addItem(ItemStack stackA, BookmarkStackMeta meta) {
|
||||
addRealItem(stackA, true);
|
||||
public void addItem(ItemStack stackA, BookmarkStackMeta meta, boolean doPopAnim) {
|
||||
addRealItem(stackA, true, doPopAnim);
|
||||
metadata.add(meta);
|
||||
onGridChanged();
|
||||
}
|
||||
|
||||
public void addItem(ItemStack stackA, BookmarkStackMeta meta, int index) {
|
||||
if (index == -1) {
|
||||
addItem(stackA, meta);
|
||||
addItem(stackA, meta, true);
|
||||
return;
|
||||
}
|
||||
addRealItem(index, stackA, true);
|
||||
addRealItem(index, stackA, true, true);
|
||||
metadata.add(index, meta);
|
||||
onGridChanged();
|
||||
}
|
||||
|
||||
public void replaceItem(int idx, ItemStack stack) {
|
||||
setRealItem(idx, stack, true);
|
||||
setRealItem(idx, stack, true, true);
|
||||
onGridChanged();
|
||||
}
|
||||
|
||||
@@ -769,7 +769,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
.get("ingredient")
|
||||
.getAsBoolean()
|
||||
: false,
|
||||
itemStackNBT.hasKey("gtFluidName")));
|
||||
itemStackNBT.hasKey("gtFluidName")),
|
||||
false);
|
||||
} else {
|
||||
NEIClientConfig.logger.warn(
|
||||
"Failed to load bookmarked ItemStack from json string, the item no longer exists:\n{}",
|
||||
@@ -923,7 +924,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final BookmarkStackMeta meta = sortedGrid.getMetadata(sortedStackIndex);
|
||||
|
||||
sortedGrid.removeItem(sortedStackIndex);
|
||||
hoverGrid.addItem(stack, meta);
|
||||
hoverGrid.addItem(stack, meta, true);
|
||||
|
||||
sortedNamespaceIndex = activeNamespaceIndex;
|
||||
sortedStackIndex = hoverGrid.indexOf(stack, meta.recipeId);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ItemPanel extends PanelWidget {
|
||||
|
||||
if (newItems != null) {
|
||||
realItems.clear();
|
||||
addRealItems(newItems, false);
|
||||
addRealItems(newItems, false, false);
|
||||
newItems = null;
|
||||
onGridChanged();
|
||||
}
|
||||
|
||||
@@ -58,20 +58,20 @@ public class ItemsGrid {
|
||||
return realItems.get(idx).itemStack;
|
||||
}
|
||||
|
||||
protected void addRealItems(Collection<ItemStack> itemStack, boolean doAnim) {
|
||||
itemStack.forEach(e -> addRealItem(e, doAnim));
|
||||
protected void addRealItems(Collection<ItemStack> itemStack, boolean doMoveAnim, boolean doPopAnim) {
|
||||
itemStack.forEach(e -> addRealItem(e, doMoveAnim, doPopAnim));
|
||||
}
|
||||
|
||||
protected void addRealItem(ItemStack itemStack, boolean doAnim) {
|
||||
realItems.add(new AnimatedItemStack(itemStack, doAnim));
|
||||
protected void addRealItem(ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
|
||||
realItems.add(new AnimatedItemStack(itemStack, doMoveAnim, doPopAnim));
|
||||
}
|
||||
|
||||
protected void addRealItem(int index, ItemStack itemStack, boolean doAnim) {
|
||||
realItems.add(index, new AnimatedItemStack(itemStack, doAnim));
|
||||
protected void addRealItem(int index, ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
|
||||
realItems.add(index, new AnimatedItemStack(itemStack, doMoveAnim, doPopAnim));
|
||||
}
|
||||
|
||||
protected void setRealItem(int index, ItemStack itemStack, boolean doAnim) {
|
||||
realItems.set(index, new AnimatedItemStack(itemStack, doAnim));
|
||||
protected void setRealItem(int index, ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
|
||||
realItems.set(index, new AnimatedItemStack(itemStack, doMoveAnim, doPopAnim));
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
||||
Reference in new issue
Block a user