Package logisticspipes.network.packets.orderer

Source Code of logisticspipes.network.packets.orderer.DiskSetNamePacket

package logisticspipes.network.packets.orderer;

import logisticspipes.LogisticsPipes;
import logisticspipes.network.abstractpackets.ModernPacket;
import logisticspipes.network.abstractpackets.StringCoordinatesPacket;
import logisticspipes.pipes.PipeItemsRequestLogisticsMk2;
import logisticspipes.pipes.basic.LogisticsTileGenericPipe;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;

public class DiskSetNamePacket extends StringCoordinatesPacket {

  public DiskSetNamePacket(int id) {
    super(id);
  }

  @Override
  public ModernPacket template() {
    return new DiskSetNamePacket(getId());
  }

  @Override
  public void processPacket(EntityPlayer player) {
    final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
    if(pipe == null) {
      return;
    }
    if(pipe.pipe instanceof PipeItemsRequestLogisticsMk2) {
      if(((PipeItemsRequestLogisticsMk2)pipe.pipe).getDisk() == null) {
        return;
      }
      if(!((PipeItemsRequestLogisticsMk2)pipe.pipe).getDisk().getItem().equals(LogisticsPipes.LogisticsItemDisk)) {
        return;
      }
      if(!((PipeItemsRequestLogisticsMk2)pipe.pipe).getDisk().hasTagCompound()) {
        ((PipeItemsRequestLogisticsMk2)pipe.pipe).getDisk().setTagCompound(new NBTTagCompound());
      }
      NBTTagCompound nbt = ((PipeItemsRequestLogisticsMk2)pipe.pipe).getDisk().getTagCompound();
      nbt.setString("name", getString());
    }
  }
}
TOP

Related Classes of logisticspipes.network.packets.orderer.DiskSetNamePacket

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.