Java IPart类代码示例

本文整理汇总了Java中uk.co.qmunity.lib.part.IPart的典型用法代码示例。如果您正苦于以下问题:Java IPart类的具体用法?Java IPart怎么用?Java IPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java IPart类代码示例

IPart类属于uk.co.qmunity.lib.part包,在下文中一共展示了IPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hasPart

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public boolean hasPart(World world, Location location, String name) {
	TileEntity tileEntity = world.getTileEntity(location.getX(), location.getY(), location.getZ());
	if (tileEntity instanceof TileMultipart) {
		TileMultipart mp = (TileMultipart) tileEntity;
		boolean ret = false;
		List<IPart> t = mp.getParts();
		for (IPart p : t) {
			if (ret == false) {
				if (p.getType().equals(name)) {
					ret = true;
				}
			}
		}
		return ret;
	}
	return false;
} 
开发者ID:modmuss50,项目名称:Network,代码行数:19,代码来源:QModPartFactory.java

示例2: addPart

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void addPart(IPart part) {

    int before = parts.size();

    parts.put(genIdentifier(), part);
    part.setParent(this);

    if (!simulated) {
        if (part instanceof IPartUpdateListener)
            ((IPartUpdateListener) part).onAdded();
        for (IPart p : getParts())
            if (p != part && p instanceof IPartUpdateListener)
                ((IPartUpdateListener) p).onPartChanged(part);

        if (before > 0)
            PartUpdateManager.addPart(this, part);

        markDirty();
        getWorld().markBlockRangeForRenderUpdate(getX(), getY(), getZ(), getX(), getY(), getZ());

        if (!getWorld().isRemote && before > 0)
            getWorld().notifyBlocksOfNeighborChange(getX(), getY(), getZ(), blockType);
    }
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:26,代码来源:TileMultipart.java

示例3: rayTrace

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public QMovingObjectPosition rayTrace(Vec3d start, Vec3d end) {

    QMovingObjectPosition closest = null;
    double dist = Double.MAX_VALUE;

    for (IPart p : getParts()) {
        if (p instanceof IPartSelectable) {
            QMovingObjectPosition mop = ((IPartSelectable) p).rayTrace(start, end);
            if (mop == null)
                continue;
            double d = start.distanceTo(new Vec3d(mop.hitVec));
            if (d < dist) {
                closest = mop;
                dist = d;
            }
        }
    }

    return closest;
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:22,代码来源:TileMultipart.java

示例4: renderTileEntityAt

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float delta) {

    TileMultipart te = (TileMultipart) tile;

    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);
        for (IPart p : te.getParts()) {
            if (p.getParent() != null) {
                GL11.glPushMatrix();

                p.renderDynamic(new Vec3d(0, 0, 0), delta, pass);

                GL11.glPopMatrix();
            }
        }
    }
    GL11.glPopMatrix();
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:21,代码来源:RenderMultipart.java

示例5: getStrongOutput

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
public int getStrongOutput(ForgeDirection direction, ForgeDirection face) {

        int max = 0;

        for (IPart p : getParts()) {
            if (p instanceof IPartRedstone) {
                if (p instanceof IPartFace) {
                    if (((IPartFace) p).getFace() == face)
                        max = Math.max(max, ((IPartRedstone) p).getStrongPower(direction));
                } else {
                    max = Math.max(max, ((IPartRedstone) p).getStrongPower(direction));
                }
            }
        }

        return max;
    } 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:18,代码来源:TileMultipart.java

示例6: getWeakOutput

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
public int getWeakOutput(ForgeDirection direction, ForgeDirection face) {

        int max = 0;

        for (IPart p : getParts()) {
            if (p instanceof IPartRedstone) {
                if (p instanceof IPartFace) {
                    if (((IPartFace) p).getFace() == face)
                        max = Math.max(max, ((IPartRedstone) p).getWeakPower(direction));
                } else {
                    max = Math.max(max, ((IPartRedstone) p).getWeakPower(direction));
                }
            }
        }

        return max;
    } 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:18,代码来源:TileMultipart.java

示例7: canConnect

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
public boolean canConnect(ForgeDirection direction, ForgeDirection face) {

        for (IPart p : getParts()) {
            if (p instanceof IPartRedstone) {
                if (p instanceof IPartFace) {
                    if (((IPartFace) p).getFace() == face)
                        if (((IPartRedstone) p).canConnectRedstone(direction))
                            return true;
                } else {
                    if (((IPartRedstone) p).canConnectRedstone(direction))
                        return true;
                }
            }
        }

        return false;
    } 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:18,代码来源:TileMultipart.java

示例8: handle

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void handle(EntityPlayer player) {

    part = PartRegistry.createPart(type, true);

    MultipartCompatibility.addPartToWorldBruteforce(part, player.worldObj, new Vec3i(x, y, z, player.worldObj));

    holder = part.getParent();
    if (holder == null)
        return;
    Map<String, IPart> map = holder.getPartMap();

    String oldId = null;
    for (String id : holder.getPartMap().keySet())
        if (holder.getPartMap().get(id) == part)
            oldId = id;

    map.remove(oldId);
    map.put(partId, part);

    try {
        part.readUpdateData(new DataInputStream(new ByteArrayInputStream(data)), -1);
    } catch (IOException e) {
        e.printStackTrace();
    }
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:27,代码来源:PacketCAddPart.java

示例9: write

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void write(DataOutput buffer) throws IOException {

    super.write(buffer);

    String partId = null;
    Map<String, IPart> parts = holder.getPartMap();
    for (String id : parts.keySet()) {
        if (parts.get(id) == part) {
            partId = id;
            break;
        }
    }
    if (partId == null) {
        buffer.writeBoolean(false);
        return;
    }
    buffer.writeBoolean(true);
    buffer.writeUTF(partId);

    writeData(buffer);
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:23,代码来源:PacketCPart.java

示例10: save

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void save(NBTTagCompound tag) {

    super.save(tag);

    NBTTagList l = new NBTTagList();
    for (Entry<String, IPart> e : getPartMap().entrySet()) {
        NBTTagCompound t = new NBTTagCompound();

        t.setString("id", e.getKey());
        t.setString("type", e.getValue().getType());
        NBTTagCompound data = new NBTTagCompound();
        e.getValue().writeToNBT(data);
        t.setTag("data", data);

        l.appendTag(t);
    }
    tag.setTag("parts", l);
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:20,代码来源:FMPPart.java

示例11: writeDesc

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void writeDesc(MCDataOutput packet) {

    super.writeDesc(packet);

    FMPDataOutput buffer = new FMPDataOutput(packet);

    try {
        buffer.writeInt(getPartMap().size());

        for (Entry<String, IPart> e : getPartMap().entrySet()) {
            buffer.writeUTF(e.getKey());
            buffer.writeUTF(e.getValue().getType());
            e.getValue().writeUpdateData(buffer, -1);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:20,代码来源:FMPPart.java

示例12: addPart

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public void addPart(IPart part) {

    int before = parts.size();

    parts.put(genIdentifier(), part);
    part.setParent(this);

    if (!simulated) {
        if (part instanceof IPartUpdateListener)
            ((IPartUpdateListener) part).onAdded();
        for (IPart p : getParts())
            if (p != part && p instanceof IPartUpdateListener)
                ((IPartUpdateListener) p).onPartChanged(part);

        if (before > 0)
            PartUpdateManager.addPart(this, part);

        if (tile() != null) {
            tile().markDirty();
            getWorld().markBlockRangeForRenderUpdate(getX(), getY(), getZ(), getX(), getY(), getZ());
            if (!getWorld().isRemote && before > 0)
                getWorld().notifyBlocksOfNeighborChange(getX(), getY(), getZ(), tile().blockType);
        }
    }
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:27,代码来源:FMPPart.java

示例13: renderDynamic

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Vector3 pos, float frame, int pass) {

    GL11.glPushMatrix();
    {
        GL11.glTranslated(pos.x, pos.y, pos.z);
        for (IPart p : getParts()) {
            if (p.getParent() != null) {
                GL11.glPushMatrix();

                if (p.shouldRenderOnPass(pass))
                    p.renderDynamic(new Vec3d(0, 0, 0), frame, pass);

                GL11.glPopMatrix();
            }
        }
    }
    GL11.glPopMatrix();
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:21,代码来源:FMPPart.java

示例14: getDrops

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {

    ArrayList<ItemStack> l = new ArrayList<ItemStack>();

    TileMultipart te = get(world, x, y, z);
    if (te != null) {
        for (IPart p : te.getParts()) {
            List<ItemStack> d = p.getDrops();
            if (d != null)
                l.addAll(d);
        }
    }

    return l;
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:17,代码来源:BlockMultipart.java

示例15: addPartToWorldBruteforce

import uk.co.qmunity.lib.part.IPart; //导入依赖的package包/类
@Override
public boolean addPartToWorldBruteforce(IPart part, World world, Vec3i location) {

    BlockCoord b = new BlockCoord(location.getX(), location.getY(), location.getZ());
    TileMultipart tmp = TileMultipart.getOrConvertTile(world, b);
    if (tmp == null)
        return false;

    FMPPart p = (FMPPart) getPartHolder(world, location);
    boolean isNew = false;
    if (p == null) {
        p = new FMPPart();
        isNew = true;
    }

    p.addPart(part);

    if (isNew && !world.isRemote)
        TileMultipart.addPart(world, b, p);

    return true;
} 
开发者ID:Qmunity,项目名称:QmunityLib,代码行数:23,代码来源:FMPCompat.java

本文标签属性:

示例:示例英语

代码:代码生成器

java:java自行车

IPart:iparty是什么意思

上一篇:Java DataAccessUtils.uniqueResult方法代码示例
下一篇:美09年开始入侵华为

为您推荐