예제 #1
0
 @Override
 public String getItemName(Material item, short data) {
   long key = toLong(item.getId(), data);
   if (customNames.containsKey(key)) {
     return (String) customNames.get(key);
   }
   return (String) itemNames.get(key);
 }
예제 #2
0
 void addEquation(IdEquation equation) {
   size++;
   IdResult rhs = equation.rhs;
   if (rhs instanceof IdFinal) {
     solved.put(equation.id, ((IdFinal) rhs).value);
     moving.push(equation.id);
   } else if (rhs instanceof IdPending) {
     IdPending pendResult = ((IdPending) rhs).copy();
     IdResult norm = normalize(pendResult.delta);
     if (norm instanceof IdFinal) {
       solved.put(equation.id, ((IdFinal) norm).value);
       moving.push(equation.id);
     } else {
       IdPending pendResult1 = ((IdPending) rhs).copy();
       for (IntIdComponent component : pendResult1.delta) {
         for (long trigger : component.ids) {
           TLongHashSet set = dependencies.get(trigger);
           if (set == null) {
             set = new TLongHashSet();
             dependencies.put(trigger, set);
           }
           set.add(equation.id);
         }
         pending.put(equation.id, pendResult1);
       }
     }
   }
 }
 public final boolean execute(long key, Object value) {
   int index = _otherMap.index(key);
   if (index >= 0 && eq(value, _otherMap.get(key))) {
     return true;
   }
   return false;
 }
예제 #4
0
 public String getCustomItemTexturePlugin(Material item, short data) {
   long info = toLong(item.getId(), data);
   if (customTexturesPlugin.containsKey(info)) {
     return (String) customTexturesPlugin.get(info);
   }
   return null;
 }
 public SNode get(SNodeId key) {
   if (key instanceof Regular) {
     return myRegularMap.get(((Regular) key).getId());
   } else if (key instanceof Foreign) {
     return myForeignMap.get(((Foreign) key).getId());
   } else {
     return myOtherMap.get(key);
   }
 }
예제 #6
0
  TLongObjectHashMap<Value> solve() {
    while (!moving.empty()) {
      long id = moving.pop();
      Value value = solved.get(id);

      boolean stable = id > 0;
      long[] pIds = stable ? new long[] {id, -id} : new long[] {-id, id};
      Value[] pVals = stable ? new Value[] {value, value} : new Value[] {value, lattice.top};

      for (int i = 0; i < pIds.length; i++) {
        long pId = pIds[i];
        Value pVal = pVals[i];
        TLongHashSet dIds = dependencies.get(pId);
        if (dIds == null) {
          continue;
        }
        TLongIterator dIdsIterator = dIds.iterator();
        while (dIdsIterator.hasNext()) {
          long dId = dIdsIterator.next();
          IdPending pend = pending.remove(dId);
          if (pend != null) {
            IdResult pend1 = substitute(pend, pId, pVal);
            if (pend1 instanceof IdFinal) {
              IdFinal fi = (IdFinal) pend1;
              solved.put(dId, fi.value);
              moving.push(dId);
            } else {
              pending.put(dId, (IdPending) pend1);
            }
          }
        }
      }
    }
    pending.clear();
    return solved;
  }
예제 #7
0
 public void onPlayerJoin(SpoutPlayer player) {
   if (((SpoutPlayer) player).isSpoutCraftEnabled()) {
     for (TLongObjectIterator it = customNames.iterator(); it.hasNext(); ) {
       it.advance();
       ((SpoutPlayer) player)
           .sendPacket(
               new PacketItemName(msw(it.key()), (short) lsw(it.key()), (String) it.value()));
     }
     for (TLongObjectIterator it = customTextures.iterator(); it.hasNext(); ) {
       it.advance();
       String pluginName = (String) customTexturesPlugin.get(it.key());
       ((SpoutPlayer) player)
           .sendPacket(
               new PacketItemTexture(
                   msw(it.key()), (short) lsw(it.key()), pluginName, (String) it.value()));
     }
   }
 }
예제 #8
0
 @Override
 public MethodInfo getMethodInfo(long hash) {
   MethodInfo info = (MethodInfo) methodInfos.get(hash);
   return info;
 }
예제 #9
0
 @Override
 public SNode get(SNodeId key) {
   if (!(key instanceof Regular)) return null;
   return myRegularMap.get(((Regular) key).getId());
 }