@Override public Optional<EyeLocationData> fill( DataHolder dataHolder, EyeLocationData manipulator, MergeFunction overlap) { if (supports(dataHolder)) { final EyeLocationData merged = overlap.merge(manipulator.copy(), from(dataHolder).get()); return Optional.of(manipulator.set(Keys.EYE_HEIGHT, merged.eyeHeight().get())); } return Optional.absent(); }
@Override public DataTransactionResult set( DataHolder dataHolder, EyeLocationData manipulator, MergeFunction function) { if (!supports(dataHolder)) { return DataTransactionBuilder.failResult(manipulator.getValues()); } final ImmutableValue<Double> newValue = manipulator.eyeHeight().asImmutable(); final EyeLocationData oldManipulator = from(dataHolder).get(); final ImmutableValue<Double> oldValue = oldManipulator.eyeHeight().asImmutable(); final EyeLocationData newData = function.merge(oldManipulator, manipulator); ((IMixinEntity) dataHolder).setEyeHeight(newData.eyeHeight().get()); return DataTransactionBuilder.successReplaceResult(newValue, oldValue); }