Java Code Examples for java.lang.reflect.Array.getBoolean()

The following are Jave code examples for showing how to use getBoolean() of the java.lang.reflect.Array class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Zombe-Modpack   File: Cheat.java   View Source Code Vote up 4 votes
@Override
protected void onClientTick(EntityPlayerSP player) {
    modCheatAllowed = ZHandle.handle("allowCheats", true);

    if (getGamma() < 100f) cheatGamma = getGamma();
    setGamma((cheating && cheatHighlight && (!isInMenu() || getMenu() instanceof GuiChat || getMenu() instanceof GuiContainer)) ? 1000f : cheatGamma);

    boolean enable = optNerfEnderman && !isMultiplayer();
    if (enable != cheatCarryOverride)
    try {
        cheatCarryOverride = enable;
        Object arr = getValue(fCarryBlocks, null);
        if (cheatCarryBlocks == null) {
            cheatCarryBlocks = new boolean[256];
            for (int i=0;i<256;i++) cheatCarryBlocks[i] = Array.getBoolean(arr, i);
        }
        for (int i=0;i<256;i++) Array.setBoolean(arr, i, !enable && cheatCarryBlocks[i]);
    } catch (Exception e) {}

    if (!isInMenu() && wasKeyPressedThisTick(keyCheat)) {
        cheating = !cheating;
        if (!modCheatAllowed && cheating) {
            cheating = false;
            chatClient("\u00a74zombe's \u00a72cheat\u00a74-mod is not allowed on this server.");
        }
    }

    if (!cheating) return;
    if (!isInMenu()) {
        if (wasKeyPressedThisTick(keyShowMobs)) cheatShowMobs = !cheatShowMobs;
        if (wasKeyPressedThisTick(keyShowOres)) cheatShowOres = !cheatShowOres;
        if (wasKeyPressedThisTick(keyHighlight)) cheatHighlight = !cheatHighlight;
        if (wasKeyPressedThisTick(keyHealth)) optRestoreHealth = !optRestoreHealth;
        if (wasKeyPressedThisTick(keyDamage)) optDisableDamage = !optDisableDamage;
        if (optSeeIsToggle) {
            if (wasKeyPressedThisTick(keySee)) cheatSee = !cheatSee;
        } else cheatSee = isKeyDownThisTick(keySee);
        if (!isMultiplayer() && wasKeyPressedThisTick(keyRemoveFire)) {
            BlockPos pos = getPos(getView());
            int x = getX(pos), y = getY(pos), z = getZ(pos);
            World world = getWorld();
            for (int dx = -16; dx <= 16; ++dx)
            for (int dy = -16; dy <= 16; ++dy)
            for (int dz = -16; dz <= 16; ++dz)
            if (getIdAt(world,x+dx,y+dy,z+dz) == 51)
                setIdAt(world,0,MARK_BOTH,x+dx,y+dy,z+dz);
        }
    }
    if (!isMultiplayer()) {
        /*
        if (!optCheatFallDamage) setFall(player, 0f);
        boolean arrowChk = true;
        if (optCheatInfArrows || optCheatInfArmor || optCheatInfSword || optCheatInfTools)
        for (int slot=0;slot<invItemsArr.length;slot++)
        if (invItemsArr[slot] != null) {
            ItemStack items = invItemsArr[slot];
            int id = getItemsId(items);
            if (id < 256 || id >= cheatItems) continue;
            if (optCheatInfArrows && id==262 && arrowChk) {
                arrowChk = false;
                int count = getItemsCount(items);
                if (cheatArrowCount - 1 == count) setItemsCount(items, ++count);
                cheatArrowCount = count;
            } else if (cheatDamage[id]) setItemsInfo(items, 0);
        }
        if (optCheatInfArmor) for (int slot=0;slot<invArmorsArr.length;slot++) if (invArmorsArr[slot] != null) {
            int id = getItemsId(invArmorsArr[slot]);
            if (id < 256 || id >= cheatItems) continue;
            if (cheatDamage[id]) setItemsInfo(invArmorsArr[slot], 0);
        }
        */
    }
}
 
Example 2
Project: jdk8u-jdk   File: MethodExitReturnValuesTest.java   View Source Code Vote up 4 votes
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}
 
Example 3
Project: openjdk-jdk10   File: Array_getBoolean01.java   View Source Code Vote up 4 votes
public static boolean test(int i) {
    return Array.getBoolean(array, i);
}
 
Example 4
Project: openjdk-jdk10   File: MethodExitReturnValuesTest.java   View Source Code Vote up 4 votes
static void doit(MethodExitReturnValuesTarg xx) {
    s_show("==========  Testing static methods ================");
    s_bytef();
    s_charf();
    s_doublef();
    s_floatf();
    s_intf();
    s_longf();
    s_shortf();
    s_booleanf();

    s_stringf();
    s_classf();
    s_classLoaderf();
    s_threadf();
    s_threadGroupf();
    s_intArrayf();
    s_nullObjectf();
    s_objectf();
    s_voidf();

    s_show("==========  Testing instance methods ================");
    xx.i_bytef();
    xx.i_charf();
    xx.i_doublef();
    xx.i_floatf();
    xx.i_intf();
    xx.i_longf();
    xx.i_shortf();
    xx.i_booleanf();
    xx.i_stringf();
    xx.i_intArrayf();
    xx.i_classf();
    xx.i_classLoaderf();
    xx.i_threadf();
    xx.i_threadGroupf();
    xx.i_nullObjectf();
    xx.i_objectf();
    xx.i_voidf();

    // Prove it works for native methods too
    s_show("==========  Testing native methods ================");
    StrictMath.sin(doubleValue);
    Array.getByte(arrByte, 0);
    Array.getChar(arrChar, 0);
    Array.getDouble(arrDouble, 0);
    Array.getFloat(arrFloat, 0);
    Array.getInt(arrInt, 0);
    Array.getLong(arrLong, 0);
    Array.getShort(arrShort, 0);
    Array.getBoolean(arrBoolean, 0);
    Array.get(arrObject, 0);
    stringValue.intern();
}