Fixes #3560: Render the fluid stacksize for ME fluid slots. (#3562)

This commit is contained in:
yueh
2018-06-24 17:22:07 +02:00
committed by fscan
parent 841bc6e356
commit 046a27bf4c
11 changed files with 250 additions and 62 deletions
+25 -11
View File
@@ -71,7 +71,6 @@ import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot; import appeng.container.slot.AppEngSlot;
import appeng.container.slot.AppEngSlot.hasCalculatedValidness; import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
import appeng.container.slot.IOptionalSlot; import appeng.container.slot.IOptionalSlot;
import appeng.container.slot.ISlotFluid;
import appeng.container.slot.SlotCraftingTerm; import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled; import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake; import appeng.container.slot.SlotFake;
@@ -84,6 +83,9 @@ import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction; import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketSwapSlots; import appeng.core.sync.packets.PacketSwapSlots;
import appeng.fluids.client.render.FluidStackSizeRenderer;
import appeng.fluids.container.slots.IFluidSlot;
import appeng.fluids.container.slots.IMEFluidSlot;
import appeng.helpers.InventoryAction; import appeng.helpers.InventoryAction;
@@ -93,6 +95,7 @@ public abstract class AEBaseGui extends GuiContainer
// drag y // drag y
private final Set<Slot> drag_click = new HashSet<>(); private final Set<Slot> drag_click = new HashSet<>();
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer(); private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
private final FluidStackSizeRenderer fluidStackSizeRenderer = new FluidStackSizeRenderer();
private GuiScrollbar myScrollBar = null; private GuiScrollbar myScrollBar = null;
private boolean disableShiftClick = false; private boolean disableShiftClick = false;
private Stopwatch dbl_clickTimer = Stopwatch.createStarted(); private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
@@ -217,12 +220,12 @@ public abstract class AEBaseGui extends GuiContainer
protected void renderHoveredToolTip( int mouseX, int mouseY ) protected void renderHoveredToolTip( int mouseX, int mouseY )
{ {
Slot slot = this.getSlot( mouseX, mouseY ); Slot slot = this.getSlot( mouseX, mouseY );
if( slot != null && slot.isEnabled() && slot instanceof ISlotFluid ) if( slot != null && slot.isEnabled() && slot instanceof IFluidSlot )
{ {
ISlotFluid fluidSlot = (ISlotFluid) slot; IFluidSlot fluidSlot = (IFluidSlot) slot;
if( fluidSlot.getFluidInSlot() != null && fluidSlot.shouldRenderAsFluid() ) if( fluidSlot.getFluidStack() != null && fluidSlot.shouldRenderAsFluid() )
{ {
FluidStack fluidStack = fluidSlot.getFluidInSlot(); FluidStack fluidStack = fluidSlot.getFluidStack();
this.drawHoveringText( fluidStack.getLocalizedName(), mouseX, mouseY ); this.drawHoveringText( fluidStack.getLocalizedName(), mouseX, mouseY );
return; return;
} }
@@ -266,14 +269,16 @@ public abstract class AEBaseGui extends GuiContainer
final AppEngSlot aeSlot = (AppEngSlot) slot; final AppEngSlot aeSlot = (AppEngSlot) slot;
if( aeSlot.isSlotEnabled() ) if( aeSlot.isSlotEnabled() )
{ {
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18,
18 ); 18 );
} }
else else
{ {
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend(); GlStateManager.enableBlend();
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
18,
18 ); 18 );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
} }
@@ -738,10 +743,12 @@ public abstract class AEBaseGui extends GuiContainer
return; return;
} }
else if( s instanceof ISlotFluid && ( (ISlotFluid) s ).shouldRenderAsFluid() ) else if( s instanceof IFluidSlot && ( (IFluidSlot) s ).shouldRenderAsFluid() )
{ {
FluidStack fs = ( (ISlotFluid) s ).getFluidInSlot(); final IFluidSlot slot = (IFluidSlot) s;
if( fs != null ) final FluidStack fs = slot.getFluidStack();
if( fs != null && this.isPowered() )
{ {
GlStateManager.disableLighting(); GlStateManager.disableLighting();
Fluid fluid = fs.getFluid(); Fluid fluid = fs.getFluid();
@@ -757,11 +764,18 @@ public abstract class AEBaseGui extends GuiContainer
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 ); this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 );
GlStateManager.enableLighting(); GlStateManager.enableLighting();
if( s instanceof IMEFluidSlot )
{
final IMEFluidSlot meFluidSlot = (IMEFluidSlot) s;
this.fluidStackSizeRenderer.renderStackSize( this.fontRenderer, meFluidSlot.getAEFluidStack(), s.xPos, s.yPos );
}
} }
if( !this.isPowered() ) else if( !this.isPowered() )
{ {
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 ); drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
} }
return; return;
} }
else else
@@ -28,7 +28,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.container.slot.ISlotFluid; import appeng.fluids.container.slots.IMEFluidSlot;
/** /**
@@ -36,8 +36,9 @@ import appeng.container.slot.ISlotFluid;
* @version rv6 - 22/05/2018 * @version rv6 - 22/05/2018
* @since rv6 22/05/2018 * @since rv6 22/05/2018
*/ */
public class SlotFluidME extends SlotItemHandler implements ISlotFluid public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot
{ {
private InternalFluidSlotME slot; private InternalFluidSlotME slot;
public SlotFluidME( InternalFluidSlotME slot ) public SlotFluidME( InternalFluidSlotME slot )
@@ -46,7 +47,8 @@ public class SlotFluidME extends SlotItemHandler implements ISlotFluid
this.slot = slot; this.slot = slot;
} }
public IAEFluidStack getAEStack() @Override
public IAEFluidStack getAEFluidStack()
{ {
if( this.slot.hasPower() ) if( this.slot.hasPower() )
{ {
@@ -69,7 +71,7 @@ public class SlotFluidME extends SlotItemHandler implements ISlotFluid
} }
@Override @Override
public FluidStack getFluidInSlot() public FluidStack getFluidStack()
{ {
return this.slot.getStack(); return this.slot.getStack();
} }
@@ -79,7 +81,7 @@ public class SlotFluidME extends SlotItemHandler implements ISlotFluid
{ {
if( this.slot.hasPower() ) if( this.slot.hasPower() )
{ {
return this.getAEStack() != null; return this.getAEFluidStack() != null;
} }
return false; return false;
} }
@@ -274,7 +274,7 @@ public class AppEngSlot extends Slot
this.isValid = isValid; this.isValid = isValid;
} }
AEBaseContainer getContainer() protected AEBaseContainer getContainer()
{ {
return this.myContainer; return this.myContainer;
} }
@@ -20,10 +20,11 @@ package appeng.fluids.client.gui;
import java.io.IOException; import java.io.IOException;
import java.text.DecimalFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
@@ -32,7 +33,6 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType; import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import appeng.api.config.Settings; import appeng.api.config.Settings;
@@ -45,20 +45,19 @@ import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ISortSource; import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.MEGuiTextField; import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.me.FluidRepo; import appeng.client.me.FluidRepo;
import appeng.client.me.SlotFluidME;
import appeng.client.me.InternalFluidSlotME; import appeng.client.me.InternalFluidSlotME;
import appeng.container.slot.ISlotFluid; import appeng.client.me.SlotFluidME;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction; import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketValueConfig; import appeng.core.sync.packets.PacketValueConfig;
import appeng.fluids.container.ContainerFluidTerminal; import appeng.fluids.container.ContainerFluidTerminal;
import appeng.fluids.container.slots.IMEFluidSlot;
import appeng.fluids.parts.PartFluidTerminal; import appeng.fluids.parts.PartFluidTerminal;
import appeng.helpers.InventoryAction; import appeng.helpers.InventoryAction;
import appeng.util.IConfigManagerHost; import appeng.util.IConfigManagerHost;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
/** /**
@@ -115,7 +114,8 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
this.buttonList.add( this.sortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) ); this.buttonList.add( this.sortByBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting( Settings.SORT_BY ) ) );
offset += 20; offset += 20;
this.buttonList.add( this.sortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc.getSetting( Settings.SORT_DIRECTION ) ) ); this.buttonList.add( this.sortDirBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, this.configSrc
.getSetting( Settings.SORT_DIRECTION ) ) );
for( int y = 0; y < this.rows; y++ ) for( int y = 0; y < this.rows; y++ )
{ {
@@ -166,31 +166,30 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
@Override @Override
protected void renderHoveredToolTip( int mouseX, int mouseY ) protected void renderHoveredToolTip( int mouseX, int mouseY )
{ {
Slot slot = this.getSlot( mouseX, mouseY ); final Slot slot = this.getSlot( mouseX, mouseY );
if( slot != null && slot.isEnabled() && slot instanceof ISlotFluid )
if( slot != null && slot instanceof IMEFluidSlot && slot.isEnabled() )
{ {
ISlotFluid fluidSlot = (ISlotFluid) slot; final IMEFluidSlot fluidSlot = (IMEFluidSlot) slot;
if( fluidSlot.getFluidInSlot() != null && fluidSlot.shouldRenderAsFluid() )
if( fluidSlot.getFluidStack() != null && fluidSlot.shouldRenderAsFluid() )
{ {
FluidStack fluidStack = fluidSlot.getFluidInSlot(); final IAEFluidStack fluidStack = fluidSlot.getAEFluidStack();
List<String> list = new ArrayList<>(); final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( fluidStack.getStackSize() ) + " mB";
list.add( fluidStack.getLocalizedName() );
int amount = fluidStack.amount; final String modName = "" + TextFormatting.BLUE + TextFormatting.ITALIC + Loader.instance()
DecimalFormat formatter = new DecimalFormat( "#,###.##" ); .getIndexedModList()
String amountStr = formatter.format( amount ) + "mb"; .get( Platform.getModId( fluidStack ) )
if( amount >= 10000 ) .getName();
{
amountStr += " ( "; final List<String> list = new ArrayList<>();
amountStr += formatter.format( amount / 1000 ) + "B";
amountStr += " )"; list.add( fluidStack.getFluidStack().getLocalizedName() );
} list.add( formattedAmount );
list.add( amountStr );
String modName = "";
modName += TextFormatting.BLUE;
modName += TextFormatting.ITALIC;
modName += Loader.instance().getIndexedModList().get( Platform.getModId( AEFluidStack.fromFluidStack( fluidStack ) ) ).getName();
list.add( modName ); list.add( modName );
this.drawHoveringText( list, mouseX, mouseY ); this.drawHoveringText( list, mouseX, mouseY );
return; return;
} }
} }
@@ -203,8 +202,8 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
if( btn instanceof GuiImgButton ) if( btn instanceof GuiImgButton )
{ {
final boolean backwards = Mouse.isButtonDown( 1 ); final boolean backwards = Mouse.isButtonDown( 1 );
final GuiImgButton iBtn = (GuiImgButton) btn; final GuiImgButton iBtn = (GuiImgButton) btn;
if( iBtn.getSetting() != Settings.ACTIONS ) if( iBtn.getSetting() != Settings.ACTIONS )
{ {
final Enum cv = iBtn.getCurrentValue(); final Enum cv = iBtn.getCurrentValue();
@@ -229,22 +228,23 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi
{ {
if( slot instanceof SlotFluidME ) if( slot instanceof SlotFluidME )
{ {
SlotFluidME meSlot = (SlotFluidME) slot; final SlotFluidME meSlot = (SlotFluidME) slot;
if( clickType == ClickType.PICKUP ) if( clickType == ClickType.PICKUP )
{ {
// TODO: Allow more options // TODO: Allow more options
if( mouseButton == 0 && meSlot.getHasStack() ) if( mouseButton == 0 && meSlot.getHasStack() )
{ {
this.container.setTargetStack( meSlot.getAEStack() ); this.container.setTargetStack( meSlot.getAEFluidStack() );
AELog.info( "mouse0 GUI STACK SIZE %s", meSlot.getAEStack().getStackSize() ); AELog.info( "mouse0 GUI STACK SIZE %s", meSlot.getAEFluidStack().getStackSize() );
NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.FILL_ITEM, slot.slotNumber, 0 ) ); NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.FILL_ITEM, slot.slotNumber, 0 ) );
} }
else else
{ {
this.container.setTargetStack( meSlot.getAEStack() ); this.container.setTargetStack( meSlot.getAEFluidStack() );
if( meSlot.getAEStack() != null ) if( meSlot.getAEFluidStack() != null )
{ {
AELog.info( "mouse1 GUI STACK SIZE %s", meSlot.getAEStack().getStackSize() ); AELog.info( "mouse1 GUI STACK SIZE %s", meSlot.getAEFluidStack().getStackSize() );
} }
NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.EMPTY_ITEM, slot.slotNumber, 0 ) ); NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.EMPTY_ITEM, slot.slotNumber, 0 ) );
} }
@@ -0,0 +1,134 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.fluids.client.render;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.AEConfig;
import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
/**
* @author AlgorithmX2
* @author thatsIch
* @author yueh
* @version rv6
* @since rv6
*/
public class FluidStackSizeRenderer
{
private static final String[] NUMBER_FORMATS = new String[] { "#.000", "#.00", "#.0", "#" };
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
public void renderStackSize( FontRenderer fontRenderer, IAEFluidStack aeStack, int xPos, int yPos )
{
if( aeStack != null )
{
final float scaleFactor = AEConfig.instance().useTerminalUseLargeFont() ? 0.85f : 0.5f;
final float inverseScaleFactor = 1.0f / scaleFactor;
final int offset = AEConfig.instance().useTerminalUseLargeFont() ? 0 : -1;
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag( false );
if( aeStack.getStackSize() > 0 )
{
final String stackSize = this.getToBeRenderedStackSize( aeStack.getStackSize() );
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
GlStateManager.pushMatrix();
GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GlStateManager.popMatrix();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableBlend();
}
fontRenderer.setUnicodeFlag( unicodeFlag );
}
}
private String getToBeRenderedStackSize( final long originalSize )
{
// Handle any value below 100 (large font) or 1000 (small font) Buckets with a custom formatter,
// otherwise pass it to the normal number converter
if( originalSize < 1000 * 100 && AEConfig.instance().useTerminalUseLargeFont() )
{
return this.getSlimRenderedStacksize( originalSize );
}
else if( originalSize < 1000 * 1000 && !AEConfig.instance().useTerminalUseLargeFont() )
{
return this.getWideRenderedStacksize( originalSize );
}
if( AEConfig.instance().useTerminalUseLargeFont() )
{
return SLIM_CONVERTER.toSlimReadableForm( originalSize / 1000 );
}
else
{
return WIDE_CONVERTER.toWideReadableForm( originalSize / 1000 );
}
}
private String getSlimRenderedStacksize( final long originalSize )
{
final int log = 1 + (int) Math.floor( Math.log10( originalSize ) ) / 2;
return this.getRenderedFluidStackSize( originalSize, log );
}
private String getWideRenderedStacksize( final long originalSize )
{
final int log = (int) Math.floor( Math.log10( originalSize ) ) / 2;
return this.getRenderedFluidStackSize( originalSize, log );
}
private String getRenderedFluidStackSize( final long originalSize, final int log )
{
final int index = Math.max( 0, Math.min( 3, log ) );
final DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator( '.' );
final DecimalFormat format = new DecimalFormat( NUMBER_FORMATS[index] );
format.setDecimalFormatSymbols( symbols );
format.setRoundingMode( RoundingMode.DOWN );
return format.format( originalSize / 1000f );
}
}
@@ -27,8 +27,8 @@ import net.minecraftforge.items.IItemHandler;
import appeng.api.implementations.IUpgradeableHost; import appeng.api.implementations.IUpgradeableHost;
import appeng.container.implementations.ContainerUpgradeable; import appeng.container.implementations.ContainerUpgradeable;
import appeng.container.slot.OptionalSlotFakeFluid; import appeng.fluids.container.slots.OptionalSlotFakeFluid;
import appeng.container.slot.SlotFakeFluid; import appeng.fluids.container.slots.SlotFakeFluid;
/** /**
@@ -38,9 +38,9 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList; import appeng.api.storage.data.IItemList;
import appeng.container.guisync.GuiSync; import appeng.container.guisync.GuiSync;
import appeng.container.implementations.ContainerUpgradeable; import appeng.container.implementations.ContainerUpgradeable;
import appeng.container.slot.OptionalSlotFakeFluid;
import appeng.container.slot.SlotFakeFluid;
import appeng.container.slot.SlotRestrictedInput; import appeng.container.slot.SlotRestrictedInput;
import appeng.fluids.container.slots.OptionalSlotFakeFluid;
import appeng.fluids.container.slots.SlotFakeFluid;
import appeng.fluids.parts.PartFluidStorageBus; import appeng.fluids.parts.PartFluidStorageBus;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.helpers.ItemHandlerUtil; import appeng.util.helpers.ItemHandlerUtil;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.container.slot; package appeng.fluids.container.slots;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@@ -27,9 +27,9 @@ import net.minecraftforge.fluids.FluidStack;
* @version rv6 - 3/05/2018 * @version rv6 - 3/05/2018
* @since rv6 3/05/2018 * @since rv6 3/05/2018
*/ */
public interface ISlotFluid public interface IFluidSlot
{ {
FluidStack getFluidInSlot(); FluidStack getFluidStack();
default boolean shouldRenderAsFluid() default boolean shouldRenderAsFluid()
{ {
@@ -0,0 +1,33 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.fluids.container.slots;
import appeng.api.storage.data.IAEFluidStack;
/**
* @author yueh
* @version rv6
* @since rv6
*/
public interface IMEFluidSlot extends IFluidSlot
{
IAEFluidStack getAEFluidStack();
}
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.container.slot; package appeng.fluids.container.slots;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@@ -24,6 +24,9 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.container.slot.IOptionalSlot;
import appeng.container.slot.IOptionalSlotHost;
/** /**
* @author BrockWS * @author BrockWS
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.container.slot; package appeng.fluids.container.slots;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -25,13 +25,15 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.container.slot.SlotFake;
/** /**
* @author BrockWS * @author BrockWS
* @version rv6 - 1/05/2018 * @version rv6 - 1/05/2018
* @since rv6 1/05/2018 * @since rv6 1/05/2018
*/ */
public class SlotFakeFluid extends SlotFake implements ISlotFluid public class SlotFakeFluid extends SlotFake implements IFluidSlot
{ {
public SlotFakeFluid( IItemHandler inv, int idx, int x, int y ) public SlotFakeFluid( IItemHandler inv, int idx, int x, int y )
{ {
@@ -61,7 +63,7 @@ public class SlotFakeFluid extends SlotFake implements ISlotFluid
} }
@Override @Override
public FluidStack getFluidInSlot() public FluidStack getFluidStack()
{ {
if( !this.getStack().isEmpty() ) if( !this.getStack().isEmpty() )
{ {