Search in sources :

Example 66 with World

use of net.minecraft.server.v1_15_R1.World in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method setChestName.

@Override
public void setChestName(Location chest, String name) {
    assert chest.getWorld() != null;
    World world = ((CraftWorld) chest.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(chest.getBlockX(), chest.getBlockY(), chest.getBlockZ());
    TileEntityChest tileEntityChest = (TileEntityChest) world.getTileEntity(blockPosition);
    assert tileEntityChest != null;
    tileEntityChest.setCustomName(CraftChatMessage.fromString(name)[0]);
}
Also used : TileEntityChest(net.minecraft.server.v1_16_R3.TileEntityChest) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 67 with World

use of net.minecraft.server.v1_15_R1.World in project SSB-OneBlock by BG-Software-LLC.

the class NMSAdapter_v1_8_R3 method setBlock.

@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
    assert location.getWorld() != null;
    World worldServer = ((CraftWorld) location.getWorld()).getHandle();
    BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    worldServer.t(blockPosition);
    org.bukkit.block.Block bukkitBlock = location.getBlock();
    bukkitBlock.setType(type);
    if (data > 0)
        // noinspection deprecation
        bukkitBlock.setData(data);
    if (nbt != null) {
        try {
            Block block = worldServer.getType(blockPosition).getBlock();
            IBlockData blockData = block.fromLegacyData(CommandAbstract.a(nbt, 0, 15));
            worldServer.setTypeAndData(blockPosition, blockData, 2);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
Also used : IBlockData(net.minecraft.server.v1_8_R3.IBlockData) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 68 with World

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

the class V1_15R1EntityAccessor 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) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity) Entity(net.minecraft.server.v1_15_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_15_R1.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 69 with World

use of net.minecraft.server.v1_15_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 70 with World

use of net.minecraft.server.v1_15_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)

Aggregations

Location (org.bukkit.Location)27 World (net.minecraft.server.v1_16_R3.World)16 World (net.minecraft.server.v1_12_R1.World)15 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)15 World (net.minecraft.server.v1_8_R3.World)14 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)14 ArrayList (java.util.ArrayList)12 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_15_R1.CraftWorld)10 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