Search in sources :

Example 6 with Material

use of net.minecraft.server.v1_10_R1.Material in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

public static int a(IBlockAccess paramIBlockAccess, Entity paramEntity, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3) {
    int k = 0;
    BlockPosition localBlockPosition = new BlockPosition(paramEntity);
    BlockPosition.MutableBlockPosition localMutableBlockPosition = new BlockPosition.MutableBlockPosition();
    for (int m = paramInt1; m < paramInt1 + paramInt4; m++) {
        for (int n = paramInt2; n < paramInt2 + paramInt5; n++) {
            for (int i1 = paramInt3; i1 < paramInt3 + paramInt6; i1++) {
                localMutableBlockPosition.c(m, n, i1);
                Block localBlock = paramIBlockAccess.getType(localMutableBlockPosition).getBlock();
                if (localBlock.getMaterial() != Material.AIR) {
                    if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
                        k = 1;
                    } else if ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
                        if (paramBoolean1) {
                            return -1;
                        }
                        k = 1;
                    } else if ((!paramBoolean3) && ((localBlock instanceof BlockDoor)) && (localBlock.getMaterial() == Material.WOOD)) {
                        return 0;
                    }
                    if ((paramEntity.world.getType(localMutableBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) {
                        if ((!(paramEntity.world.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramEntity.world.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
                            return -3;
                        }
                    } else if (!localBlock.b(paramIBlockAccess, localMutableBlockPosition)) {
                        if ((!paramBoolean2) || (!(localBlock instanceof BlockDoor)) || (localBlock.getMaterial() != Material.WOOD)) {
                            if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockFenceGate)) || ((localBlock instanceof BlockCobbleWall))) {
                                return -3;
                            }
                            if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR)) {
                                return -4;
                            }
                            Material localMaterial = localBlock.getMaterial();
                            if (localMaterial == Material.LAVA) {
                                if (!paramEntity.ab()) {
                                    return -2;
                                }
                            } else {
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    return k != 0 ? 2 : 1;
}
Also used : BlockDoor(net.minecraft.server.v1_8_R3.BlockDoor) BlockFenceGate(net.minecraft.server.v1_8_R3.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_8_R3.BlockCobbleWall) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) Material(net.minecraft.server.v1_8_R3.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_8_R3.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_8_R3.BlockFence) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 7 with Material

use of net.minecraft.server.v1_10_R1.Material in project askyblock by tastybento.

the class NMSHandler method setPotion.

/* (non-Javadoc)
     * @see com.wasteofplastic.acidisland.nms.NMSAbstraction#setPotion(com.wasteofplastic.org.jnbt.Tag)
     */
@SuppressWarnings({ "unchecked" })
@Override
public ItemStack setPotion(Material material, Tag itemTags, ItemStack chestItem) {
    Map<String, Tag> cont = (Map<String, Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String, Tag> contents = (Map<String, Tag>) ((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag) contents.get("Potion"));
            if (stringTag != null) {
                String tag = ((StringTag) contents.get("Potion")).getValue();
                // Bukkit.getLogger().info("DEBUG: potioninfo found: " + tag);
                net.minecraft.server.v1_10_R1.ItemStack stack = CraftItemStack.asNMSCopy(chestItem);
                NBTTagCompound tagCompound = stack.getTag();
                if (tagCompound == null) {
                    tagCompound = new NBTTagCompound();
                }
                tagCompound.setString("Potion", tag);
                stack.setTag(tagCompound);
                return CraftItemStack.asBukkitCopy(stack);
            }
        }
    }
    // Schematic is old, the potions do not have tags
    // Set it to zero so that the potion bottles don't look like giant purple and black blocks
    chestItem.setDurability((short) 0);
    Bukkit.getLogger().warning("Potion in schematic is pre-V1.9 format and will just be water.");
    return chestItem;
}
Also used : StringTag(com.wasteofplastic.org.jnbt.StringTag) NBTTagCompound(net.minecraft.server.v1_10_R1.NBTTagCompound) NBTTagString(net.minecraft.server.v1_10_R1.NBTTagString) ListTag(com.wasteofplastic.org.jnbt.ListTag) StringTag(com.wasteofplastic.org.jnbt.StringTag) CompoundTag(com.wasteofplastic.org.jnbt.CompoundTag) Tag(com.wasteofplastic.org.jnbt.Tag) Map(java.util.Map)

Example 8 with Material

use of net.minecraft.server.v1_10_R1.Material in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    int i = paramInt1 - paramInt4 / 2;
    int j = paramInt3 - paramInt6 / 2;
    if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int k = i; k < i + paramInt4; k++) {
        for (int m = j; m < j + paramInt6; m++) {
            double d1 = k + 0.5D - paramVec3D.a;
            double d2 = m + 0.5D - paramVec3D.c;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock();
                Material localMaterial = localBlock.getMaterial();
                if (localMaterial == Material.AIR) {
                    return false;
                }
                if ((localMaterial == Material.WATER) && (!this.b.V())) {
                    return false;
                }
                if (localMaterial == Material.LAVA) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) Material(net.minecraft.server.v1_8_R3.Material) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 9 with Material

use of net.minecraft.server.v1_10_R1.Material in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

private PathType b(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
    IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
    Block localBlock = localIBlockData.getBlock();
    Material localMaterial = localIBlockData.getMaterial();
    if (localMaterial == Material.AIR) {
        return PathType.OPEN;
    }
    if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR) || (localBlock == Blocks.WATERLILY)) {
        return PathType.TRAPDOOR;
    }
    if (localBlock == Blocks.FIRE) {
        return PathType.DAMAGE_FIRE;
    }
    if (localBlock == Blocks.CACTUS) {
        return PathType.DAMAGE_CACTUS;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_WOOD_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_IRON_CLOSED;
    }
    if (((localBlock instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_OPEN;
    }
    if ((localBlock instanceof BlockMinecartTrackAbstract)) {
        return PathType.RAIL;
    }
    if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockCobbleWall)) || (((localBlock instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
        return PathType.FENCE;
    }
    if (localMaterial == Material.WATER) {
        return PathType.WATER;
    }
    if (localMaterial == Material.LAVA) {
        return PathType.LAVA;
    }
    if (localBlock.b(paramIBlockAccess, localBlockPosition)) {
        return PathType.OPEN;
    }
    return PathType.BLOCKED;
}
Also used : BlockDoor(net.minecraft.server.v1_11_R1.BlockDoor) IBlockData(net.minecraft.server.v1_11_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_11_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_11_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block) Material(net.minecraft.server.v1_11_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_11_R1.BlockFence)

Aggregations

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 Map (java.util.Map)2 NBTTagCompound (net.minecraft.server.v1_10_R1.NBTTagCompound)2 NBTTagString (net.minecraft.server.v1_10_R1.NBTTagString)2 Block (net.minecraft.server.v1_8_R3.Block)2 Material (org.bukkit.Material)2 NPC (net.citizensnpcs.api.npc.NPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC)1 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)1 Block (net.minecraft.server.v1_10_R1.Block)1 BlockCobbleWall (net.minecraft.server.v1_10_R1.BlockCobbleWall)1 BlockDoor (net.minecraft.server.v1_10_R1.BlockDoor)1 BlockFence (net.minecraft.server.v1_10_R1.BlockFence)1 BlockFenceGate (net.minecraft.server.v1_10_R1.BlockFenceGate)1 BlockMinecartTrackAbstract (net.minecraft.server.v1_10_R1.BlockMinecartTrackAbstract)1 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)1 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)1