コード例 #1
0
  @Test
  public void testEquality() {
    // Check wrapped equality
    assertEquals(doubleModifier, doubleModifier);
    assertNotSame(constantModifier, doubleModifier);

    assertEquals(doubleModifier.getHandle(), getModifierCopy(doubleModifier));
    assertEquals(constantModifier.getHandle(), getModifierCopy(constantModifier));
  }
コード例 #2
0
  /**
   * Retrieve the equivalent NMS attribute.
   *
   * @param attribute - the wrapped attribute.
   * @return The equivalent NMS attribute.
   */
  private AttributeSnapshot getAttributeCopy(WrappedAttribute attribute) {
    List<AttributeModifier> modifiers = Lists.newArrayList();

    for (WrappedAttributeModifier wrapper : attribute.getModifiers()) {
      modifiers.add((AttributeModifier) wrapper.getHandle());
    }

    PacketPlayOutUpdateAttributes accessor = new PacketPlayOutUpdateAttributes();
    return accessor
    .new AttributeSnapshot(attribute.getAttributeKey(), attribute.getBaseValue(), modifiers);
  }