Package net.minecraft.server.v1_7_R4

Examples of net.minecraft.server.v1_7_R4.Block


    public static String getCustomNBT(LivingEntity entity, String key) {
        if (entity == null) return null;
        Entity bukkitEntity = entity;
        net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
        NBTTagCompound tag = new NBTTagCompound();

        // Writes the entity's NBT data to tag
        nmsEntity.c(tag);

        // Return contents of the tag
        return tag.getString(key);
    }
View Full Code Here


     * custom NBT.
     */

    public static boolean hasCustomNBT(ItemStack item, String key) {
        if (item == null) return false;
        NBTTagCompound tag;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        if (!cis.hasTag()) return false;
        tag = cis.getTag();
        // dB.echoDebug(tag.toString());
        // if this item has the NBTData for 'owner', there is an engraving.
        return tag.hasKey(key);
    }
View Full Code Here

    }

    public static String getCustomNBT(ItemStack item, String key) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag;
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        // if this item has the NBTData for 'owner', return the value, which is the playername of the 'owner'.
        if (tag.hasKey(key)) return tag.getString(key);
        return null;

    }
View Full Code Here

    }

    public static ItemStack removeCustomNBT(ItemStack item, String key) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag;
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        // remove 'owner' NBTData
        tag.remove(key);
        return CraftItemStack.asCraftMirror(cis);
    }
View Full Code Here

    }

    public static ItemStack addCustomNBT(ItemStack item, String key, String value) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag = null;
        // Do stuff with tag
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        tag.setString(key, value);
        return CraftItemStack.asCraftMirror(cis);
    }
View Full Code Here

    public static LivingEntity addCustomNBT(LivingEntity entity, String key, String value) {
        if (entity == null) return null;
        Entity bukkitEntity = entity;
        net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
        NBTTagCompound tag = new NBTTagCompound();

        // Writes the entity's NBT data to tag
        nmsEntity.c(tag);

        // Add custom NBT
        tag.setString(key, value);

        // Write tag back
        ((EntityLiving)nmsEntity).a(tag);
        return entity;
    }
View Full Code Here

    public static LivingEntity removeCustomNBT(LivingEntity entity, String key) {
        if (entity == null) return null;
        Entity bukkitEntity = entity;
        net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
        NBTTagCompound tag = new NBTTagCompound();

        // Writes the entity's NBT data to tag
        nmsEntity.c(tag);

        // Remove custom NBT
        tag.remove(key);

        // Write tag back
        ((EntityLiving)nmsEntity).a(tag);
        return entity;
    }
View Full Code Here

        }
        return metaPacket;
    }

    public static PacketPlayInClientCommand getRespawnPacket() {
        PacketPlayInClientCommand ccommandPacket = new PacketPlayInClientCommand();
        try {
            ccommand_command.set(ccommandPacket, EnumClientCommand.PERFORM_RESPAWN);
        } catch (Exception e) {
            dB.echoError(e);
        }
View Full Code Here

        switch (ChestAction.valueOf(action.asString().toUpperCase())) {
            case OPEN:
                for (dPlayer player: players) {
                    if (sound.asBoolean()) player.getPlayerEntity().playSound(location, Sound.CHEST_OPEN, 1, 1);
                    ((CraftPlayer)player.getPlayerEntity()).getHandle().playerConnection.sendPacket(
                            new PacketPlayOutBlockAction(location.getBlockX(), location.getBlockY(), location.getBlockZ(),
                            ((CraftWorld) location.getWorld()).getHandle().getType(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 1, 1));
                }
                break;

            case CLOSE:
                for (dPlayer player: players) {
                    if (sound.asBoolean()) player.getPlayerEntity().getWorld().playSound(location, Sound.CHEST_CLOSE, 1, 1);
                    ((CraftPlayer)player.getPlayerEntity()).getHandle().playerConnection.sendPacket(
                            new PacketPlayOutBlockAction(location.getBlockX(), location.getBlockY(), location.getBlockZ(),
                            ((CraftWorld)location.getWorld()).getHandle().getType(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 1, 0));
                }
                break;
        }
    }
View Full Code Here

        }
        return mobPacket;
    }

    public static PacketPlayOutEntityDestroy getDestroyEntityPacket() {
        PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy();
        try {
            destroy_entityList.set(destroyPacket, new int[]{ENTITY_ID});
        } catch (Exception e) {
            dB.echoError(e);
        }
View Full Code Here

TOP

Related Classes of net.minecraft.server.v1_7_R4.Block

Copyright © 2018 www.massapicom. 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.