Compare commits

..
Author SHA1 Message Date
Kiwi 66fc2270dd Update zh_CN.lang (#301) 2022-09-24 12:25:39 +02:00
miozune 138d25dbfd Fix incorrect color applied to GuiRecipeCatalyst (#300) 2022-09-19 05:58:46 +02:00
Raven Szewczyk d9191750a7 Update CodeChickenLib (#299) 2022-09-18 23:15:42 +02:00
くぁーりぃ 6d9ec0c0da Backport some of REI bookmark features (#296)
* add placeholder bookmark drop

* add item panel to bookmark panel injection support

* fix outofboundsexception

* fix drag'n drop voids bookmark

* add itemstack moving animation

* implement pop animation

* fix crashes

* disable ItemPanel Animation

* disable pop animation on bookmark load

* spotlessapply

* disable move animation on gui scale

* add config option
2022-09-18 12:08:16 +02:00
10 changed files with 78 additions and 33 deletions

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
// Add your dependencies here
dependencies {
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev')
compile('com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev')
compile('com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev')
compile('com.github.GTNewHorizons:CodeChickenCore:1.1.6:dev')
shadowImplementation('org.apache.commons:commons-csv:1.8')
}
@@ -14,27 +14,36 @@ public class AnimatedItemStack {
private int lastPosX = -1;
private int lastPosY = -1;
private float currentScale = 0;
private boolean doPopAnim;
private final boolean doMoveAnim;
private final boolean doPopAnim;
public ItemStack itemStack;
public AnimatedItemStack(ItemStack itemStack, boolean doPopAnim) {
public AnimatedItemStack(ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
this.itemStack = itemStack;
this.doMoveAnim = doMoveAnim;
this.doPopAnim = doPopAnim;
}
public void drawItem(int x, int y) {
drawItem(x, y, false, null);
drawItem(x, y, false, null, false);
}
public void drawItem(int x, int y, boolean smallAmount, String stackSize) {
if (doPopAnim && currentScale < 1) {
drawPoppingItem(x, y, smallAmount, stackSize);
} else if (lastPosX != x || lastPosY != y) {
drawMovingItem(x, y, smallAmount, stackSize);
} else {
GuiContainerManager.drawItem(x, y, itemStack, smallAmount, stackSize);
public void drawItem(int x, int y, boolean smallAmount, String stackSize, boolean blockMoveAnimOnce) {
if (NEIClientConfig.areBookmarksAnimated()) {
if (doPopAnim && currentScale < 1) {
drawPoppingItem(x, y, smallAmount, stackSize);
return;
}
if (doMoveAnim && (lastPosX != x || lastPosY != y) && !blockMoveAnimOnce) {
drawMovingItem(x, y, smallAmount, stackSize);
return;
}
}
currentScale = 1;
lastPosX = x;
lastPosY = y;
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();
}
@@ -337,7 +337,8 @@ public class BookmarkPanel extends PanelWidget {
rect.x + 1,
rect.y + 1,
true,
meta.factor < 0 || meta.fluidDisplay ? "" : String.valueOf(stack.stackSize));
meta.factor < 0 || meta.fluidDisplay ? "" : String.valueOf(stack.stackSize),
draggedStack == null);
if (meta.recipeId != null && !meta.ingredient && NEIClientConfig.showRecipeMarker()) {
drawRecipeMarker(rect.x, rect.y, GuiContainerManager.getFontRenderer(stack));
@@ -769,7 +770,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 +925,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);
+1 -1
View File
@@ -58,7 +58,7 @@ public class ItemPanel extends PanelWidget {
if (newItems != null) {
realItems.clear();
addRealItems(newItems, false);
addRealItems(newItems, false, false);
newItems = null;
onGridChanged();
}
+8 -8
View File
@@ -58,20 +58,20 @@ public class ItemsGrid {
return realItems.get(idx).itemStack;
}
protected void addRealItems(Collection<ItemStack> itemStack, boolean doPopAnim) {
itemStack.forEach(e -> addRealItem(e, doPopAnim));
protected void addRealItems(Collection<ItemStack> itemStack, boolean doMoveAnim, boolean doPopAnim) {
itemStack.forEach(e -> addRealItem(e, doMoveAnim, doPopAnim));
}
protected void addRealItem(ItemStack itemStack, boolean doPopAnim) {
realItems.add(new AnimatedItemStack(itemStack, doPopAnim));
protected void addRealItem(ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
realItems.add(new AnimatedItemStack(itemStack, doMoveAnim, doPopAnim));
}
protected void addRealItem(int index, ItemStack itemStack, boolean doPopAnim) {
realItems.add(index, new AnimatedItemStack(itemStack, doPopAnim));
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 doPopAnim) {
realItems.set(index, new AnimatedItemStack(itemStack, doPopAnim));
protected void setRealItem(int index, ItemStack itemStack, boolean doMoveAnim, boolean doPopAnim) {
realItems.set(index, new AnimatedItemStack(itemStack, doMoveAnim, doPopAnim));
}
public int size() {
@@ -237,6 +237,10 @@ public class NEIClientConfig {
.setComment("Use NBT in Bookmarks")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.useNBTInBookmarks", true));
tag.getTag("inventory.bookmarksAnimationEnabled")
.setComment("REI Style Animation in Bookmarks")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.bookmarksAnimationEnabled", true));
tag.getTag("inventory.showRecipeMarker")
.setComment("Show Recipe Marker")
.getBooleanValue(false);
@@ -504,6 +508,10 @@ public class NEIClientConfig {
return getBooleanSetting("inventory.useNBTInBookmarks");
}
public static boolean areBookmarksAnimated() {
return getBooleanSetting("inventory.bookmarksAnimationEnabled");
}
public static boolean showRecipeMarker() {
return getBooleanSetting("inventory.showRecipeMarker");
}
@@ -3,6 +3,7 @@ package codechicken.nei.drawable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.opengl.GL11;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
@@ -70,6 +71,7 @@ public class GuiElementDuex {
*/
public int draw(int xPos, int yPos) {
// drawModalRectWithCustomSizedTexture
GL11.glColor4f(1, 1, 1, 1);
GuiScreen.func_146110_a(xPos, yPos, x, y, w, h, texW, texH);
return w;
}
@@ -146,6 +146,9 @@ nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.false=Disabled
nei.options.inventory.useNBTInBookmarks=Use NBT in Bookmarks
nei.options.inventory.useNBTInBookmarks.true=Yes
nei.options.inventory.useNBTInBookmarks.false=No
nei.options.inventory.bookmarksAnimationEnabled=REI Style Animation in Bookmarks
nei.options.inventory.bookmarksAnimationEnabled.true=Yes
nei.options.inventory.bookmarksAnimationEnabled.false=No
nei.options.inventory.showRecipeMarker=Show Recipe Marker
nei.options.inventory.showRecipeMarker.true=Yes
nei.options.inventory.showRecipeMarker.false=No
+22 -1
View File
@@ -8,6 +8,10 @@ nei.key.ctrl.mac=CMD
nei.bookmark.toggle=书签
nei.bookmark.toggle.tip=显示/隐藏书签页
nei.bookmark.viewmode.toggle.tip=切换书签栏浏览模式
nei.itempanel.quantity.default=一组
nei.itempanel.loading=物品列表加载中...
nei.enchant=附魔
nei.enchant.level=等级
@@ -66,7 +70,8 @@ nei.chat.rain.on=开启雨雪
nei.chat.rain.off=关闭雨雪
nei.chat.time=白天 %d. %d:00
nei.chat.give.noitem=没有此物品
nei.chat.recipe.error=加载合成表过程中出现错误.请查看log文件获取详细信息.
nei.chat.recipe.error=加载合成表过程中出现错误.请查看日志了解详情.
nei.chat.render.error=渲染物品过程中出现错误.请查看日志了解详情.
nei.options=NEI选项
nei.options.back=后退
@@ -94,8 +99,15 @@ nei.options.keys.gui.next_machine=下一机器
nei.options.keys.gui.prev_machine=上一机器
nei.options.keys.gui.search=跳转到搜索框
nei.options.keys.gui.bookmark=添加书签
nei.options.keys.gui.bookmark_recipe=添加带有合成表的书签
nei.options.keys.gui.bookmark_count=添加带有数量的书签
nei.options.keys.gui.bookmark_recipe_count=添加带有合成表和数量的书签
nei.options.keys.gui.hide_bookmarks=显示/隐藏书签页
nei.options.keys.gui.overlay=提取合成表至合成栏/工作台
nei.options.keys.gui.overlay_hide=隐藏覆盖合成表
nei.options.keys.gui.overlay_use=使用覆盖合成表
nei.options.keys.gui.getprevioussearch=上一个搜索
nei.options.keys.gui.getnextsearch=下一个搜索
nei.options.keys.world=世界
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
nei.options.keys.world.moboverlay=刷怪区域显示
@@ -134,12 +146,21 @@ nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.false=禁用
nei.options.inventory.useNBTInBookmarks=在书签中启用NBT
nei.options.inventory.useNBTInBookmarks.true=是
nei.options.inventory.useNBTInBookmarks.false=否
nei.options.inventory.bookmarksAnimationEnabled=REI风格书签动画
nei.options.inventory.bookmarksAnimationEnabled.true=是
nei.options.inventory.bookmarksAnimationEnabled.false=否
nei.options.inventory.showRecipeMarker=在书签栏显示合成产物标记
nei.options.inventory.showRecipeMarker.true=是
nei.options.inventory.showRecipeMarker.false=否
nei.options.inventory.showItemQuantityWidget=显示物品数量栏(右下角)
nei.options.inventory.showItemQuantityWidget.true=是
nei.options.inventory.showItemQuantityWidget.false=否
nei.options.inventory.creative_tab_style=创造模式/JEI标签页
nei.options.inventory.creative_tab_style.true=创造模式
nei.options.inventory.creative_tab_style.false=JEI
nei.options.inventory.ignore_potion_overlap=忽略书签与药水效果重叠
nei.options.inventory.ignore_potion_overlap.true=忽略
nei.options.inventory.ignore_potion_overlap.false=规避
nei.options.inventory.widgetsenabled.true=激活NEI
nei.options.inventory.widgetsenabled.false=禁用NEI
nei.options.inventory.cheatmode.0=合成模式
+3 -3
View File
@@ -1,7 +1,7 @@
{
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.3/",
"file": "CodeChickenLib-1.7.10-1.1.5.3.jar",
"dev": "CodeChickenLib-1.7.10-1.1.5.3-dev.jar",
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
"dev": "CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
"class": "codechicken.lib.asm.ASMHelper",
"coreLib": true
}