Search in sources :

Example 6 with net.minecraft.server.v1_8_R3

use of net.minecraft.server.v1_8_R3 in project Denizen-For-Bukkit by DenizenScript.

the class WorldHelper_v1_8_R3 method setStatic.

@Override
public void setStatic(World world, boolean isStatic) {
    WorldServer worldServer = ((CraftWorld) world).getHandle();
    ReflectionHelper.setFieldValue(net.minecraft.server.v1_8_R3.World.class, "isClientSide", worldServer, isStatic);
}
Also used : WorldServer(net.minecraft.server.v1_8_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 7 with net.minecraft.server.v1_8_R3

use of net.minecraft.server.v1_8_R3 in project acidisland by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_8_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_8_R3.IBlockData) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 8 with net.minecraft.server.v1_8_R3

use of net.minecraft.server.v1_8_R3 in project acidisland by tastybento.

the class NMSHandler method setFlowerPotBlock.

/* (non-Javadoc)
     * @see com.wasteofplastic.askyblock.nms.NMSAbstraction#setBlock(org.bukkit.block.Block, org.bukkit.inventory.ItemStack)
     * Credis: Mister_Frans (THANK YOU VERY MUCH !)
     */
@Override
public void setFlowerPotBlock(Block block, ItemStack itemStack) {
    Location loc = block.getLocation();
    CraftWorld cw = (CraftWorld) block.getWorld();
    BlockPosition bp = new BlockPosition(loc.getX(), loc.getY(), loc.getZ());
    TileEntityFlowerPot te = (TileEntityFlowerPot) cw.getHandle().getTileEntity(bp);
    // Bukkit.getLogger().info("Debug: flowerpot materialdata = " + (new ItemStack(potItem, 1,(short) potItemData).toString()));
    net.minecraft.server.v1_8_R3.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
    te.a(cis.getItem(), cis.getData());
    te.update();
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) TileEntityFlowerPot(net.minecraft.server.v1_8_R3.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) Location(org.bukkit.Location)

Example 9 with net.minecraft.server.v1_8_R3

use of net.minecraft.server.v1_8_R3 in project Citizens2 by CitizensDev.

the class NMSImpl method getTargetNavigator.

private MCNavigator getTargetNavigator(final org.bukkit.entity.Entity entity, final NavigatorParameters params, final Function<NavigationAbstract, Boolean> function) {
    net.minecraft.server.v1_8_R3.Entity raw = getHandle(entity);
    raw.onGround = true;
    // not sure of a better way around this - if onGround is false, then
    // navigation won't execute, and calling entity.move doesn't
    // entirely fix the problem.
    final NavigationAbstract navigation = NMSImpl.getNavigation(entity);
    return new MCNavigator() {

        float lastSpeed;

        CancelReason reason;

        @Override
        public CancelReason getCancelReason() {
            return reason;
        }

        @Override
        public Iterable<Vector> getPath() {
            return new NavigationIterable(navigation);
        }

        @Override
        public void stop() {
            stopNavigation(navigation);
        }

        @Override
        public boolean update() {
            if (params.speed() != lastSpeed) {
                if (Messaging.isDebugging()) {
                    Messaging.debug("Repathfinding " + ((NPCHolder) entity).getNPC().getId() + " due to speed change");
                }
                Entity handle = getHandle(entity);
                float oldWidth = handle.width;
                if (handle instanceof EntityHorse) {
                    handle.width = Math.min(0.99f, oldWidth);
                }
                if (!function.apply(navigation)) {
                    reason = CancelReason.STUCK;
                }
                // minecraft requires that an entity fit onto both blocks if width >= 1f,
                handle.width = oldWidth;
                // but we'd prefer to make it just fit on 1 so hack around it a bit.
                lastSpeed = params.speed();
            }
            navigation.a(params.speed());
            return NMSImpl.isNavigationFinished(navigation);
        }
    };
}
Also used : PathEntity(net.minecraft.server.v1_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) MCNavigator(net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator) EntityHorse(net.minecraft.server.v1_8_R3.EntityHorse) CancelReason(net.citizensnpcs.api.ai.event.CancelReason) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) NavigationAbstract(net.minecraft.server.v1_8_R3.NavigationAbstract) Vector(org.bukkit.util.Vector) Entity(net.minecraft.server.v1_8_R3.Entity)

Example 10 with net.minecraft.server.v1_8_R3

use of net.minecraft.server.v1_8_R3 in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_8_R3 method standsOnEntity.

@Override
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ) {
    try {
        // TODO: Find some simplification!
        final net.minecraft.server.v1_8_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
        final AxisAlignedBB box = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
        @SuppressWarnings("rawtypes") final List list = world.getEntities(mcEntity, box);
        @SuppressWarnings("rawtypes") final Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            final net.minecraft.server.v1_8_R3.Entity other = (net.minecraft.server.v1_8_R3.Entity) iterator.next();
            if (!(other instanceof EntityBoat)) {
                // && !(other instanceof EntityMinecart)) continue;
                continue;
            }
            if (minY >= other.locY && minY - other.locY <= 0.7) {
                return true;
            }
            // Still check this for some reason.
            final AxisAlignedBB otherBox = other.getBoundingBox();
            if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) {
                continue;
            } else {
                return true;
            }
        }
    } catch (Throwable t) {
    // Ignore exceptions (Context: DisguiseCraft).
    }
    return false;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_8_R3.AxisAlignedBB) Entity(org.bukkit.entity.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) EntityBoat(net.minecraft.server.v1_8_R3.EntityBoat) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) Iterator(java.util.Iterator) List(java.util.List)

Aggregations

CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)7 CompoundTag_v1_8_R3 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_8_R3)6 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)5 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)5 net.minecraft.server.v1_8_R3 (net.minecraft.server.v1_8_R3)4 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)4 UUID (java.util.UUID)3 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)2 ListTag (com.wasteofplastic.org.jnbt.ListTag)2 StringTag (com.wasteofplastic.org.jnbt.StringTag)2 Tag (com.wasteofplastic.org.jnbt.Tag)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)2 IBlockData (net.minecraft.server.v1_8_R3.IBlockData)2 NBTTagList (net.minecraft.server.v1_8_R3.NBTTagList)2 NBTTagString (net.minecraft.server.v1_8_R3.NBTTagString)2 TileEntityFlowerPot (net.minecraft.server.v1_8_R3.TileEntityFlowerPot)2