Search in sources :

Example 1 with GateBase

use of com.bluepowermod.part.gate.GateBase in project BluePower by Qmunity.

the class PartConverterGate method convert.

@Override
public IPart convert(NBTTagCompound old) {
    String id = old.getString("part_id");
    PartInfo info = PartManager.getPartInfo(id);
    if (info == null)
        return null;
    IPart p = info.create();
    if (!(p instanceof GateBase<?, ?, ?, ?, ?, ?>))
        return null;
    GateBase<?, ?, ?, ?, ?, ?> part = (GateBase<?, ?, ?, ?, ?, ?>) p;
    NBTTagCompound data = old.getCompoundTag("partData");
    part.readFromNBT(data);
    part.setRotation(data.getInteger("rotation") + 2);
    return part;
}
Also used : IPart(uk.co.qmunity.lib.part.IPart) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) PartInfo(com.bluepowermod.part.PartInfo) GateBase(com.bluepowermod.part.gate.GateBase)

Aggregations

PartInfo (com.bluepowermod.part.PartInfo)1 GateBase (com.bluepowermod.part.gate.GateBase)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 IPart (uk.co.qmunity.lib.part.IPart)1