Added ME Fluid Interface (#3564)
* Fixed fluid storage bus json recipe * Added part version and recipes * Added rudimentary gui
This commit is contained in:
@@ -126,6 +126,8 @@ import appeng.decorative.solid.BlockQuartzPillar;
|
||||
import appeng.decorative.solid.BlockSkyStone;
|
||||
import appeng.decorative.solid.BlockSkyStone.SkystoneType;
|
||||
import appeng.decorative.stair.BlockStairCommon;
|
||||
import appeng.fluids.block.BlockFluidInterface;
|
||||
import appeng.fluids.tile.TileFluidInterface;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||
@@ -197,6 +199,7 @@ public final class ApiBlocks implements IBlocks
|
||||
private final ITileDefinition drive;
|
||||
private final ITileDefinition chest;
|
||||
private final ITileDefinition iface;
|
||||
private final ITileDefinition fluidIface;
|
||||
private final ITileDefinition cellWorkbench;
|
||||
private final ITileDefinition iOPort;
|
||||
private final ITileDefinition condenser;
|
||||
@@ -390,6 +393,10 @@ public final class ApiBlocks implements IBlocks
|
||||
.features( AEFeature.INTERFACE )
|
||||
.tileEntity( new TileEntityDefinition( TileInterface.class ) )
|
||||
.build();
|
||||
this.fluidIface = registry.block( "fluid_interface", BlockFluidInterface::new )
|
||||
.features( AEFeature.FLUID_INTERFACE )
|
||||
.tileEntity( new TileEntityDefinition( TileFluidInterface.class ) )
|
||||
.build();
|
||||
this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new )
|
||||
.features( AEFeature.STORAGE_CELLS )
|
||||
.tileEntity( new TileEntityDefinition( TileCellWorkbench.class ) )
|
||||
@@ -893,6 +900,12 @@ public final class ApiBlocks implements IBlocks
|
||||
return this.iface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition fluidIface()
|
||||
{
|
||||
return this.fluidIface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition cellWorkbench()
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ public final class ApiParts implements IParts
|
||||
private final IItemDefinition importBus;
|
||||
private final IItemDefinition exportBus;
|
||||
private final IItemDefinition iface;
|
||||
private final IItemDefinition fluidIface;
|
||||
private final IItemDefinition levelEmitter;
|
||||
private final IItemDefinition annihilationPlane;
|
||||
private final IItemDefinition identityAnnihilationPlane;
|
||||
@@ -111,10 +112,11 @@ public final class ApiParts implements IParts
|
||||
this.importBus = new DamagedItemDefinition( "part.bus.import", itemPart.createPart( PartType.IMPORT_BUS ) );
|
||||
this.exportBus = new DamagedItemDefinition( "part.bus.export", itemPart.createPart( PartType.EXPORT_BUS ) );
|
||||
this.iface = new DamagedItemDefinition( "part.interface", itemPart.createPart( PartType.INTERFACE ) );
|
||||
this.fluidIface = new DamagedItemDefinition( "part.fluid_interface", itemPart.createPart( PartType.FLUID_INTERFACE ) );
|
||||
this.levelEmitter = new DamagedItemDefinition( "part.level_emitter", itemPart.createPart( PartType.LEVEL_EMITTER ) );
|
||||
this.annihilationPlane = new DamagedItemDefinition( "part.plane.annihilation", itemPart.createPart( PartType.ANNIHILATION_PLANE ) );
|
||||
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity",
|
||||
itemPart.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
|
||||
this.identityAnnihilationPlane = new DamagedItemDefinition( "part.plane.annihiliation.identity", itemPart
|
||||
.createPart( PartType.IDENTITY_ANNIHILATION_PLANE ) );
|
||||
this.formationPlane = new DamagedItemDefinition( "part.plane.formation", itemPart.createPart( PartType.FORMATION_PLANE ) );
|
||||
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2P_TUNNEL_ME ) );
|
||||
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2P_TUNNEL_REDSTONE ) );
|
||||
@@ -255,6 +257,12 @@ public final class ApiParts implements IParts
|
||||
return this.iface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition fluidIface()
|
||||
{
|
||||
return this.fluidIface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition levelEmitter()
|
||||
{
|
||||
|
||||
@@ -75,6 +75,7 @@ public enum AEFeature
|
||||
CHANNELS( "Channels", Constants.CATEGORY_NETWORK_FEATURES ),
|
||||
|
||||
INTERFACE( "Interface", Constants.CATEGORY_NETWORK_BUSES ),
|
||||
FLUID_INTERFACE( "FluidInterface", Constants.CATEGORY_NETWORK_BUSES ),
|
||||
LEVEL_EMITTER( "LevelEmitter", Constants.CATEGORY_NETWORK_BUSES ),
|
||||
FLUID_TERMINAL( "FluidTerminal", Constants.CATEGORY_NETWORK_BUSES ),
|
||||
CRAFTING_TERMINAL( "CraftingTerminal", Constants.CATEGORY_NETWORK_BUSES ),
|
||||
|
||||
@@ -40,6 +40,7 @@ public enum GuiText
|
||||
Terminal,
|
||||
|
||||
Interface,
|
||||
FluidInterface,
|
||||
Config,
|
||||
StoredItems,
|
||||
Patterns,
|
||||
|
||||
@@ -39,8 +39,6 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
|
||||
public abstract class AppEngPacket implements Packet
|
||||
{
|
||||
|
||||
private AppEngPacketHandlerBase.PacketTypes id;
|
||||
private PacketBuffer p;
|
||||
private PacketCallState caller;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.core.sync.packets.PacketCompassResponse;
|
||||
import appeng.core.sync.packets.PacketCompressedNBT;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketCraftRequest;
|
||||
import appeng.core.sync.packets.PacketFluidTank;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketJEIRecipe;
|
||||
import appeng.core.sync.packets.PacketLightning;
|
||||
@@ -104,7 +105,9 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
PACKET_COMPRESSED_NBT( PacketCompressedNBT.class ),
|
||||
|
||||
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class );
|
||||
PACKET_PAINTED_ENTITY( PacketPaintedEntity.class ),
|
||||
|
||||
PACKET_FLUID_TANK( PacketFluidTank.class );
|
||||
|
||||
private final Class<? extends AppEngPacket> packetClass;
|
||||
private final Constructor<? extends AppEngPacket> packetConstructor;
|
||||
|
||||
@@ -87,8 +87,10 @@ import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.container.implementations.ContainerWireless;
|
||||
import appeng.container.implementations.ContainerWirelessTerm;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.container.ContainerFluidInterface;
|
||||
import appeng.fluids.container.ContainerFluidStorageBus;
|
||||
import appeng.fluids.container.ContainerFluidTerminal;
|
||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||
import appeng.fluids.parts.PartFluidStorageBus;
|
||||
import appeng.fluids.parts.PartFluidTerminal;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
@@ -156,6 +158,8 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
GUI_INTERFACE( ContainerInterface.class, IInterfaceHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_FLUID_INTERFACE( ContainerFluidInterface.class, IFluidInterfaceHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_BUS( ContainerUpgradeable.class, IUpgradeableHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
GUI_BUS_FLUID( ContainerFluidIO.class, PartSharedFluidBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD ),
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.core.sync.packets;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.fluids.container.ContainerFluidInterface;
|
||||
|
||||
|
||||
public class PacketFluidTank extends AppEngPacket
|
||||
{
|
||||
private final Map<Integer, NBTTagCompound> updateMap;
|
||||
|
||||
public PacketFluidTank( final ByteBuf stream )
|
||||
{
|
||||
this.updateMap = new HashMap<>();
|
||||
NBTTagCompound tags = ByteBufUtils.readTag( stream );
|
||||
|
||||
for( final String key : tags.getKeySet() )
|
||||
{
|
||||
updateMap.put( Integer.parseInt( key ), tags.getCompoundTag( key ) );
|
||||
}
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketFluidTank( final Map<Integer, NBTTagCompound> updateMap )
|
||||
{
|
||||
this.updateMap = updateMap;
|
||||
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
for( Map.Entry<Integer, NBTTagCompound> e : updateMap.entrySet() )
|
||||
{
|
||||
tag.setTag( e.getKey().toString(), e.getValue() );
|
||||
}
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
data.writeInt( this.getPacketID() );
|
||||
ByteBufUtils.writeTag( data, tag );
|
||||
this.configureWrite( data );
|
||||
}
|
||||
|
||||
public Map<Integer, NBTTagCompound> getUpdateMap()
|
||||
{
|
||||
return this.updateMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
|
||||
{
|
||||
final Container c = player.openContainer;
|
||||
if( c instanceof ContainerFluidInterface )
|
||||
{
|
||||
( (ContainerFluidInterface) c ).receiveTankInfo( this.updateMap );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user