Fix Lexica Botania handling of GT tools (#27)

* fix tool handling in lexicon, improve oredict display

* update buildscript

* fix missed wrapper update, manually fix formatting (since no spotless)
This commit is contained in:
Dane Strandboge authored and GitHub committed 2023-05-01 22:38:21 +02:00
1 parent 2f47326c7f
commit 5ba45cb86d
7 files changed
+94 -144

No files matched your search

@@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
//From OpenBlocksLib: https://github.com/OpenMods/OpenModsLib
public class InventoryHelper {
@@ -205,6 +206,21 @@ public class InventoryHelper {
return slots;
}
public static ItemStack cycleItemStackForDisplay(Object input) {
if (input instanceof ItemStack) return (ItemStack) input;
List<ItemStack> items = null;
if (input instanceof List) {
items = (List<ItemStack>) input;
} else if (input instanceof String) {
items = OreDictionary.getOres((String) input);
}
if (items != null && items.size() > 0) {
int index = (int) (System.currentTimeMillis() / 1000L % items.size());
return items.get(index);
}
return null;
}
public static class GenericInventory implements IInventory {
protected String inventoryTitle;
@@ -36,6 +36,7 @@ import vazkii.botania.client.lib.LibResources;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import vazkii.botania.common.core.helper.InventoryHelper;
public class PageCraftingRecipe extends PageRecipe {
@@ -140,7 +141,7 @@ public class PageCraftingRecipe extends PageRecipe {
for(int x = 0; x < width; x++) {
Object input = shaped.getInput()[y * width + x];
if(input != null)
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
renderItemAtGridPos(gui, 1 + x, 1 + y, InventoryHelper.cycleItemStackForDisplay(input), true);
}
oreDictRecipe = true;
@@ -173,7 +174,7 @@ public class PageCraftingRecipe extends PageRecipe {
Object input = shapeless.getInput().get(index);
if(input != null)
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
renderItemAtGridPos(gui, 1 + x, 1 + y, InventoryHelper.cycleItemStackForDisplay(input), true);
}
}
@@ -38,7 +38,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PageRecipe extends LexiconPage {
int relativeMouseX, relativeMouseY;
ItemStack tooltipStack, tooltipContainerStack;
ItemStack tooltipStack;
boolean tooltipEntry;
static boolean mouseDownLastTick = false;
@@ -80,14 +80,10 @@ public class PageRecipe extends LexiconPage {
if(tooltipEntry) {
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
tooltipY += 18;
}
if(tooltipContainerStack != null)
vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.AQUA + StatCollector.translateToLocal("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName()));
}
tooltipStack = tooltipContainerStack = null;
tooltipStack = null;
tooltipEntry = false;
GL11.glDisable(GL11.GL_BLEND);
mouseDownLastTick = Mouse.isButtonDown(0);
@@ -170,12 +166,6 @@ public class PageRecipe extends LexiconPage {
Minecraft.getMinecraft().displayGuiScreen(newGui);
}
} else tooltipEntry = false;
if(accountForContainer) {
ItemStack containerStack = stack.getItem().getContainerItem(stack);
if(containerStack != null && containerStack.getItem() != null)
tooltipContainerStack = containerStack;
}
}
GL11.glDisable(GL11.GL_LIGHTING);