diff --git a/pom.xml b/pom.xml index b4c3fca..4438b7a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ne.fnfal113 RelicsOfCthonia - Unofficial-1.6 + Unofficial-1.7 jar RelicsOfCthonia diff --git a/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MiningListener.java b/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MiningListener.java index d851253..868808a 100644 --- a/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MiningListener.java +++ b/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MiningListener.java @@ -26,7 +26,7 @@ public class MiningListener implements Listener { @Getter private final Map> whereToDropMaterialMap = RelicsOfCthonia.getInstance().getRelicsRegistry().getWhereToDropMaterialMap(); - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.MONITOR) public void onBlockBreak(BlockBreakEvent event) { if(event.isCancelled()){ return; @@ -48,6 +48,7 @@ public void onBlockBreak(BlockBreakEvent event) { World world = event.getPlayer().getWorld(); AtomicInteger itemDroppedCounter = new AtomicInteger(0); + ThreadLocalRandom currentRandomThread = ThreadLocalRandom.current(); Utils.createAsyncTask(asyncTask -> { Iterator>> dropIterator = getWhereToDropMaterialMap().entrySet().iterator(); @@ -63,7 +64,9 @@ public void onBlockBreak(BlockBreakEvent event) { } if(pair.getValue().contains(blockBrokeType)) { - double randomNum = ThreadLocalRandom.current().nextDouble(0.0, 100); + // biased probability to lower the chance of repeated values from the current random thread which utilizes same seed + double randomOrigin = currentRandomThread.nextDouble(0.0, 60); + double randomNum = currentRandomThread.nextDouble(randomOrigin, 100); if(randomNum < abstractRelic.getDropChance()) { ItemStack drop = abstractRelic.setRelicConditionAndGet(true, 0); diff --git a/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MobKillListener.java b/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MobKillListener.java index 994063f..68e80f5 100644 --- a/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MobKillListener.java +++ b/src/main/java/ne/fnfal113/relicsofcthonia/listeners/MobKillListener.java @@ -65,6 +65,7 @@ public void onMobKill(EntityDeathEvent event) { String entityType = livingEntity.getType().name().toLowerCase(); World world = livingEntity.getWorld(); AtomicInteger itemDroppedCounter = new AtomicInteger(0); + ThreadLocalRandom currentRandomThread = ThreadLocalRandom.current(); Utils.createAsyncTask(asyncTask -> { Iterator>> dropIterator = getWhereToDropMobMap().entrySet().iterator(); @@ -81,7 +82,9 @@ public void onMobKill(EntityDeathEvent event) { // check if relic mob list contains killed mob type if(pair.getValue().contains(entityType)) { - double randomNum = ThreadLocalRandom.current().nextDouble(0.0, 100); + // biased probability to lower the chance of repeated values from the current random thread which utilizes same seed + double randomOrigin = currentRandomThread.nextDouble(0.0, 60); + double randomNum = ThreadLocalRandom.current().nextDouble(randomOrigin, 100); if(randomNum < abstractRelic.getDropChance()) { ItemStack drop = abstractRelic.setRelicConditionAndGet(true, 0);