tapac
12/24/2017, 6:57 PMwouterdoeland
12/24/2017, 8:51 PMtapac
12/24/2017, 11:16 PMwouterdoeland
12/25/2017, 1:18 PMfor(x in baseX-regionParticleRange..baseX+regionParticleRange) {
for(z in baseZ-regionParticleRange..baseZ+regionParticleRange) {
if(regionForWand.inRegion(x, z)) {
if(regionForWand.getLocation(x, z) != null) {
event.player.spawnParticle(Particle.SNOWBALL, x.toDouble(), baseY.toDouble(), z.toDouble(), 3)
}
event.player.spawnParticle(Particle.VILLAGER_HAPPY, x.toDouble(), baseY.toDouble(), z.toDouble(), 1)
} else {
event.player.spawnParticle(Particle.SPELL_WITCH, x.toDouble(), baseY.toDouble(), z.toDouble(), 1)
}
}
}
The regionForWand.inRegion
function will be called a lot. This functions will in turn get a list of all the Location
objects and will determine whether the requested point is inside these locations. This will make a lot of requests of course as every point calls the inRegion
function.
Maybe I can fix it by creating a new function for inRegion that accepts an array and returns an array with all the points that are inside the locations.tapac
12/25/2017, 1:49 PMwouterdoeland
12/25/2017, 2:00 PM