/** * Alias for {@link #setObject(int, WrappedWatchableObject, boolean)} */ public void setObject(int index, WrappedWatchableObject value) { setObject(index, value.getRawValue(), false); }
/** * Create an immutable chunk position from this coordinate. * @return The new immutable chunk position. */ public ChunkPosition toPosition() { return new ChunkPosition(getX(), getY(), getZ()); }
/** * Alias for {@link #setObject(int, Serializer, Object, boolean)} */ public void setObject(int index, Serializer serializer, Object value) { setObject(new WrappedDataWatcherObject(index, serializer), value, false); }
/** * Construct an attribute with the same key and name, but a different list of modifiers. * @param modifiers - attribute modifiers. * @return The new attribute. */ public WrappedAttribute withModifiers(Collection<WrappedAttributeModifier> modifiers) { return newBuilder(this).modifiers(modifiers).build(); }
/** * Gets the serializer for Vector3Fs * @return The serializer */ public static Serializer getVectorSerializer() { return get(Vector3F.getMinecraftClass()); }
/** * Gets the serializer for Directions * @return The serializer */ public static Serializer getDirectionSerializer() { return get(EnumWrappers.getDirectionClass()); }
@Override public WrappedBlockData deepClone() { return WrappedBlockData.createData(getType(), getData()); }
/** * Determine if the attribute has a given attribute modifier, identified by UUID. * @param id - the id to check for. * @return TRUE if it does, FALSE otherwise. */ public boolean hasModifier(UUID id) { return getModifiers().contains(WrappedAttributeModifier.newBuilder(id).build()); }
@Override protected byte[] getData() { initialize(); return super.getData(); }
@Override public String getMime() { initialize(); return super.getMime(); }
/** * Constructs a DataWatcher Item wrapper from a given index and initial value. * <p> * Not recommended in 1.9 and up. * @param index Index of the Item * @param value Initial value */ public WrappedWatchableObject(int index, Object value) { this(newHandle(WrappedDataWatcherObject.fromIndex(index), value)); }
@Override public boolean equals(Object obj) { // Fast checks if (this == obj) return true; if (obj == null) return false; // Only compare objects of similar type if (obj instanceof PlayerInfoData) { PlayerInfoData other = (PlayerInfoData) obj; return profile.equals(other.profile) && latency == other.latency && gameMode == other.gameMode && displayName.equals(other.displayName); } return false; }
/** * Sets the DataWatcher Item at a given index to a new value. * * @param index Index of the object to set * @param value New value * @param update Whether or not to inform the client * * @see {@link #setObject(int, Object, boolean)} */ public void setObject(int index, WrappedWatchableObject value, boolean update) { setObject(index, value.getRawValue(), update); }
/** * Sets the DataWatcher Item at a given index to a new value. * * @param index Index of the object to set * @param serializer Serializer from {@link Registry#get(Class)} * @param value New value * @param update Whether or not to inform the client * * @see {@link #setObject(WrappedDataWatcherObject, Object)} */ public void setObject(int index, Serializer serializer, Object value, boolean update) { setObject(new WrappedDataWatcherObject(index, serializer), value, update); }
/** * Sets the DataWatcher Item associated with a given watcher object to a new value. * * @param object Associated watcher object * @param value Wrapped value * @param update Whether or not to inform the client * * @see #setObject(WrappedDataWatcherObject, Object) */ public void setObject(WrappedDataWatcherObject object, WrappedWatchableObject value, boolean update) { setObject(object, value.getRawValue(), update); }
/** * Shortcut for {@link #setObject(WrappedDataWatcherObject, WrappedWatchableObject, boolean)} */ public void setObject(WrappedDataWatcherObject object, WrappedWatchableObject value) { setObject(object, value.getRawValue(), false); }