use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class AntiJumpListener method onBlockPlace.
@Listener(order = Order.POST)
@IsCancelled(value = Tristate.TRUE)
public void onBlockPlace(ChangeBlockEvent.Place event, @Root Player player) {
final Location<World> playerLoc = player.getLocation();
for (Transaction<BlockSnapshot> transaction : event.getTransactions()) {
Optional<Location<World>> optLoc = transaction.getOriginal().getLocation();
if (!optLoc.isPresent()) {
continue;
}
Location<World> blockLoc = optLoc.get();
final int blockY = blockLoc.getBlockY();
if (Math.abs(player.getVelocity().getY()) > UPWARDS_VELOCITY && playerLoc.getY() > blockY) {
Task.builder().execute(() -> {
Vector3d position = player.getLocation().getPosition();
if (position.getY() >= (blockY + LEAP_DISTANCE)) {
if (playerLoc.getPosition().distanceSquared(blockLoc.getPosition()) > Math.pow(RADIUS, 2)) {
return;
}
player.sendMessage(Text.of(TextColors.RED, "Hack jumping detected."));
player.setLocation(playerLoc.setPosition(new Vector3d(position.getX(), blockY, position.getZ())));
}
}).delayTicks(4).submit(SkreePlugin.inst());
}
}
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class EntityDirectionUtil method getFacingVector.
public static Vector3d getFacingVector(Living living) {
Vector3d rot = living.getHeadRotation();
double xRot = (rot.getY() + 90) % 360;
double yRot = rot.getX() * -1;
double h = Math.cos(Math.toRadians(yRot));
return new Vector3d(h * Math.cos(Math.toRadians(xRot)), Math.sin(Math.toRadians(yRot)), h * Math.sin(Math.toRadians(xRot)));
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class FreakyFourInstance method dabombDetonate.
public void dabombDetonate(double percentEffectiveness) {
ZoneBoundingBox dabomb_RG = getRegion(FreakyFourBoss.DA_BOMB);
Vector3i min = dabomb_RG.getMinimumPoint();
Vector3i max = dabomb_RG.getMaximumPoint();
int minX = min.getX();
int minY = min.getY();
int minZ = min.getZ();
int maxX = max.getX();
int maxZ = max.getZ();
int dmgFact = (int) Math.max(3, percentEffectiveness * config.daBombTNTStrength);
for (int x = minX; x < maxX; ++x) {
for (int z = minZ; z < maxZ; ++z) {
if (Probability.getChance(config.daBombTNT)) {
getRegion().getExtent().triggerExplosion(Explosion.builder().location(new Location<>(getRegion().getExtent(), new Vector3d(x, minY, z))).radius(dmgFact).canCauseFire(false).shouldDamageEntities(true).build(), Cause.source(SkreePlugin.container()).build());
}
}
}
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class TheForgeInstance method setUp.
private void setUp() {
Vector3d centerPoint = getRegion().getCenter();
centralDropPoint = new Location<>(getRegion().getExtent(), new Vector3d(centerPoint.getX(), getRegion().getMinimumPoint().getY() + 11, centerPoint.getZ()));
state = ForgeState.load();
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class BlipDefense method apply.
@Override
public Optional<Instruction<DamagedCondition, Boss<Zombie, CatacombsBossDetail>>> apply(DamagedCondition damagedCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss) {
CatacombsBossDetail detail = zombieCatacombsBossDetailBoss.getDetail();
if (activate(detail)) {
Zombie boss = zombieCatacombsBossDetailBoss.getTargetEntity().get();
Vector3d vel = EntityDirectionUtil.getFacingVector(boss);
vel = vel.mul(getMultiplier());
vel = new Vector3d(vel.getX(), Math.min(getYCiel(), Math.max(getYFloor(), vel.getY())), vel.getZ());
boss.setVelocity(vel);
}
return Optional.empty();
}
Aggregations