Search in sources :

Example 6 with PartInfo

use of com.bluepowermod.part.PartInfo in project BluePower by Qmunity.

the class PartConverterLamp method convert.

@Override
public IPart convert(NBTTagCompound old) {
    String id = old.getString("part_id");
    id = id.replace("cagelamp", "cagelamp.").replace("fixture", "fixture.").replace("silver", "light_gray");
    if (id.startsWith("inverted"))
        id = id.substring("inverted".length()) + ".inverted";
    PartInfo info = PartManager.getPartInfo(id);
    if (info == null)
        return null;
    PartLamp part = (PartLamp) info.create();
    NBTTagCompound data = old.getCompoundTag("partData");
    part.setFace(ForgeDirection.getOrientation(data.getInteger("face")));
    return part;
}
Also used : PartLamp(com.bluepowermod.part.lamp.PartLamp) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) PartInfo(com.bluepowermod.part.PartInfo)

Aggregations

PartInfo (com.bluepowermod.part.PartInfo)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 GateBase (com.bluepowermod.part.gate.GateBase)1 PartLamp (com.bluepowermod.part.lamp.PartLamp)1 PneumaticTube (com.bluepowermod.part.tube.PneumaticTube)1 PartRedwireFace (com.bluepowermod.part.wire.redstone.PartRedwireFace)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 ArrayList (java.util.ArrayList)1 TextureMap (net.minecraft.client.renderer.texture.TextureMap)1 ItemStack (net.minecraft.item.ItemStack)1 IPart (uk.co.qmunity.lib.part.IPart)1