Added ME Fluid Interface (#3564)
* Fixed fluid storage bus json recipe * Added part version and recipes * Added rudimentary gui
This commit is contained in:
@@ -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