fix MouseRegionManager can't display tooltip.

when ingredient buffer outputting fluid, the current slot is used continuously,not from first slot to start output.
This commit is contained in:
asdflj committed 2022-09-30 16:55:11 +08:00
1 parent 989cd173fb
commit 61ac42d270
2 files changed
+6 -1

No files matched your search

@@ -17,6 +17,7 @@ public class AEFluidInventory implements IAEFluidTank
private final IAEFluidStack[] fluids;
private final IAEFluidInventory handler;
private final int capacity;
public int lastIndex;
public AEFluidInventory( final IAEFluidInventory handler, final int slots, final int capcity )
{
@@ -253,9 +254,10 @@ public class AEFluidInventory implements IAEFluidTank
FluidStack totalDrained = null;
int toDrain = maxDrain;
for( int slot = 0; slot < this.getSlots(); ++slot )
for( int slot = lastIndex; slot < this.getSlots(); ++slot )
{
if (this.getFluidInSlot(slot) == null) {
if(slot == this.getSlots()-1) lastIndex = 0;
continue;
}
@@ -264,6 +266,7 @@ public class AEFluidInventory implements IAEFluidTank
totalDrained = this.drain( slot, toDrain, doDrain );
if( totalDrained != null )
{
lastIndex = slot;
toDrain -= totalDrained.amount;
}
}
@@ -1,5 +1,6 @@
package com.glodblock.github.inventory.gui;
import appeng.client.gui.AEBaseGui;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
@@ -39,6 +40,7 @@ public class MouseRegionManager {
if (region.containsMouse(mX, mY)) {
List<String> tooltip = region.handler.getTooltip();
if (tooltip != null) {
((AEBaseGui)gui).drawTooltip(mX,mY,0,String.join("\n",tooltip));
return;
}
}