use of org.bukkit.craftbukkit.v1_13_R1.CraftWorld in project LoliServer by Loli-Server.
the class CraftHanging method update.
protected void update() {
if (!getHandle().isAlive()) {
return;
}
ServerWorld world = ((CraftWorld) getWorld()).getHandle();
ChunkManager.EntityTracker entityTracker = world.getChunkSource().chunkMap.entityMap.get(getEntityId());
if (entityTracker == null) {
return;
}
entityTracker.broadcast(getHandle().getAddEntityPacket());
}
use of org.bukkit.craftbukkit.v1_13_R1.CraftWorld in project PGM by PGMDev.
the class NMSHacks method getTargetedBLock.
static RayBlockIntersection getTargetedBLock(Player player) {
Location start = player.getEyeLocation();
World world = player.getWorld();
Vector startVector = start.toVector();
Vector end = start.toVector().add(start.getDirection().multiply(player.getGameMode() == GameMode.CREATIVE ? 6 : 4.5));
MovingObjectPosition hit = ((CraftWorld) world).getHandle().rayTrace(new Vec3D(startVector.getX(), startVector.getY(), startVector.getZ()), new Vec3D(end.getX(), end.getY(), end.getZ()), false, false, false);
if (hit != null && hit.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
return new RayBlockIntersection(world.getBlockAt(hit.a().getX(), hit.a().getY(), hit.a().getZ()), CraftBlock.notchToBlockFace(hit.direction), new Vector(hit.pos.a, hit.pos.b, hit.pos.c));
} else {
return null;
}
}
use of org.bukkit.craftbukkit.v1_13_R1.CraftWorld in project JeffLib by JEFF-Media-GbR.
the class NMSHandler method createHologram.
@Override
public Object createHologram(@NotNull final Location location, @NotNull final String line, @NotNull final Hologram.Type type) {
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final ServerLevel world = craftWorld.getHandle();
final Component baseComponent = CraftChatMessage.fromString(line)[0];
final Entity entity;
switch(type) {
case EFFECTCLOUD:
entity = new AreaEffectCloud(world, location.getX(), location.getY(), location.getZ());
final AreaEffectCloud effectCloud = (AreaEffectCloud) entity;
effectCloud.setRadius(0);
effectCloud.setWaitTime(0);
effectCloud.setDuration(Integer.MAX_VALUE);
break;
case ARMORSTAND:
default:
entity = new ArmorStand(world, location.getX(), location.getY(), location.getZ());
final ArmorStand armorStand = (ArmorStand) entity;
// setnogravity
armorStand.setNoGravity(true);
// setinvisible
armorStand.setInvisible(true);
// setmarker
armorStand.setMarker(true);
// setsmall
armorStand.setSmall(true);
}
// setinvulnerable
entity.setInvulnerable(true);
// setsilent
entity.setSilent(true);
// setcustomname
entity.setCustomName(baseComponent);
// setcustomnamevisible
entity.setCustomNameVisible(true);
return entity;
}
use of org.bukkit.craftbukkit.v1_13_R1.CraftWorld in project JeffLib by JEFF-Media-GbR.
the class NMSHandler method createHologram.
@Override
public Object createHologram(@NotNull final Location location, @NotNull final String line, @NotNull final Hologram.Type type) {
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final World world = craftWorld.getHandle();
final IChatBaseComponent baseComponent = CraftChatMessage.fromString(line)[0];
final Entity entity;
switch(type) {
case EFFECTCLOUD:
entity = new EntityAreaEffectCloud(world, location.getX(), location.getY(), location.getZ());
final EntityAreaEffectCloud effectCloud = (EntityAreaEffectCloud) entity;
effectCloud.setRadius(0);
effectCloud.setWaitTime(0);
effectCloud.setDuration(Integer.MAX_VALUE);
break;
case ARMORSTAND:
default:
entity = new EntityArmorStand(world, location.getX(), location.getY(), location.getZ());
final EntityArmorStand armorStand = (EntityArmorStand) entity;
armorStand.setNoGravity(true);
armorStand.setInvisible(true);
armorStand.setMarker(true);
armorStand.setSmall(true);
}
entity.setInvulnerable(true);
entity.setSilent(true);
entity.setCustomName(baseComponent);
entity.setCustomNameVisible(true);
return entity;
}
use of org.bukkit.craftbukkit.v1_13_R1.CraftWorld in project JeffLib by JEFF-Media-GbR.
the class NMSHandler method createHologram.
@Override
public Object createHologram(@NotNull final Location location, @NotNull final String line, @NotNull final Hologram.Type type) {
final CraftWorld craftWorld = (CraftWorld) location.getWorld();
final World world = craftWorld.getHandle();
final IChatBaseComponent baseComponent = CraftChatMessage.fromString(line)[0];
final Entity entity;
switch(type) {
case EFFECTCLOUD:
entity = new EntityAreaEffectCloud(world, location.getX(), location.getY(), location.getZ());
final EntityAreaEffectCloud effectCloud = (EntityAreaEffectCloud) entity;
effectCloud.setRadius(0);
effectCloud.setWaitTime(0);
effectCloud.setDuration(Integer.MAX_VALUE);
break;
case ARMORSTAND:
default:
entity = new EntityArmorStand(world, location.getX(), location.getY(), location.getZ());
final EntityArmorStand armorStand = (EntityArmorStand) entity;
armorStand.setNoGravity(true);
armorStand.setInvisible(true);
armorStand.setMarker(true);
armorStand.setSmall(true);
}
entity.setInvulnerable(true);
entity.setSilent(true);
entity.setCustomName(baseComponent);
entity.setCustomNameVisible(true);
return entity;
}
Aggregations