content: package com.mekeng.github.common.tile;
  
  import appeng.api.config.Upgrades;
  import appeng.api.networking.IGridNode;
  import appeng.api.networking.events.MENetworkChannelsChanged;
  import appeng.api.networking.events.MENetworkEventSubscribe;
  import appeng.api.networking.events.MENetworkPowerStatusChange;
  import appeng.api.networking.ticking.IGridTickable;
  import appeng.api.networking.ticking.TickRateModulation;
  import appeng.api.networking.ticking.TickingRequest;
  import appeng.api.util.AECableType;
  import appeng.api.util.AEPartLocation;
  import appeng.api.util.DimensionalCoord;
  import appeng.api.util.IConfigManager;
  import appeng.core.sync.GuiBridge;
  import appeng.core.sync.GuiWrapper;
  import appeng.helpers.IPriorityHost;
  import appeng.tile.grid.AENetworkTile;
  import com.mekeng.github.common.ItemAndBlocks;
  import com.mekeng.github.common.container.handler.AEGuiBridge;
  import com.mekeng.github.common.me.duality.IGasInterfaceHost;
  import com.mekeng.github.common.me.duality.impl.DualityGasInterface;
  import com.mekeng.github.common.me.inventory.IConfigurableGasInventory;
  import com.mekeng.github.common.me.inventory.IGasInventory;
  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.tileentity.TileEntity;
  import net.minecraft.util.EnumFacing;
  import net.minecraft.util.math.BlockPos;
  import net.minecraft.world.World;
  import net.minecraftforge.common.capabilities.Capability;
  import net.minecraftforge.items.IItemHandler;
  
  import javax.annotation.Nonnull;
  import javax.annotation.Nullable;
  import java.util.EnumSet;
  import java.util.List;
  
  public class TileGasInterface extends AENetworkTile implements IGridTickable, IGasInterfaceHost, IPriorityHost, IConfigurableGasInventory {
      private final DualityGasInterface duality = new DualityGasInterface(this.getProxy(), this);
  
      @MENetworkEventSubscribe
      public void stateChange(final MENetworkChannelsChanged c) {
          this.duality.notifyNeighbors();
      }
  
      @MENetworkEventSubscribe
      public void stateChange(final MENetworkPowerStatusChange c) {
          this.duality.notifyNeighbors();
      }
  
      @Nonnull
      @Override
      public TickingRequest getTickingRequest(@Nonnull IGridNode node) {
          return this.duality.getTickingRequest(node);
      }
  
      @Nonnull
      @Override
      public TickRateModulation tickingRequest(@Nonnull IGridNode node, int ticksSinceLastCall) {
          return this.duality.tickingRequest(node, ticksSinceLastCall);
      }
  
      @Override
      public DualityGasInterface getDualityGasInterface() {
          return this.duality;
      }
  
      @Override
      public TileEntity getTileEntity() {
          return this;
      }
  
      @Override
      public void getDrops(final World w, final BlockPos pos, final List<ItemStack> drops) {
          this.duality.addDrops(drops);
      }
  
      @Override
      public void gridChanged() {
          this.duality.gridChanged();
      }
  
      @Override
      public NBTTagCompound writeToNBT(final NBTTagCompound data) {
          super.writeToNBT(data);
          this.duality.writeToNBT(data);
          return data;
      }
  
      @Override
      public void readFromNBT(final NBTTagCompound data) {
          super.readFromNBT(data);
          this.duality.readFromNBT(data);
      }
  
      @Nonnull
      @Override
      public AECableType getCableConnectionType(@Nonnull final AEPartLocation dir) {
          return this.duality.getCableConnectionType();
      }
  
      @Override
      public DimensionalCoord getLocation() {
          return this.duality.getLocation();
      }
  
      @Override
      public EnumSet<EnumFacing> getTargets() {
          return EnumSet.allOf(EnumFacing.class);
      }
  
      @Override
      public int getPriority() {
          return this.duality.getPriority();
      }
  
      @Override
      public void setPriority(final int newValue) {
          this.duality.setPriority(newValue);
      }
  
      @Override
      public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
          return this.duality.hasCapability(capability, facing) || super.hasCapability(capability, facing);
      }
  
      @Override
      public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
          T result = this.duality.getCapability(capability, facing);
          if (result != null) {
              return result;
          }
          return super.getCapability(capability, facing);
      }
  
      @Override
      public int getInstalledUpgrades(Upgrades u) {
          return this.duality.getInstalledUpgrades(u);
      }
  
      @Override
      public IConfigManager getConfigManager() {
          return this.duality.getConfigManager();
      }
  
      @Override
      public IItemHandler getInventoryByName(String name) {
          return this.duality.getInventoryByName(name);
      }
  
      @Override
      public IGasInventory getGasInventoryByName(final String name) {
          return this.duality.getGasInventoryByName(name);
      }
  
      @Override
      public ItemStack getItemStackRepresentation() {
          return new ItemStack(ItemAndBlocks.GAS_INTERFACE);
      }
  
      @Override
      public GuiBridge getGuiBridge() {
          return GuiWrapper.INSTANCE.wrap(AEGuiBridge.GAS_INTERFACE);
      }
  
  }
  