private static IntHashMap createCopy(IntHashMap from, IntHashMap to) { if (to == null) to = new IntHashMap(); // Awkward, but who knows if this is faster than reflection? for (int i = -100; i <= 250; ++i) { if (from.containsItem(i)) to.addKey(i, from.lookup(i)); } return to; }
public static void func_74508_b() { field_74514_b.func_76046_c(); Iterator var0 = field_74516_a.iterator(); while (var0.hasNext()) { KeyBinding var1 = (KeyBinding) var0.next(); field_74514_b.func_76038_a(var1.field_74512_d, var1); } }
private static void rebuild() { clearInternal(); Set<Integer> keys = new HashSet<>(); Collection<OverrideGroup> groups = overrideGroups.values(); Iterator<OverrideGroup> iter = groups.iterator(); while (iter.hasNext()) { OverrideGroup group = iter.next(); if (group.ended) { iter.remove(); } else { for (int i : group.keys) { keys.add(i); } } } for (int keyid : keys) { KeyBinding kb = (KeyBinding) kbMap.removeObject(keyid); if (kb != null) { try { pressedField.set(kb, false); } catch (Exception e) { e.printStackTrace(); } // kb.setKeyCode(-1); activeOverrides.put(keyid, new Override(kb)); log("Override new [" + keyid + "]"); } else { log("Override ignored [" + keyid + "]"); } } }
private static void restoreLocks() { for (Map.Entry<Integer, Override> ao : activeOverrides.entrySet()) { try { pressedField.set(ao.getValue().kb, false); } catch (Exception e) { Throwables.propagate(e); } kbMap.removeObject(ao.getKey()); } }
private static void clearInternal() { activeOverrides .entrySet() .forEach( entry -> { Override ovr = entry.getValue(); int keyid = entry.getKey(); ovr.kb.setKeyCode(keyid); kbMap.addKey(keyid, ovr.kb); log("Override remove [" + keyid + "]"); }); activeOverrides.clear(); }
public KeyBinding(String p_i1001_1_, int p_i1001_2_) { this.field_74515_c = p_i1001_1_; this.field_74512_d = p_i1001_2_; field_74516_a.add(this); field_74514_b.func_76038_a(p_i1001_2_, this); }
public static void func_74510_a(int p_74510_0_, boolean p_74510_1_) { KeyBinding var2 = (KeyBinding) field_74514_b.func_76041_a(p_74510_0_); if (var2 != null) { var2.field_74513_e = p_74510_1_; } }
public static void func_74507_a(int p_74507_0_) { KeyBinding var1 = (KeyBinding) field_74514_b.func_76041_a(p_74507_0_); if (var1 != null) { ++var1.field_74511_f; } }
private static void releaseLocks() { for (Map.Entry<Integer, Override> ao : activeOverrides.entrySet()) { kbMap.addKey(ao.getKey(), ao.getValue().kb); } }