Tech Reborn

Tech Reborn

30M Downloads

Multiple bugs with 1.11

Ourten opened this issue ยท 3 comments

commented

I hope you don't mind the amount of bugs in a single issue.

Using the 1.11 version of TechReborn (1.11-2.0.5.63) i've noticed quite a few bugs :

  • Solar Panels, Windmills, Watermills and LESU Block have no textures in world.

  • The manual does not have any texture. The assets files seems to have vanished from the repo between 1.10 and 1.11.

  • Blast furnace does not show his "Incomplete multiblock" notification correctly, it is shown every time (even upon completion) if you return to the GUI after seeing JEI recipes but otherwise it isn't shown at all.

  • Industrial Grinder and Blast Furnace does not use the same form of notifications for a missing multiblock (i don't know if it's work in progress, it just seemed to be a little inconsistancy).

  • The iridium. The recipe produce Iridium Ore from Iridium Ore in the Industrial Grinder, there don't seem to be another way to obtain it beside the uu-matter. And it's also a little duplication bug.

  • The Industrial Grinder does not absorb fluid inserted into it's inventory by hand because of a chain of broken code. This issue is heavily related to RebornCore, I don't know if i need to put also an issue there for convenience :
    The method FluidUtils.drainContainers does not work in 1.11 because of two major issues, first the ItemStack check against null when it should be checked against ItemStack.EMPTY. Secondly the method getFluidStackInContainer redirect to the forge method but does not return correctly the FluidStack when the container is a cell.
    I've actually fixed in local by modifying the method like that (I can make a PR to RebornCore if that does not bother you) :

public static boolean drainContainers(final IFluidHandler fluidHandler, final IInventory inv, final int inputSlot,
   		final int outputSlot) {
   	final ItemStack input = inv.getStackInSlot(inputSlot);
   	final ItemStack output = inv.getStackInSlot(outputSlot);

   	if (input != ItemStack.EMPTY) {
   		final FluidStack fluidInContainer = getFluidContained(input);
   		ItemStack emptyItem = input.getItem().getContainerItem(input);
   		if (input.getItem() instanceof UniversalBucket) {
   			emptyItem = ((UniversalBucket) input.getItem()).getEmpty();
   		}

   		if (fluidInContainer != null && (emptyItem == ItemStack.EMPTY || output == ItemStack.EMPTY
   				|| output.getCount() < output.getMaxStackSize()
   						&& ItemUtils.isItemEqual(output, emptyItem, true, true))) {

   			final int used = fluidHandler.fill(fluidInContainer, false);
   			if (used >= fluidInContainer.amount && fluidHandler.fill(fluidInContainer, true) > 0) {
   				fluidHandler.fill(fluidInContainer, true);
   				if (emptyItem != ItemStack.EMPTY)
   					if (output == ItemStack.EMPTY)
   						inv.setInventorySlotContents(outputSlot, emptyItem);
   					else
   						output.setCount(output.getCount() + 1);
   				inv.decrStackSize(inputSlot, 1);

   				return true;
   			}
   		}
   	}
   	return false;
   }

It's only a replacement of == null with == ItemStack.EMPTY.
You can also notice that i've changed the method for determining the FluidStack because calling the forge one would fail in the case of a Cell. The Cell return null when the amount drained by simulation does not match it's capacity as shown in here :

		@Override
		public FluidStack drain(int maxDrain, boolean doDrain) {
			if (maxDrain != capacity)
				return null;
			return super.drain(maxDrain, doDrain);
		}

The new method look like this :

@Nullable	
public static FluidStack getFluidContained(@Nonnull ItemStack container) {
		if (!container.isEmpty()) {
			container = container.copy();
			container.setCount(1);
			final IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(container);
			if (fluidHandler != null) {
				return fluidHandler.drain(Fluid.BUCKET_VOLUME, false);
			}
		}
		return null;
	}

I'm not really a happy with reimplementing a forge method but the only other solution is to change the drain method inside the DynamicCell to be more gentle.

Here it is, everything that i've noted to have only appeared in 1.11.

commented

Ah, nice, thanks for the help and the effort you put into this issue. ๐Ÿ‘ I will be sure to take a look at the issues

commented

Missing block textures: Fixed
Manual: @gigabit101 was working on it, but not a lot has been done with it, so I guess it can be ignored.
Multiblocks: see #833
Iridium: see #792

Code snippets have been used. Thanks ๐Ÿ‘

commented

So I do plan on rewriting the Pagecollection code and making it more friendly I am also going to move it into RC so are other mods can add books real easy I will also move over page templates like the crafting page and so on