Package net.minecraft.entity.passive

Examples of net.minecraft.entity.passive.EntityVillager


          InventoryBaubles binv = PlayerHandler.getPlayerBaubles(player_);
          if(scanInventory(inv, pstack) || scanInventory(binv, pstack))
            positionsBuilder.append(player_.getEntityId()).append(";");

        } else if(e instanceof EntityVillager) {
          EntityVillager villager = (EntityVillager) e;
          ArrayList<MerchantRecipe> recipes = villager.getRecipes(player);
          if(pstack != null)
            for(MerchantRecipe recipe : recipes)
              if(!recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell())))
                positionsBuilder.append(villager.getEntityId()).append(";");

        } else if(e instanceof EntityLivingBase) {
          EntityLivingBase living = (EntityLivingBase) e;
          ItemStack estack = living.getEquipmentInSlot(0);
          if(pstack != null && estack != null && equalStacks(estack, pstack))
View Full Code Here


        this.tile = tile;

        label = tile.getName();

        villager = new EntityVillager(tile.getWorld());

        for (int prof = 0; prof < 5; prof++) {
            professions.add(prof);
        }
        professions.addAll(VillagerRegistry.getRegisteredVillagers());
View Full Code Here

    public GuiDetectorVillager(TileDetector t) {
        super(t.getName(), RailcraftConstants.GUI_TEXTURE_FOLDER + "gui_detector_villager.png", 176, 105);
        this.tile = t;
        this.detector = (DetectorVillager) tile.getDetector();
        villager = new EntityVillager(tile.getWorld());
        mode = detector.getMode();

        for (int prof = 0; prof < 5; prof++) {
            professions.add(prof);
        }
View Full Code Here

    }

    private boolean cartHasProfesion(List<EntityMinecart> carts) {
        for (EntityMinecart cart : carts) {
            if (cart.riddenByEntity instanceof EntityVillager) {
                EntityVillager villager = (EntityVillager) cart.riddenByEntity;
                if (villager.getProfession() == profession)
                    return true;
            }
        }
        return false;
    }
View Full Code Here

                break;
        }
    }

    public void nextTrade(int tradeSet) {
        EntityVillager villager = new EntityVillager(worldObj);
        villager.setProfession(profession);
        MerchantRecipeList recipes = villager.getRecipes(null);
        MerchantRecipe recipe = (MerchantRecipe) recipes.get(MiscTools.RANDOM.nextInt(recipes.size()));
        recipeSlots.setInventorySlotContents(tradeSet * 3 + 0, recipe.getItemToBuy());
        recipeSlots.setInventorySlotContents(tradeSet * 3 + 1, recipe.getSecondItemToBuy());
        recipeSlots.setInventorySlotContents(tradeSet * 3 + 2, recipe.getItemToSell());
    }
View Full Code Here

            if(getPressure(ForgeDirection.UNKNOWN) > PneumaticValues.MAX_PRESSURE_LIVING_ENTITY) {
                AxisAlignedBB bbBox = AxisAlignedBB.getBoundingBox(multiBlockX + 1, multiBlockY + 1, multiBlockZ + 1, multiBlockX + multiBlockSize - 1, multiBlockY + multiBlockSize - 1, multiBlockZ + multiBlockSize - 1);
                List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bbBox);
                for(EntityLivingBase entity : entities) {
                    if(entity instanceof EntityVillager) {
                        EntityVillager villager = (EntityVillager)entity;
                        if(villager.getProfession() != Config.villagerMechanicID) {
                            villager.setProfession(Config.villagerMechanicID);
                            NBTTagCompound tag = new NBTTagCompound();
                            villager.writeEntityToNBT(tag);
                            if(tag.hasKey("Offers")) {//reset the trade list
                                tag.removeTag("Offers");
                                villager.readEntityFromNBT(tag);
                            }
                        }
                    }
                    entity.attackEntityFrom(DamageSourcePneumaticCraft.pressure, (int)(getPressure(ForgeDirection.UNKNOWN) * 2D));
                }
View Full Code Here

    private void handleVillagers(int x, int y, List<IWidget> locatedTextures){
        locatedTextures.add(new LocatedEntity(EntityVillager.class, x + 70, y + 95, 2F));

        LocatedEntity locatedEntity = new LocatedEntity(EntityVillager.class, x + 215, y + 125, 2F);
        EntityVillager villager = (EntityVillager)locatedEntity.entity;
        villager.setProfession(Config.villagerMechanicID);
        locatedTextures.add(locatedEntity);
    }
View Full Code Here

TOP

Related Classes of net.minecraft.entity.passive.EntityVillager

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.