Search in sources :

Example 61 with World

use of net.minecraft.server.v1_14_R1.World in project FunnyGuilds by FunnyGuilds.

the class V1_14R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_14_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_14_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 62 with World

use of net.minecraft.server.v1_14_R1.World in project Atlas by funkemunky.

the class BlockBox1_14_R1 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_14_R1.World world = ((org.bukkit.craftbukkit.v1_14_R1.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    net.minecraft.server.v1_14_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
    net.minecraft.server.v1_14_R1.Block vblock = iblockData.getBlock();
    BlockPosition blockPos = new BlockPosition(x, y, z);
    VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
    List<AxisAlignedBB> boxes = shape.d();
    if (boxes.size() == 0) {
        return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
        }
        return complexBox;
    }
}
Also used : ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) CraftBlock(org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) net.minecraft.server.v1_14_R1(net.minecraft.server.v1_14_R1)

Example 63 with World

use of net.minecraft.server.v1_14_R1.World in project Atlas by funkemunky.

the class BlockBox1_16_R3 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(org.bukkit.block.Block block) {
    final net.minecraft.server.v1_16_R3.World world = ((org.bukkit.craftbukkit.v1_16_R3.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    net.minecraft.server.v1_16_R3.IBlockData iblockData = ((CraftBlock) block).getNMS();
    net.minecraft.server.v1_16_R3.Block vblock = iblockData.getBlock();
    BlockPosition blockPos = new BlockPosition(x, y, z);
    VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
    List<AxisAlignedBB> boxes = shape.d();
    if (boxes.size() == 0) {
        return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
        }
        return complexBox;
    }
}
Also used : World(net.minecraft.server.v1_16_R3.World) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) CraftBlock(org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) net.minecraft.server.v1_16_R3(net.minecraft.server.v1_16_R3) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 64 with World

use of net.minecraft.server.v1_14_R1.World in project UltraCosmetics by iSach.

the class MorphElderGuardian method onEquip.

@Override
protected void onEquip() {
    super.onEquip();
    World world = ((CraftWorld) getPlayer().getWorld()).getHandle();
    customGuardian = new CustomGuardian(EntityTypes.ELDER_GUARDIAN, world);
    customEntities.add(customGuardian);
    customGuardian.check();
    Location location = getPlayer().getLocation();
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    customGuardian.setLocation(x, y, z, 0, 0);
    EntitySpawningManager.setBypass(true);
    world.addEntity(customGuardian);
    EntitySpawningManager.setBypass(false);
    getPlayer().setPassenger(customGuardian.getBukkitEntity());
    customGuardian.setInvisible(true);
}
Also used : World(net.minecraft.server.v1_14_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld) CustomGuardian(be.isach.ultracosmetics.v1_14_R1.customentities.CustomGuardian) Location(org.bukkit.Location)

Example 65 with World

use of net.minecraft.server.v1_14_R1.World in project UltraCosmetics by iSach.

the class MorphElderGuardian method onEquip.

@Override
protected void onEquip() {
    super.onEquip();
    World world = ((CraftWorld) getPlayer().getWorld()).getHandle();
    customGuardian = new CustomGuardian(EntityTypes.ELDER_GUARDIAN, world);
    customEntities.add(customGuardian);
    customGuardian.check();
    Location location = getPlayer().getLocation();
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    customGuardian.setLocation(x, y, z, 0, 0);
    EntitySpawningManager.setBypass(true);
    world.addEntity(customGuardian);
    EntitySpawningManager.setBypass(false);
    getPlayer().setPassenger(customGuardian.getBukkitEntity());
    customGuardian.setInvisible(true);
}
Also used : World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CustomGuardian(be.isach.ultracosmetics.v1_16_R3.customentities.CustomGuardian) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)26 World (net.minecraft.server.v1_16_R3.World)16 World (net.minecraft.server.v1_12_R1.World)14 World (net.minecraft.server.v1_8_R3.World)14 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)14 ArrayList (java.util.ArrayList)11 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)11 List (java.util.List)10 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)10 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)10 CraftWorld (org.bukkit.craftbukkit.v1_14_R1.CraftWorld)9 WildLoadersPlugin (com.bgsoftware.wildloaders.WildLoadersPlugin)8 Hologram (com.bgsoftware.wildloaders.api.holograms.Hologram)8 ChunkLoader (com.bgsoftware.wildloaders.api.loaders.ChunkLoader)8 ChunkLoaderNPC (com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC)8 ITileEntityChunkLoader (com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader)8 WChunkLoader (com.bgsoftware.wildloaders.loaders.WChunkLoader)8 Collection (java.util.Collection)8