Package logisticspipes.network.packets.pipe

Source Code of logisticspipes.network.packets.pipe.InvSysConResistance

package logisticspipes.network.packets.pipe;

import logisticspipes.network.abstractpackets.IntegerCoordinatesPacket;
import logisticspipes.network.abstractpackets.ModernPacket;
import logisticspipes.pipes.PipeItemsInvSysConnector;
import logisticspipes.pipes.basic.LogisticsTileGenericPipe;
import logisticspipes.proxy.MainProxy;
import lombok.experimental.Accessors;
import net.minecraft.entity.player.EntityPlayer;

@Accessors(chain=true)
public class InvSysConResistance extends IntegerCoordinatesPacket {

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

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

  @Override
  public void processPacket(EntityPlayer player) {
    if(MainProxy.isClient(player.worldObj)) {
      final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
      if(pipe == null) {
        return;
      }
      if(pipe.pipe instanceof PipeItemsInvSysConnector) {
        PipeItemsInvSysConnector invCon = (PipeItemsInvSysConnector) pipe.pipe;
        invCon.resistance = getInteger();
      }
    } else {
      final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
      if(pipe == null) {
        return;
      }
      if(pipe.pipe instanceof PipeItemsInvSysConnector) {
        PipeItemsInvSysConnector invCon = (PipeItemsInvSysConnector) pipe.pipe;
        invCon.resistance = getInteger();
        invCon.getRouter().update(true, invCon);
      }
    }
  }
}
TOP

Related Classes of logisticspipes.network.packets.pipe.InvSysConResistance

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.