More compile things

This commit is contained in:
covers1624
2020-06-02 15:12:30 +09:30
parent 404ef5624b
commit 3f5c299d09
111 changed files with 838 additions and 873 deletions
@@ -6,8 +6,9 @@ import java.util.Collections;
import java.util.Map;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
@@ -32,7 +33,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
public abstract IAEFluidTank getFluidConfigInventory();
private FluidSyncHelper getSynchHelper()
private FluidSyncHelper getSyncHelper()
{
if( this.sync == null )
{
@@ -44,11 +45,11 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
@Override
protected ItemStack transferStackToContainer( ItemStack input )
{
FluidStack fs = FluidUtil.getFluidContained( input );
if( fs != null )
LazyOptional<FluidStack> fsOpt = FluidUtil.getFluidContained( input );
if( fsOpt.isPresent() )
{
final IAEFluidTank t = this.getFluidConfigInventory();
final IAEFluidStack stack = AEFluidStack.fromFluidStack( fs );
final IAEFluidStack stack = AEFluidStack.fromFluidStack( fsOpt.orElse( null ) );
for( int i = 0; i < t.getSlots(); ++i )
{
if( t.getFluidInSlot( i ) == null && this.isValidForConfig( i, stack ) )
@@ -86,7 +87,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
{
if( Platform.isServer() )
{
this.getSynchHelper().sendDiff( this.listeners );
this.getSyncHelper().sendDiff( this.listeners );
// clear out config items that are no longer valid (eg capacity upgrade removed)
final IAEFluidTank t = this.getFluidConfigInventory();
@@ -105,13 +106,13 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im
public void addListener( IContainerListener listener )
{
super.addListener( listener );
this.getSynchHelper().sendFull( Collections.singleton( listener ) );
this.getSyncHelper().sendFull( Collections.singleton( listener ) );
}
@Override
public void receiveFluidSlots( Map<Integer, IAEFluidStack> fluids )
{
this.getSynchHelper().readPacket( fluids );
this.getSyncHelper().readPacket( fluids );
}
}
@@ -23,7 +23,7 @@ import java.util.Collections;
import java.util.Map;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.container.IContainerListener;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEFluidStack;
@@ -1,8 +1,7 @@
package appeng.fluids.container;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraftforge.api.distmarker.Dist;
@@ -22,7 +21,7 @@ public class ContainerFluidLevelEmitter extends ContainerFluidConfigurable
private final PartFluidLevelEmitter lvlEmitter;
@OnlyIn( Dist.CLIENT )
private GuiTextField textField;
private TextFieldWidget textField;
@GuiSync( 3 )
public long EmitterValue = -1;
@@ -33,7 +32,7 @@ public class ContainerFluidLevelEmitter extends ContainerFluidConfigurable
}
@OnlyIn( Dist.CLIENT )
public void setTextField( final GuiTextField level )
public void setTextField( final TextFieldWidget level )
{
this.textField = level;
this.textField.setText( String.valueOf( this.EmitterValue ) );
@@ -36,6 +36,7 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.Api;
import appeng.fluids.parts.PartFluidStorageBus;
import appeng.fluids.util.IAEFluidTank;
import appeng.util.Platform;
@@ -21,19 +21,19 @@ package appeng.fluids.container;
import java.io.IOException;
import java.nio.BufferOverflowException;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.Settings;
@@ -60,6 +60,7 @@ import appeng.api.util.IConfigurableObject;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEFluidInventoryUpdate;
import appeng.core.sync.packets.PacketTargetFluidStack;
@@ -358,12 +359,13 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
return;
}
final IFluidHandlerItem fh = FluidUtil.getFluidHandler( held );
if( fh == null )
final LazyOptional<IFluidHandlerItem> fhOpt = FluidUtil.getFluidHandler( held );
if( !fhOpt.isPresent() )
{
// only fluid handlers items
return;
}
IFluidHandlerItem fh = fhOpt.orElse( null );
if( action == InventoryAction.FILL_ITEM && this.clientRequestedTargetFluid != null )
{
@@ -371,7 +373,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
// Check how much we can store in the item
stack.setStackSize( Integer.MAX_VALUE );
int amountAllowed = fh.fill( stack.getFluidStack(), false );
int amountAllowed = fh.fill( stack.getFluidStack(), FluidAction.SIMULATE );
stack.setStackSize( amountAllowed );
// Check if we can pull out of the system
@@ -382,7 +384,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
}
// How much could fit into the container
final int canFill = fh.fill( canPull.getFluidStack(), false );
final int canFill = fh.fill( canPull.getFluidStack(), FluidAction.SIMULATE );
if( canFill == 0 )
{
return;
@@ -399,7 +401,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
}
// Actually fill
final int used = fh.fill( pulled.getFluidStack(), true );
final int used = fh.fill( pulled.getFluidStack(), FluidAction.EXECUTE );
if( used != canFill )
{
@@ -412,37 +414,35 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa
else if( action == InventoryAction.EMPTY_ITEM )
{
// See how much we can drain from the item
final FluidStack extract = fh.drain( Integer.MAX_VALUE, false );
if( extract == null || extract.amount < 1 )
final FluidStack extract = fh.drain( Integer.MAX_VALUE, FluidAction.SIMULATE );
if( extract == null || extract.getAmount() < 1 )
{
return;
}
// Check if we can push into the system
final IAEFluidStack notStorable = Platform.poweredInsert( this.getPowerSource(), this.monitor, AEFluidStack.fromFluidStack( extract ),
this.getActionSource(), Actionable.SIMULATE );
final IAEFluidStack notStorable = Platform.poweredInsert( this.getPowerSource(), this.monitor, AEFluidStack.fromFluidStack( extract ), this.getActionSource(), Actionable.SIMULATE );
if( notStorable != null && notStorable.getStackSize() > 0 )
{
final int toStore = (int) ( extract.amount - notStorable.getStackSize() );
final FluidStack storable = fh.drain( toStore, false );
final int toStore = (int) ( extract.getAmount() - notStorable.getStackSize() );
final FluidStack storable = fh.drain( toStore, FluidAction.SIMULATE );
if( storable == null || storable.amount == 0 )
if( storable == null || storable.getAmount() == 0 )
{
return;
}
else
{
extract.amount = storable.amount;
extract.setAmount( storable.getAmount() );
}
}
// Actually drain
final FluidStack drained = fh.drain( extract, true );
extract.amount = drained.amount;
final FluidStack drained = fh.drain( extract, FluidAction.EXECUTE );
extract.setAmount( drained.getAmount() );
final IAEFluidStack notInserted = Platform.poweredInsert( this.getPowerSource(), this.monitor, AEFluidStack.fromFluidStack( extract ),
this.getActionSource() );
final IAEFluidStack notInserted = Platform.poweredInsert( this.getPowerSource(), this.monitor, AEFluidStack.fromFluidStack( extract ), this.getActionSource() );
if( notInserted != null && notInserted.getStackSize() > 0 )
{