Package logisticspipes.network.packets.modules

Source Code of logisticspipes.network.packets.modules.ProviderModuleMode

package logisticspipes.network.packets.modules;

import java.io.IOException;

import logisticspipes.modules.ModuleProvider;
import logisticspipes.network.LPDataInputStream;
import logisticspipes.network.LPDataOutputStream;
import logisticspipes.network.abstractpackets.ModernPacket;
import logisticspipes.network.abstractpackets.ModuleCoordinatesPacket;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.minecraft.entity.player.EntityPlayer;

@Accessors(chain=true)
public class ProviderModuleMode extends ModuleCoordinatesPacket {

  @Getter
  @Setter
  private int mode;
 
  public ProviderModuleMode(int id) {
    super(id);
  }

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

  @Override
  public void processPacket(EntityPlayer player) {
    final ModuleProvider module = this.getLogisticsModule(player, ModuleProvider.class);
    if(module == null) return;
    module.setExtractionMode(mode);
  }

  @Override
  public void writeData(LPDataOutputStream data) throws IOException {
    super.writeData(data);
    data.writeInt(mode);
  }

  @Override
  public void readData(LPDataInputStream data) throws IOException {
    super.readData(data);
    mode = data.readInt();
  }
}
TOP

Related Classes of logisticspipes.network.packets.modules.ProviderModuleMode

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.