public boolean hasRelevantEnchantmentType(EnumEnchantmentType enchantmentType) { if (this.enchantmentTypes == null) { return false; } else { for (EnumEnchantmentType enumenchantmenttype : this.enchantmentTypes) { if (enumenchantmenttype == enchantmentType) { return true; } } return false; } }
/** * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. */ public void addEnchantmentBooksToList(List<ItemStack> itemList, EnumEnchantmentType... enchantmentType) { for (Enchantment enchantment : Enchantment.enchantmentsBookList) { if (enchantment != null && enchantment.type != null) { boolean flag = false; for (int i = 0; i < enchantmentType.length && !flag; ++i) { if (enchantment.type == enchantmentType[i]) { flag = true; } } if (flag) { itemList.add(Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); } } } }
/** * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. */ public void addEnchantmentBooksToList(List<ItemStack> itemList, EnumEnchantmentType... enchantmentType) { for (Enchantment enchantment : Enchantment.REGISTRY) { if (enchantment != null && enchantment.type != null) { boolean flag = false; for (int i = 0; i < enchantmentType.length && !flag; ++i) { if (enchantment.type == enchantmentType[i]) { flag = true; } } if (flag) { itemList.add(Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); } } } }
@SideOnly(Side.CLIENT) public boolean hasRelevantEnchantmentType(EnumEnchantmentType enchantmentType) { if (this.enchantmentTypes == null) { return false; } else { for (EnumEnchantmentType enumenchantmenttype : this.enchantmentTypes) { if (enumenchantmenttype == enchantmentType) { return true; } } return false; } }
/** * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. */ @SideOnly(Side.CLIENT) public void addEnchantmentBooksToList(List<ItemStack> itemList, EnumEnchantmentType... enchantmentType) { for (Enchantment enchantment : Enchantment.REGISTRY) { if (enchantment != null && enchantment.type != null) { boolean flag = false; for (int i = 0; i < enchantmentType.length && !flag; ++i) { if (enchantment.type == enchantmentType[i]) { flag = true; } } if (flag) { itemList.add(Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); } } } }
public boolean func_111226_a(EnumEnchantmentType par1EnumEnchantmentType) { if (this.field_111230_s == null) { return false; } else { EnumEnchantmentType[] var2 = this.field_111230_s; int var3 = var2.length; for (int var4 = 0; var4 < var3; ++var4) { EnumEnchantmentType var5 = var2[var4]; if (var5 == par1EnumEnchantmentType) { return true; } } return false; } }
@Override public boolean validItemsNearby() { ArrayList<EntityItem> items = (ArrayList<EntityItem>) worldObj.getEntitiesWithinAABB(EntityItem.class, PosUtil.getBoundingBox(getPos(), 3)); for (EntityItem item : items) { ItemStack toolStack = item.getEntityItem(); if (EnumEnchantmentType.DIGGER.canEnchantItem(toolStack.getItem()) || EnumEnchantmentType.WEAPON.canEnchantItem(toolStack.getItem())) { ArrayList<EntityItem> nextItems = (ArrayList<EntityItem>) worldObj.getEntitiesWithinAABB(EntityItem.class, PosUtil.getBoundingBox(getPos(), 3)); for (EntityItem ingot : nextItems) { if (ingot.getEntityItem().getItem() instanceof ItemMaterial && ((ItemMaterial) ingot.getEntityItem().getItem()).materialIndex == 0) { return true; } } } } return false; }
@Override public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment) { if (enchantment.type == EnumEnchantmentType.ALL || enchantment.type == EnumEnchantmentType.BREAKABLE) { return true; } switch (ToolType.fromStack(stackTool)) { case SHOVEL: case PICKAXE: return enchantment.type == EnumEnchantmentType.DIGGER; case AXE: return enchantment.type == EnumEnchantmentType.WEAPON || enchantment.type == EnumEnchantmentType.DIGGER; case HOE: default: return false; } }
@SideOnly(Side.CLIENT) public boolean func_111226_a(EnumEnchantmentType p_111226_1_) { if (this.field_111230_s == null) { return false; } else { EnumEnchantmentType[] aenumenchantmenttype = this.field_111230_s; int i = aenumenchantmenttype.length; for (int j = 0; j < i; ++j) { EnumEnchantmentType enumenchantmenttype1 = aenumenchantmenttype[j]; if (enumenchantmenttype1 == p_111226_1_) { return true; } } return false; } }
@SideOnly(Side.CLIENT) public boolean func_111226_a(EnumEnchantmentType p_111226_1_) { if(this.field_111230_s == null) { return false; } else { EnumEnchantmentType[] var2 = this.field_111230_s; int var3 = var2.length; for(int var4 = 0; var4 < var3; ++var4) { EnumEnchantmentType var5 = var2[var4]; if(var5 == p_111226_1_) { return true; } } return false; } }
@SideOnly(Side.CLIENT) public void func_92116_a(List p_92116_1_, EnumEnchantmentType ... p_92116_2_) { Enchantment[] var3 = Enchantment.field_77331_b; int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Enchantment var6 = var3[var5]; if(var6 != null && var6.field_77351_y != null) { boolean var7 = false; for(int var8 = 0; var8 < p_92116_2_.length && !var7; ++var8) { if(var6.field_77351_y == p_92116_2_[var8]) { var7 = true; } } if(var7) { p_92116_1_.add(Item.field_92105_bW.func_92111_a(new EnchantmentData(var6, var6.func_77325_b()))); } } } }
@SideOnly(Side.CLIENT) public boolean func_111226_a(EnumEnchantmentType par1EnumEnchantmentType) { if (this.field_111230_s == null) { return false; } else { EnumEnchantmentType[] aenumenchantmenttype = this.field_111230_s; int i = aenumenchantmenttype.length; for (int j = 0; j < i; ++j) { EnumEnchantmentType enumenchantmenttype1 = aenumenchantmenttype[j]; if (enumenchantmenttype1 == par1EnumEnchantmentType) { return true; } } return false; } }
public AlchemyEnchantment(String name, Rarity rarity, EnumEnchantmentType type, int max_level, EntityEquipmentSlot... slots) { super(rarity, type, slots); this.max_level = max_level; //setTreasureEnchantment(); setName(name); setRegistryName(name); register(); }
public ItemAttributeModifier( String name, EnumEnchantmentType theSlot, EnumChatFormatting theFormat, int theFrontCol, int theBackCol, int theMax, IAttribute theAttr, int theOper, double theValue, String theId ) { super( name ); slot = theSlot; format = theFormat; frontCol = theFrontCol; backCol = theBackCol; maxLevel = theMax; attr = theAttr; oper = theOper; perLevel = theValue; attrModId = UUID.fromString( theId ); }
/** * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. */ public void addEnchantmentBooksToList(List par1List, EnumEnchantmentType ... par2ArrayOfEnumEnchantmentType) { Enchantment[] var3 = Enchantment.enchantmentsList; int var4 = var3.length; for (int var5 = 0; var5 < var4; ++var5) { Enchantment var6 = var3[var5]; if (var6 != null && var6.type != null) { boolean var7 = false; for (int var8 = 0; var8 < par2ArrayOfEnumEnchantmentType.length && !var7; ++var8) { if (var6.type == par2ArrayOfEnumEnchantmentType[var8]) { var7 = true; } } if (var7) { par1List.add(Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(var6, var6.getMaxLevel()))); } } } }
@SuppressWarnings("unchecked") @Override public void onUsePower() { // AuraCascade.analytics.eventDesign("consumerEnchant", AuraUtil.formatLocation(this)); ArrayList<EntityItem> items = (ArrayList<EntityItem>) worldObj.getEntitiesWithinAABB(EntityItem.class, PosUtil.getBoundingBox(getPos(), 3)); for (EntityItem item : items) { ItemStack toolStack = item.getEntityItem(); if (EnumEnchantmentType.DIGGER.canEnchantItem(toolStack.getItem()) || EnumEnchantmentType.WEAPON.canEnchantItem(toolStack.getItem())) { ArrayList<EntityItem> nextItems = (ArrayList<EntityItem>) worldObj.getEntitiesWithinAABB(EntityItem.class, PosUtil.getBoundingBox(getPos(), 3)); for (EntityItem ingot : nextItems) { if (ingot.getEntityItem().getItem() instanceof ItemMaterial && ((ItemMaterial) ingot.getEntityItem().getItem()).materialIndex == 0) { ItemStack ingotStack = ingot.getEntityItem(); EnumRainbowColor aura = ((ItemMaterial) ingotStack.getItem()).color; Enchantment enchant = getEnchantFromAura(aura); if (enchant != null) { int level = EnchantmentHelper.getEnchantmentLevel(enchant, toolStack); if (isSuccessful(toolStack)) { @SuppressWarnings("rawtypes") Map enchantMap = EnchantmentHelper.getEnchantments(toolStack); enchantMap.put(Enchantment.getEnchantmentID(enchant), level + 1); EnchantmentHelper.setEnchantments(enchantMap, toolStack); } ingotStack.stackSize--; AuraCascade.proxy.networkWrapper.sendToAllAround(new PacketBurst(1, item.posX, item.posY, item.posZ), new NetworkRegistry.TargetPoint(worldObj.provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 32)); if (ingotStack.stackSize <= 0) { ingot.setDead(); } return; } } } } } }
@Override public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment) { return enchantment.type == EnumEnchantmentType.ALL || enchantment.type == EnumEnchantmentType.BREAKABLE || enchantment.type == EnumEnchantmentType.DIGGER; }
@Override public boolean canApplyEnchantment(ItemStack stackTool, Enchantment enchantment) { return enchantment.type == EnumEnchantmentType.ALL || enchantment.type == EnumEnchantmentType.BREAKABLE || enchantment.type == EnumEnchantmentType.WEAPON; }
@SideOnly(Side.CLIENT) public void addEnchantmentBooksToList(List p_92116_1_, EnumEnchantmentType ... p_92116_2_) { Enchantment[] aenchantment = Enchantment.enchantmentsList; int i = aenchantment.length; for (int j = 0; j < i; ++j) { Enchantment enchantment = aenchantment[j]; if (enchantment != null && enchantment.type != null) { boolean flag = false; for (int k = 0; k < p_92116_2_.length && !flag; ++k) { if (enchantment.type == p_92116_2_[k]) { flag = true; } } if (flag) { p_92116_1_.add(Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); } } } }
public ToolShovel() { super(); this.vanillaEquivalent = new ItemSpade(ToolMaterial.EMERALD) { }; this.vanillaEquivalent.setUnlocalizedName("shovelDiamond") .setTextureName("diamond_shovel"); GameRegistry.registerItem(this.vanillaEquivalent, "dummy_shovel"); this.allowedEnchants.add(EnumEnchantmentType.digger); this.allowedEnchants.remove(EnumEnchantmentType.weapon); }
public ToolAxe() { super(); this.vanillaEquivalent = new ItemAxe(ToolMaterial.EMERALD) { }; this.vanillaEquivalent.setUnlocalizedName("hatchetDiamond") .setTextureName("diamond_axe"); GameRegistry.registerItem(this.vanillaEquivalent, "dummy_axe"); this.allowedEnchants.add(EnumEnchantmentType.digger); }
public ToolPickaxe() { super(); this.vanillaEquivalent = new ItemPickaxe(ToolMaterial.EMERALD) { }; this.vanillaEquivalent.setUnlocalizedName("pickaxeDiamond") .setTextureName("diamond_pickaxe"); GameRegistry.registerItem(this.vanillaEquivalent, "dummy_pickaxe"); this.allowedEnchants.add(EnumEnchantmentType.digger); }
public ToolBase() { super(); this.setUnlocalizedName("ToolBase"); this.setCreativeTab(RubedoCore.creativeTabTools); this.setFull3D(); this.maxStackSize = 1; this.setNoRepair(); this.canRepair = false; this.allowedEnchants.add(EnumEnchantmentType.all); this.allowedEnchants.add(EnumEnchantmentType.breakable); this.allowedEnchants.add(EnumEnchantmentType.weapon); }
protected Enchantment(int p_i1926_1_, int p_i1926_2_, EnumEnchantmentType p_i1926_3_) { this.field_77352_x = p_i1926_1_; this.field_77333_a = p_i1926_2_; this.field_77351_y = p_i1926_3_; if(field_77331_b[p_i1926_1_] != null) { throw new IllegalArgumentException("Duplicate enchantment id!"); } else { field_77331_b[p_i1926_1_] = this; } }
public EnchantmentProtection(int p_i1936_1_, int p_i1936_2_, int p_i1936_3_) { super(p_i1936_1_, p_i1936_2_, EnumEnchantmentType.armor); this.field_77356_a = p_i1936_3_; if(p_i1936_3_ == 2) { this.field_77351_y = EnumEnchantmentType.armor_feet; } }
protected EnchantmentLootBonus(int p_i1934_1_, int p_i1934_2_, EnumEnchantmentType p_i1934_3_) { super(p_i1934_1_, p_i1934_2_, p_i1934_3_); this.func_77322_b("lootBonus"); if(p_i1934_3_ == EnumEnchantmentType.digger) { this.func_77322_b("lootBonusDigger"); } }
@SideOnly(Side.CLIENT) /** * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. */ public void addEnchantmentBooksToList(List par1List, EnumEnchantmentType ... par2ArrayOfEnumEnchantmentType) { Enchantment[] aenchantment = Enchantment.enchantmentsList; int i = aenchantment.length; for (int j = 0; j < i; ++j) { Enchantment enchantment = aenchantment[j]; if (enchantment != null && enchantment.type != null) { boolean flag = false; for (int k = 0; k < par2ArrayOfEnumEnchantmentType.length && !flag; ++k) { if (enchantment.type == par2ArrayOfEnumEnchantmentType[k]) { flag = true; } } if (flag) { par1List.add(Item.enchantedBook.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); } } } }
public BaseEnchantment(Rarity weight, int limit, int progress, int range) { super(weight, EnumEnchantmentType.ALL, HANDS); if (limit > 1) this.max = limit; else this.max = 1; if (progress > 1) this.enchantCoeff = progress; else this.enchantCoeff = 1; if (range > 0) this.range = range; else this.range = 0; }
public BaseEnchantment(Rarity weight, int coeff, int rng){ super(weight, EnumEnchantmentType.BOW, HANDS); this.max = 1; if (coeff > 1) this.enchantCoeff = coeff; else this.enchantCoeff = 1; if (range > 0) this.range = rng; else this.range = 0; }
@Override public boolean canApplyAtEnchantingTable(ItemStack stack) { if (stack.getItem() instanceof IEnchantable) { return ((IEnchantable) stack.getItem()).isEnchantable(this, stack); } if(type == EnumEnchantmentType.BOW && BattlegearUtils.isBow(stack.getItem())){ return true; } return type != EnumEnchantmentType.ALL && super.canApplyAtEnchantingTable(stack); }