PrettyPipes/src/main/java/de/ellpeck/prettypipes/network/NetworkLock.java

41 lines
1.1 KiB
Java
Raw Normal View History

package de.ellpeck.prettypipes.network;
2020-05-09 12:57:25 +02:00
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraftforge.common.util.INBTSerializable;
2020-05-09 12:57:25 +02:00
import java.util.Collection;
public class NetworkLock implements INBTSerializable<CompoundNBT> {
public NetworkLocation location;
public int slot;
public int amount;
public NetworkLock(NetworkLocation location, int slot, int amount) {
this.location = location;
this.slot = slot;
this.amount = amount;
}
2020-05-09 12:57:25 +02:00
public NetworkLock(CompoundNBT nbt) {
this.deserializeNBT(nbt);
}
@Override
public CompoundNBT serializeNBT() {
CompoundNBT nbt = new CompoundNBT();
nbt.put("location", this.location.serializeNBT());
nbt.putInt("slot", this.slot);
nbt.putInt("amount", this.amount);
return nbt;
}
@Override
public void deserializeNBT(CompoundNBT nbt) {
this.location = new NetworkLocation(nbt.getCompound("location"));
this.slot = nbt.getInt("slot");
this.amount = nbt.getInt("amount");
}
}