RFTools

RFTools

74M Downloads

Issue with Bibliocraft Containers and the Storage Scanner

Tanguygab opened this issue · 8 comments

commented

Issue description:
I can't craft Items from the Storage Scanner if they aren't in my inventory when the it scan containers from Bibliocraft.

Steps to reproduce:
Scan a Tool Rack or a Shelf from Bibliocraft

Versions:

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2772
  • Bibliocraft: 2.4.5
  • McJtyLib: 3.0.6
  • RFTools: 7.59

Possibly incompatible mods and versions:
Bibliocraft 2.4.5

Relevant logs, if any:
the log when I click on the button to craft items
bug.txt

commented

https://pastebin.com/Fdq4Aemh
Had this issue just now, saw this issue.
Using Mac Mega Modpack.

commented

I've just realized that the source code of the mod is now available https://github.com/Nuchaz/BiblioCraft-Source
So if you've got a dev or know how to code, you could try to fix it.

Personally, I don't use the mod anymore, well, not using 1.12.2 at all either, so it doesn't really interest me, nice thing that Nuchaz finally released the source code though =)

commented

I've just realized that the source code of the mod is now available https://github.com/Nuchaz/BiblioCraft-Source So if you've got a dev or know how to code, you could try to fix it.

Personally, I don't use the mod anymore, well, not using 1.12.2 at all either, so it doesn't really interest me, nice thing that Nuchaz finally released the source code though =)

It’s tottaly cool
I kinda feel indifferent about 1.12.2. Like I wanna move on but feel like I still miss some favs mods and all
Anyhow, only wanted to throw in my error :) for whoever stumbles upon this and wants to fix it

commented

The important bit of that log:

[18:34:11] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.AbstractMethodError: Method jds/bibliocraft/tileentities/TileEntityShelf.getStackInSlot(I)Lnet/minecraft/item/ItemStack; is abstract
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:252) [chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
Caused by: java.lang.AbstractMethodError: Method jds/bibliocraft/tileentities/TileEntityShelf.getStackInSlot(I)Lnet/minecraft/item/ItemStack; is abstract
	at jds.bibliocraft.tileentities.TileEntityShelf.getStackInSlot(TileEntityShelf.java) ~[TileEntityShelf.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource.getStackInSlot(TileEntityItemSource.java:37) ~[TileEntityItemSource.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource.access$200(TileEntityItemSource.java:16) ~[TileEntityItemSource.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource$1.next(TileEntityItemSource.java:118) ~[TileEntityItemSource$1.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource$1.next(TileEntityItemSource.java:89) ~[TileEntityItemSource$1.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.tryRecipe(StorageCraftingTools.java:58) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.testCraftItems(StorageCraftingTools.java:284) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.blocks.storagemonitor.StorageScannerTileEntity.craft(StorageScannerTileEntity.java:182) ~[StorageScannerTileEntity.class:?]
	at mcjty.rftools.blocks.storage.StorageTerminalTileEntity.craft(StorageTerminalTileEntity.java:84) ~[StorageTerminalTileEntity.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.craftFromGrid(StorageCraftingTools.java:322) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.CommandHandler.lambda$registerCommands$19(CommandHandler.java:150) ~[CommandHandler.class:?]
	at mcjty.lib.McJtyLib.handleCommand(McJtyLib.java:100) ~[McJtyLib.class:?]
	at mcjty.lib.network.PacketSendServerCommand$Handler.handle(PacketSendServerCommand.java:51) ~[PacketSendServerCommand$Handler.class:?]
	at mcjty.lib.network.PacketSendServerCommand$Handler.lambda$onMessage$0(PacketSendServerCommand.java:46) ~[PacketSendServerCommand$Handler.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
	... 5 more
[18:38:47] [Server thread/FATAL] [minecraft/MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.AbstractMethodError: Method jds/bibliocraft/tileentities/TileEntityToolRack.getStackInSlot(I)Lnet/minecraft/item/ItemStack; is abstract
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:252) [chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
Caused by: java.lang.AbstractMethodError: Method jds/bibliocraft/tileentities/TileEntityToolRack.getStackInSlot(I)Lnet/minecraft/item/ItemStack; is abstract
	at jds.bibliocraft.tileentities.TileEntityToolRack.getStackInSlot(TileEntityToolRack.java) ~[TileEntityToolRack.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource.getStackInSlot(TileEntityItemSource.java:37) ~[TileEntityItemSource.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource.access$200(TileEntityItemSource.java:16) ~[TileEntityItemSource.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource$1.next(TileEntityItemSource.java:118) ~[TileEntityItemSource$1.class:?]
	at mcjty.rftools.craftinggrid.TileEntityItemSource$1.next(TileEntityItemSource.java:89) ~[TileEntityItemSource$1.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.tryRecipe(StorageCraftingTools.java:58) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.testCraftItems(StorageCraftingTools.java:284) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.blocks.storagemonitor.StorageScannerTileEntity.craft(StorageScannerTileEntity.java:182) ~[StorageScannerTileEntity.class:?]
	at mcjty.rftools.blocks.storagemonitor.StorageScannerTileEntity.craft(StorageScannerTileEntity.java:165) ~[StorageScannerTileEntity.class:?]
	at mcjty.rftools.craftinggrid.StorageCraftingTools.craftFromGrid(StorageCraftingTools.java:322) ~[StorageCraftingTools.class:?]
	at mcjty.rftools.CommandHandler.lambda$registerCommands$19(CommandHandler.java:150) ~[CommandHandler.class:?]
	at mcjty.lib.McJtyLib.handleCommand(McJtyLib.java:100) ~[McJtyLib.class:?]
	at mcjty.lib.network.PacketSendServerCommand$Handler.handle(PacketSendServerCommand.java:51) ~[PacketSendServerCommand$Handler.class:?]
	at mcjty.lib.network.PacketSendServerCommand$Handler.lambda$onMessage$0(PacketSendServerCommand.java:46) ~[PacketSendServerCommand$Handler.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_191]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_191]
	at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
	... 5 more

I'll look into this. It looks like it might be Bibliocraft's fault, though. Can you open a bug report in their tracker too?

commented

Ok

commented

@josephcsible

I agree that it's usually bad practice. But isn't it acceptable when you don't have control over the code that's causing the problem? The alternative is buggy behavior in big modpacks like Enigmatica 2. And it's not obvious that Bibliocraft is the culprit, so it makes RFTools look bad.

And yes, Tanguygab reported the bug there, as you requested. In fact, this bug has been reported there about nine times, and not once did they ever respond.

commented

@josephcsible @Tanguygab

This seems to still be a problem (Bibliocraft 2.4.5 + RFTools 7.72).

It does look like Bibliocraft fails to override the abstract getStackInSlot method. So yes, they seem to be at fault. But perhaps RFTools should handle the exception more gracefully?

I suggest that you simply catch the exception in your own getStackInSlot method and log it as a warning, instead of allowing it to propagate further up the call stack. Something like this:

private static ItemStack getStackInSlot(Object inv, int slot) {
	try {
		if (inv instanceof IItemHandler) {
		    return ((IItemHandler) inv).getStackInSlot(slot);
		} else if (inv instanceof IInventory) {
		    return ((IInventory) inv).getStackInSlot(slot);
		}
	} catch (AbstractMethodError e) {
		Logger.warn(e.getMessage());
	}
	return ItemStack.EMPTY;
}

That way, rather than misbehave in the mere presence of a bookcase, the crafting grid would just fail to detect any items stored in one, but otherwise function properly. (Or perhaps someone more familiar with these APIs could even write a backup method for getting item stacks from older mods?)

I'm afraid I can't write a proper PR. I've never worked on Minecraft mods, so I'm not set up to test this properly. But it should be just this simple, shouldn't it?

commented

You want us to catch an Error (not even an Exception) for the purpose of working around a bug in another mod? That's an absolutely terrible coding practice, and no, there's not a way of working around it to do the right thing. Did anyone ever open a report about this in Bibliocraft's tracker? The only right way to fix this is for them to do it.