Search in sources :

Example 91 with CraftWorld

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());
}
Also used : ServerWorld(net.minecraft.world.server.ServerWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) ChunkManager(net.minecraft.world.server.ChunkManager)

Example 92 with CraftWorld

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;
    }
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) World(org.bukkit.World) Vector(org.bukkit.util.Vector) RayBlockIntersection(tc.oc.pgm.util.block.RayBlockIntersection)

Example 93 with CraftWorld

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;
}
Also used : ServerLevel(net.minecraft.server.level.ServerLevel) SkullBlockEntity(net.minecraft.world.level.block.entity.SkullBlockEntity) Entity(net.minecraft.world.entity.Entity) ArmorStand(net.minecraft.world.entity.decoration.ArmorStand) Component(net.minecraft.network.chat.Component) AreaEffectCloud(net.minecraft.world.entity.AreaEffectCloud) CraftWorld(org.bukkit.craftbukkit.v1_18_R1.CraftWorld)

Example 94 with CraftWorld

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;
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld)

Example 95 with CraftWorld

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;
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Aggregations

ServerLevel (net.minecraft.server.level.ServerLevel)147 Location (org.bukkit.Location)131 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)111 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)103 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)95 BlockPos (net.minecraft.core.BlockPos)83 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)74 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)66 ItemStack (org.bukkit.inventory.ItemStack)61 Block (org.bukkit.block.Block)57 LivingEntity (org.bukkit.entity.LivingEntity)54 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)53 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)47 ArrayList (java.util.ArrayList)43 World (org.bukkit.World)41 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)39 Entity (org.bukkit.entity.Entity)39 Level (net.minecraft.world.level.Level)38 List (java.util.List)34 GameProfile (com.mojang.authlib.GameProfile)32