Package net.minecraft.server.v1_7_R4

Examples of net.minecraft.server.v1_7_R4.EntityLiving


        }
        return destroyPacket;
    }

    public static PacketPlayOutEntityMetadata getMetadataPacket(DataWatcher watcher) {
        PacketPlayOutEntityMetadata metaPacket = new PacketPlayOutEntityMetadata();
        try {
            metadata_entityId.set(metaPacket, ENTITY_ID);
            metadata_data.set(metaPacket, watcher.c());
        } catch (Exception e) {
            dB.echoError(e);
View Full Code Here


            @Override
            public void run() {
                if ((loadUp ? health < 300 : health > 0)) {
                    DataWatcher watcher = getWatcher(text, health);
                    PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
                    PacketHelper.sendPacket(player, metaPacket);
                    if (loadUp) {
                        health += healthAdd;
                    } else {
                        health -= healthAdd;
                    }
                } else {
                    DataWatcher watcher = getWatcher(text, (loadUp ? 300 : 0));
                    PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
                    PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
                    PacketHelper.sendPacket(player, metaPacket);
                    PacketHelper.sendPacket(player, destroyEntityPacket);
                    hasHealthBar.put(player.getName(), false);
//Complete text
                    PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, player.getLocation(), 200);
                    PacketHelper.sendPacket(player, mobPacket);
                    hasHealthBar.put(player.getName(), true);
                    DataWatcher watcher2 = getWatcher(completeText, 300);
                    PacketPlayOutEntityMetadata metaPacket2 = getMetadataPacket(watcher2);
                    PacketHelper.sendPacket(player, metaPacket2);
                    new BukkitRunnable() {
                        @Override
                        public void run() {
                            PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
View Full Code Here

        health_food = fields.get("b");
        health_saturation = fields.get("c");
    }

    public static PacketPlayOutExperience getExperiencePacket(float exp, int level) {
        PacketPlayOutExperience experiencePacket = new PacketPlayOutExperience();
        try {
            xp_current.set(experiencePacket, exp);
            // xp_total.set(experiencePacket, totalExp);
            xp_level.set(experiencePacket, level);
        } catch (Exception e) {
View Full Code Here

        PacketPlayOutUpdateHealth healthPacket = getHealthPacket(health, food, food_saturation);
        PacketHelper.sendPacket(player, healthPacket);
    }

    public static void showExperience(Player player, float experience, int level) {
        PacketPlayOutExperience experiencePacket = getExperiencePacket(experience, level);
        PacketHelper.sendPacket(player, experiencePacket);
    }
View Full Code Here

        PacketPlayOutExperience experiencePacket = getExperiencePacket(experience, level);
        PacketHelper.sendPacket(player, experiencePacket);
    }

    public static void resetExperience(Player player) {
        PacketPlayOutExperience experiencePacket = getExperiencePacket(player.getExp(), player.getLevel());
        PacketHelper.sendPacket(player, experiencePacket);
    }
View Full Code Here

    }

    @Override
    public void handlePacket(Object packet, Player destination) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
        if (packet instanceof PacketPlayOutNamedEntitySpawn) {
            final PacketPlayOutNamedEntitySpawn p = (PacketPlayOutNamedEntitySpawn) packet;
            final GameProfile profile = (GameProfile) this.gameProfileField.get(p);
            final String oldName = profile.getName();
            final UUID oldID = profile.getId();
            final TagInfo newName = this.handler.getNameForPacket20(oldID, this.entityIDField.getInt(p), oldName, destination);
            if (newName != null && !newName.getName().equals(oldName)) {
View Full Code Here

    }

    private static final Map<UUID, Integer> slotChanged = new HashMap<UUID, Integer>();

    public static PacketPlayOutSetSlot getSlotPacket(UUID player, int nmsSlot, ItemStack item) {
        PacketPlayOutSetSlot slotPacket = new PacketPlayOutSetSlot();
        try{
            slot_inventoryId.set(slotPacket, 0);
            slotChanged.put(player, nmsSlot);
            slot_slotId.set(slotPacket, nmsSlot);
            slot_item.set(slotPacket, CraftItemStack.asNMSCopy(item));
View Full Code Here

        else
            item = item.clone();
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(message);
        item.setItemMeta(meta);
        PacketPlayOutSetSlot slotPacket = getSlotPacket(player.getUniqueId(),
                player.getInventory().getHeldItemSlot() + 36, item);
        PacketHelper.sendPacket(player, slotPacket);
    }
View Full Code Here

    public static void resetItem(Player player) {
        if (player == null) return;
        UUID uuid = player.getUniqueId();
        if (slotChanged.containsKey(uuid)) {
            PacketPlayOutSetSlot slotPacket = getSlotPacket(uuid, slotChanged.get(uuid), player.getItemInHand());
            PacketHelper.sendPacket(player, slotPacket);
            slotChanged.remove(uuid);
        }
    }
View Full Code Here

    }

    //Accessing packets
    @SuppressWarnings("deprecation")
    public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, Location loc, int health) {
        PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
        try {
            spawn_entityId.set(mobPacket, ENTITY_ID);
            spawn_entityType.set(mobPacket, (byte) EntityType.ENDER_DRAGON.getTypeId());
            spawn_locationX.set(mobPacket, (int) Math.floor(loc.getBlockX() * 32.0D));
            spawn_locationY.set(mobPacket, -256 * 32);
 
View Full Code Here

TOP

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

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.