diff --git a/src/main/java/magicbees/bees/allele/effect/AlleleEffectCrumbling.java b/src/main/java/magicbees/bees/allele/effect/AlleleEffectCrumbling.java index 518b330c..87564bd7 100644 --- a/src/main/java/magicbees/bees/allele/effect/AlleleEffectCrumbling.java +++ b/src/main/java/magicbees/bees/allele/effect/AlleleEffectCrumbling.java @@ -59,13 +59,17 @@ protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedDat IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); // Get random coords within territory - int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); - int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); - int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]); + int[] randomCoords = new int[3]; + for (int i = 0; i < 3; i++) { + int range = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[i]); + if (range > 0) { + randomCoords[i] = world.rand.nextInt(range) - range / 2; + } + } - int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2; - int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2; - int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2; + int xCoord = coords.posX + randomCoords[0]; + int yCoord = coords.posY + randomCoords[1]; + int zCoord = coords.posZ + randomCoords[2]; Block block = world.getBlock(xCoord, yCoord, zCoord); if (block != null) { diff --git a/src/main/java/magicbees/bees/allele/effect/AlleleEffectTransmuting.java b/src/main/java/magicbees/bees/allele/effect/AlleleEffectTransmuting.java index 5e4b93d6..6c3b1a6e 100644 --- a/src/main/java/magicbees/bees/allele/effect/AlleleEffectTransmuting.java +++ b/src/main/java/magicbees/bees/allele/effect/AlleleEffectTransmuting.java @@ -37,13 +37,17 @@ protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedDat IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing); // Get random coords within territory - int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); - int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); - int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]); + int[] randomCoords = new int[3]; + for (int i = 0; i < 3; i++) { + int range = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[i]); + if (range > 0) { + randomCoords[i] = world.rand.nextInt(range) - range / 2; + } + } - int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2; - int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2; - int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2; + int xCoord = coords.posX + randomCoords[0]; + int yCoord = coords.posY + randomCoords[1]; + int zCoord = coords.posZ + randomCoords[2]; BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); transmutationController.attemptTransmutations(