I tried to decrease chances with this code it works but only for offer showings. How can I change the result ? Please help me Code (Text): p=enchantmentTable.getEnchanter(); if (enchantmentTable.getOffers() != null){ if (enchantmentTable.getItem() != null){ inputItem= enchantmentTable.getItem(); } newInventory=enchantmentTable; offerList= enchantmentTable.getOffers(); for (int i=0; i<offerList.length ; i++) { if (offerList[i] != null){ if (offerList[i].getEnchantmentLevel() >=5){ if (luck< development.fiveLevelChance){ continue; }else{ offerList[i].setEnchantmentLevel(offerList[i].getEnchantmentLevel() -1); } } if (offerList[i].getEnchantmentLevel() ==4){ if (luck< development.fourLevelChance){ continue; }else{ offerList[i].setEnchantmentLevel(offerList[i].getEnchantmentLevel() -1); } } if (offerList[i].getEnchantmentLevel() ==3){ if (luck< development.threeLevelChance){ continue; }else{ offerList[i].setEnchantmentLevel(offerList[i].getEnchantmentLevel() -1); } } } } newInventory= new PrepareItemEnchantEvent(enchantmentTable.getEnchanter(), enchantmentTable.getView(), enchantmentTable.getEnchantBlock(), enchantmentTable.getItem(), offerList, enchantmentTable.getEnchantmentBonus()); enchantmentTable=newInventory; }
Offers are just previews. When I change the offer result doesn't change. For example with this code I put my diamond sword to enchament table and I saw Sharpness 2 instead of Sharpness 5. But when I click to the offer end get the Item i see Sharpness 5 sword. I want to change this Sharpness 5 result to Sharpness 2 if offer shows so.