Alex's Mobs

Alex's Mobs

81M Downloads

Acacia Blossom Has No Drop Rate Config, and Drop Chance Unaffected by Looting

stop-x13 opened this issue ยท 0 comments

commented
  1. Acacia blossom drop chance unaffected by looting:
    From what I can see in the code file: src/main/java/com/github/alexthe666/alexsmobs/misc/BlossomLootModifier.java
    protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) { if (AMConfig.acaciaBlossomsDropFromLeaves) { ItemStack ctxTool = context.getParamOrNull(LootContextParams.TOOL); RandomSource random = context.getRandom(); if (ctxTool != null) { int silkTouch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, ctxTool); if (silkTouch > 0 || ctxTool.getItem() instanceof ShearsItem) { return generatedLoot; } } int bonusLevel = ctxTool != null ? EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, ctxTool) : 0; int bananaStep = (int) Math.min(AMConfig.blossomChance * 0.1F, 0); int bananaRarity = AMConfig.blossomChance - (bonusLevel * bananaStep); if (bananaRarity < 1 || random.nextInt(bananaRarity) == 0) { generatedLoot.add(new ItemStack(AMItemRegistry.ACACIA_BLOSSOM.get())); } } return generatedLoot; }
    In this line of code:int bananaStep = (int) Math.min(AMConfig.blossomChance * 0.1F, 0);, bananaStep will always be evaluated to 0 because Math.min(positiveNumber, 0) is 0, also there might be a typo as well, I think supposed to be "blossomStep" right?
    In the next line, int bananaRarity = AMConfig.blossomChance - (bonusLevel * bananaStep);, because in the previous line, bananaStep is 0, so bonusLevel is useless, therefore fortune enchantment is useless.
    I think it is supposed to be Math.max() instead of Math.min().

  2. Acacia blossom drop chance has no config
    There is no blossomChance in the config file. There exist bananaChance = 200 though.
    In src/main/java/com/github/alexthe666/alexsmobs/config/CommonConfig.java
    I can see bananaChance but I can't see blossomChance.
    In src/main/java/com/github/alexthe666/alexsmobs/config/AMConfig.java,
    I can see blossomChance is initialised as blossomChance = 130 which implies that 1/130 drop rate from acacia leaves.